Skip to content

Commit

Permalink
Merge pull request #974 from Dimitrie78/Zoe-binkino
Browse files Browse the repository at this point in the history
Renault Zoe Ph1
  • Loading branch information
dexterbg committed Feb 24, 2024
2 parents 5a36cd2 + 8665f0a commit e4bb89c
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 11 deletions.
1 change: 1 addition & 0 deletions vehicle/OVMS.V3/changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Open Vehicle Monitor System v3 - Change log
New notifications:
[alert] batt.12v.shutdown -- Alert about imminent 12V shutdown
- VFS toolkit: add recursive options to mkdir (-p) & rmdir (-r) commands
- Renault-Zoe-Ph1: add Cabin Pre-heat/cool Control


2022-09-01 MWJ 3.3.003 OTA release
Expand Down
12 changes: 10 additions & 2 deletions vehicle/OVMS.V3/components/vehicle_renaultzoe/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TPMS Display Kangoo No
Charge Status Display Yes
Charge Interruption Alerts No
Charge Control No
Cabin Pre-heat/cool Control No
Cabin Pre-heat/cool Control Yes
Lock/Unlock Vehicle No
Valet Mode Control No
Others
Expand All @@ -37,4 +37,12 @@ Others
After selecting the Renault Zoe/Kangoo vehicle module, the corresponding settings have to be made in the web interface via the "Renault Zoe/Kangoo" menu under "Features":

.. image:: Features.png
:width: 480px
:width: 480px


-------------------------
Using Cabin Pre-heat/cool
-------------------------

Climate control on is only supported. It starts the 5 minute booster. After 5 minutes it switches off automatically. For IOS users it is started via Homelink 1

55 changes: 49 additions & 6 deletions vehicle/OVMS.V3/components/vehicle_renaultzoe/src/rz_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,33 @@ void OvmsVehicleRenaultZoe::zoe_trip(int verbosity, OvmsWriter* writer, OvmsComm
}

OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandClimateControl(bool climatecontrolon) {
return NotImplemented;
if(!m_enable_write) {
ESP_LOGE(TAG, "CommandClimateControl failed / no write access");
return Fail;
}
ESP_LOGI(TAG, "CommandClimateControl %s", climatecontrolon ? "ON" : "OFF");

OvmsVehicle::vehicle_command_t res;

if (climatecontrolon) {
uint8_t data[4] = {0x80, 0x01, 0x30, 0x00};
canbus *obd;
obd = m_can1;

for (int i = 0; i < 7; i++) {
obd->WriteStandard(0x634, 4, data);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
res = Success;
} else {
res = NotImplemented;
}

// fallback to default implementation?
if (res == NotImplemented) {
res = OvmsVehicle::CommandClimateControl(climatecontrolon);
}
return res;
}

OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandWakeup() {
Expand Down Expand Up @@ -183,29 +209,46 @@ OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandDeactivateValet(con
}

OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandHomelink(int button, int durationms) {
// This is needed to enable climate control via Homelink for the iOS app
ESP_LOGI(TAG, "CommandHomelink button=%d durationms=%d", button, durationms);

OvmsVehicle::vehicle_command_t res = NotImplemented;
if (!m_enable_egpio) {
if (button == 0) {
res = CommandClimateControl(true);
}
else if (button == 1) {
res = CommandClimateControl(false);
}
}
#ifdef CONFIG_OVMS_COMP_MAX7317
if(m_enable_egpio) {
if (m_enable_egpio) {
if (button == 0) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_3, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_3, 1);
return Success;
res = Success;
}
if (button == 1) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_4, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_4, 1);
return Success;
res = Success;
}
if (button == 2) {
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_5, 0);
vTaskDelay(500 / portTICK_PERIOD_MS);
MyPeripherals->m_max7317->Output(MAX7317_EGPIO_5, 1);
return Success;
res = Success;
}
}
#endif
return NotImplemented;
// fallback to default implementation?
if (res == NotImplemented) {
res = OvmsVehicle::CommandHomelink(button, durationms);
}

return res;
}

OvmsVehicle::vehicle_command_t OvmsVehicleRenaultZoe::CommandTrip(int verbosity, OvmsWriter* writer) {
Expand Down
12 changes: 9 additions & 3 deletions vehicle/OVMS.V3/components/vehicle_renaultzoe/src/rz_web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ void OvmsVehicleRenaultZoe::WebDeInit()
void OvmsVehicleRenaultZoe::WebCfgFeatures(PageEntry_t& p, PageContext_t& c)
{
std::string error, info;
bool canwrite;
bool canwrite, use_gpios;
std::string vehicle_type;

if (c.method == "POST") {
// process form submission:
canwrite = (c.getvar("canwrite") == "yes");
use_gpios = (c.getvar("use_gpios") == "yes");
vehicle_type = c.getvar("vehicle_type");

// validate:
Expand All @@ -96,8 +97,9 @@ void OvmsVehicleRenaultZoe::WebCfgFeatures(PageEntry_t& p, PageContext_t& c)

if (error == "") {
// success:
MyConfig.SetParamValueBool("xrz", "canwrite", canwrite);
MyConfig.SetParamValue("xrz", "vehicle.type", vehicle_type);
MyConfig.SetParamValueBool("xrz", "canwrite", canwrite);
MyConfig.SetParamValueBool("xrz", "enable_egpio", use_gpios);
MyConfig.SetParamValue("xrz", "vehicle.type", vehicle_type);

info = "<p class=\"lead\">Success!</p><ul class=\"infolist\">" + info + "</ul>";
c.head(200);
Expand All @@ -115,6 +117,7 @@ void OvmsVehicleRenaultZoe::WebCfgFeatures(PageEntry_t& p, PageContext_t& c)
else {
// read configuration:
canwrite = MyConfig.GetParamValueBool("xrz", "canwrite", false);
use_gpios = MyConfig.GetParamValueBool("xrz", "enable_egpio", false);
vehicle_type = MyConfig.GetParamValue("xrz", "vehicle.type", "0");
c.head(200);
}
Expand All @@ -131,6 +134,9 @@ void OvmsVehicleRenaultZoe::WebCfgFeatures(PageEntry_t& p, PageContext_t& c)
c.input_select_option("Kangoo", "1", vehicle_type == "1");
c.input_select_end();

c.print("<hr>");
c.input_checkbox("use EGPIOs for Homelink", "use_gpios", use_gpios,
"<p>Disabeld are Default use for Homelink 1 = Climatecontrol for IOS and Android users. <br>When enable EGPIO 3, 4, 5 are switched for 500ms via Homelink 1, 2, 3.</p>");
c.print("<hr>");
c.input_button("default", "Save");
c.form_end();
Expand Down

0 comments on commit e4bb89c

Please sign in to comment.