/* ; Project: Open Vehicle Monitor System ; Date: 15th Apr 2022 ; ; (C) 2022 Carsten Schmiemann ; ; Permission is hereby granted, free of charge, to any person obtaining a copy ; of this software and associated documentation files (the "Software"), to deal ; in the Software without restriction, including without limitation the rights ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ; copies of the Software, and to permit persons to whom the Software is ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice shall be included in ; all copies or substantial portions of the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN ; THE SOFTWARE. */ #include "vehicle_renaultzoe_ph2.h" void OvmsVehicleRenaultZoePh2::IncomingEVC(uint16_t type, uint16_t pid, const char* data, uint16_t len) { switch (pid) { case 0x2006: { // Odometer (Total Vehicle Distance) StandardMetrics.ms_v_pos_odometer->SetValue((float) CAN_UINT24(0), Kilometers); ESP_LOGD(TAG, "2006 EVC ms_v_pos_odometer: %d", CAN_UINT24(0)); if (!mt_bus_awake) { ESP_LOGI(TAG,"Zoe woke up (Successful poll on odometer)"); mt_bus_awake->SetValue(true); StandardMetrics.ms_v_env_awake->SetValue(true); car_on(true); POLLSTATE_ON; } break; } case 0x2A8C: { StandardMetrics.ms_v_charge_12v_current->SetValue((float) (CAN_UINT(0)), Amps); ESP_LOGD(TAG, "2A8C EVC ms_v_charge_12v_current: %d", CAN_UINT(0)); break; } case 0x2005: { StandardMetrics.ms_v_charge_12v_voltage->SetValue((float) (CAN_UINT(0) * 0.01), Volts); ESP_LOGD(TAG, "2005 EVC ms_v_charge_12v_voltage: %f", CAN_UINT(0) * 0.01); break; } case 0x21D0: { StandardMetrics.ms_v_charge_12v_temp->SetValue((float) (CAN_UINT(4) - 40), Celcius); ESP_LOGD(TAG, "21D0 EVC ms_v_charge_12v_temp: %d", CAN_UINT(4) - 40); break; } case 0x21CF: { ESP_LOGD(TAG, "21CF EVC mt_inv_status: %d", CAN_NIBL(0)); if (CAN_NIBL(0) == 1) { mt_inv_status->SetValue("Inverter off"); } else if (CAN_NIBL(0) == 2) { mt_inv_status->SetValue("Inverter on"); } else if (CAN_NIBL(0) == 3) { mt_inv_status->SetValue("Inverter decharging"); } else if (CAN_NIBL(0) == 4) { mt_inv_status->SetValue("Inverter alternator mode"); } else if (CAN_NIBL(0) == 5) { mt_inv_status->SetValue("Inverter ready to sleep"); } else { mt_inv_status->SetValue("Inverter state unknown"); } break; } case 0xF446: { // Ambient temperature StandardMetrics.ms_v_env_temp->SetValue((float) (CAN_UINT(4) - 40) * 0.01, Celcius); ESP_LOGD(TAG, "F446 EVC ms_v_env_temp: %f", (CAN_UINT(4) - 40) * 0.01); break; } case 0x2A09: { // Power consumption by consumer mt_aux_power_consumer->SetValue((float) CAN_UINT(4) * 10, Watts); ESP_LOGD(TAG, "2A09 EVC mt_aux_power_consumer: %d", CAN_UINT(4) * 10); break; } case 0x2191: { // Power consumption by ptc mt_aux_power_ptc->SetValue((float) CAN_UINT(4) * 10, Watts); ESP_LOGD(TAG, "2191 EVC mt_aux_power_ptc: %d", CAN_UINT(4) * 10); break; } } }