CreasolTech / domoticz-hyundai-kia

9 stars 4 forks source link

Error message "GetJSonDevices: exception occurred : 'stoll' " after install plugin v1.1.5 and domoticz 2024.4 #15

Closed bbossink closed 5 months ago

bbossink commented 5 months ago

After activating the plugin the following output in log is vissible:

2024-04-02 20:33:40.876 Hyundai: Parameters={'HardwareID': 14, 'HomeFolder': '/home/bbossink/domoticz/plugins/domoticz-hyundai-kia/', 'StartupFolder': '/home/bbossink/domoticz/', 'UserDataFolder': '/home/bbossink/domoticz/', 'WebRoot': '', 'Database': '/home/bbossink/domoticz/domoticz.db', 'Language': 'nl', 'Version': '1.1.5', 'Author': 'CreasolTech, WillemD61', 'Name': 'Hyundai', 'Address': '1', 'Port': '2', 'SerialPort': '', 'Username': 'username@mail.com', 'Password': 'secretpasswordhere', 'Key': 'domoticz-hyundai-kia', 'Mode1': '480', 'Mode2': '60', 'Mode3': '1111', 'Mode4': '', 'Mode5': '', 'Mode6': '', 'DomoticzVersion': '2024.4', 'DomoticzHash': '731719420', 'DomoticzBuildTime': '2024-01-30 09:16:34'} 2024-04-02 20:33:40.873 Status: Hyundai: Initialized version 1.1.5, author 'CreasolTech, WillemD61' 2024-04-02 20:34:08.066 Hyundai: check_and_refresh_token()... 2024-04-02 20:34:10.319 Hyundai: check_and_force_update_vehicles(300)... 2024-04-02 20:34:18.123 Hyundai: Name=IONIQ Odometer=59457.2km Battery=0 2024-04-02 20:34:18.123 Hyundai: Vehicle= 2024-04-02 20:34:18.125 Hyundai: Vehicle(id='blabla', name='IONIQ', model='IONIQ Electric', registration_date='', year=None, VIN='', key=None, ccu_ccs2_protocol_support=0, enabled=True, _total_driving_range=105.0, _total_driving_range_value=105.0, _total_driving_range_unit='km', _odometer=59457.2, _odometer_value=59457.2, _odometer_unit='km', _geocode_address=None, _geocode_name=None, car_battery_percentage=86, engine_is_running=True, last_updated_at=datetime.datetime(2024, 4, 2, 20, 34, 13, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), timezone=tzfile('/usr/share/zoneinfo/Europe/Berlin'), dtc_count=None, dtc_descriptions=None, smart_key_battery_warning_is_on=None, washer_fluid_warning_is_on=None, brake_fluid_warning_is_on=None, _air_temperature=14.0, _air_temperature_value=14.0, _air_temperature_unit='°C', air_control_is_on=False, defrost_is_on=False, steering_wheel_heater_is_on=False, back_window_heater_is_on=0, side_mirror_heater_is_on=None, front_left_seat_status=None, front_right_seat_status=None, rear_left_seat_status=None, rear_right_seat_status=None, is_locked=True, front_left_door_is_open=0, front_right_door_is_open=0, back_left_door_is_open=0, back_right_door_is_open=0, trunk_is_open=False, hood_is_open=False, front_left_window_is_open=None, front_right_window_is_open=None, back_left_window_is_open=None, back_right_window_is_open=None, tire_pressure_all_warning_is_on=False, tire_pressure_rear_left_warning_is_on=False, tire_pressure_front_left_warning_is_on=False, tire_pressure_front_right_warning_is_on=False, tire_pressure_rear_right_warning_is_on=False, _next_service_distance=None, _next_service_distance_value=None, _next_service_distance_unit=None, _last_service_distance=None, _last_service_distance_value=None, _last_service_distance_unit=None, _location_latitude=52.372586, _location_longitude=6.906769, _location_last_set_time=datetime.datetime(2024, 4, 2, 20, 34, 15, tzinfo=tzfile('/usr/share/zoneinfo/Europe/Berlin')), ev_charge_port_door_is_open=None, ev_charge_limits_dc=80, ev_charge_limits_ac=90, ev_v2l_discharge_limit=None, total_power_consumed=407530, total_power_regenerated=184268, power_consumption_30d=119, daily_stats=[DailyDrivingStats(date=datetime.datetime(2024, 4, 2, 0, 0), total_consumed=4964, engine_consumption=3820, climate_consumption=754, onboard_electronics_consumption=390, battery_care_consumption=0, regenerated_energy=1948, distance=38), DailyDrivingStats(date=datetime.datetime(2024, 3, 29, 0, 0), total_consumed=692, engine_consumption=526, climate_consumption=66, onboard_electronics_consumption=100, battery_care_consumption=0, regenerated_energy=635, distance=6), DailyDrivingStats(date=datetime.datetime(2024, 3, 28, 0, 0), total_consumed=6604, engine_consumption=5351, climate_consumption=703, onboard_electronics_consumption=550, battery_care_consumption=0, regenerated_energy=3653, distance=55), DailyDrivingStats(date=datetime.datetime(2024, 3, 27, 0, 0), total_consumed=1995, engine_consumption=1795, climate_consumption=0, onboard_electronics_consumption=200, battery_care_consumption=0, regenerated_energy=819, distance=18), DailyDrivingStats(date=datetime.datetime(2024, 3, 26, 0, 0), total_consumed=7055, engine_consumption=6568, climate_consumption=147, onboard_electronics_consumption=340, battery_care_consumption=0, regenerated_energy=4408, distance=67), DailyDrivingStats(date=datetime.datetime(2024, 3, 25, 0, 0), total_consumed=11556, engine_consumption=9779, climate_consumption=1007, onboard_electronics_consumption=770, battery_care_consumption=0, regenerated_energy=4138, distance=99), DailyDrivingStats(date=datetime.datetime(2024, 3, 24, 0, 0), total_consumed=213, engine_consumption=13, climate_consumption=0, onboard_electronics_consumption=200, battery_care_consumption=0, regenerated_energy=2, distance=0), DailyDrivingStats(date=datetime.datetime(2024, 3, 23, 0, 0), total_consumed=11345, engine_consumption=9260, climate_consumption=905, onboard_electronics_consumption=1180, battery_care_consumption=0, regenerated_energy=8048, distance=94), 2024-04-02 20:34:18.125 Hyundai: DailyDrivingStats(date=datetime.datetime(2024, 3, 22, 0, 0), total_consumed=3103, engine_consumption=2303, climate_consumption=200, onboard_electronics_consumption=600, battery_care_consumption=0, regenerated_energy=3053, distance=21), DailyDrivingStats(date=datetime.datetime(2024, 3, 21, 0, 0), total_consumed=349, engine_consumption=131, climate_consumption=18, onboard_electronics_consumption=200, battery_care_consumption=0, regenerated_energy=192, distance=0), DailyDrivingStats(date=datetime.datetime(2024, 3, 19, 0, 0), total_consumed=7368, engine_consumption=6280, climate_consumption=548, onboard_electronics_consumption=540, battery_care_consumption=0, regenerated_energy=3095, distance=67), DailyDrivingStats(date=datetime.datetime(2024, 3, 18, 0, 0), total_consumed=8320, engine_consumption=7209, climate_consumption=601, onboard_electronics_consumption=510, battery_care_consumption=0, regenerated_energy=3458, distance=72), DailyDrivingStats(date=datetime.datetime(2024, 3, 16, 0, 0), total_consumed=5194, engine_consumption=4233, climate_consumption=381, onboard_electronics_consumption=580, battery_care_consumption=0, regenerated_energy=2196, distance=45), DailyDrivingStats(date=datetime.datetime(2024, 3, 15, 0, 0), total_consumed=6201, engine_consumption=5290, climate_consumption=171, onboard_electronics_consumption=740, battery_care_consumption=0, regenerated_energy=5961, distance=56), DailyDrivingStats(date=datetime.datetime(2024, 3, 14, 0, 0), total_consumed=6271, engine_consumption=5539, climate_consumption=422, onboard_electronics_consumption=310, battery_care_consumption=0, regenerated_energy=3033, distance=59), DailyDrivingStats(date=datetime.datetime(2024, 3, 13, 0, 0), total_consumed=11094, engine_consumption=9564, climate_consumption=910, onboard_electronics_consumption=620, battery_care_consumption=0, regenerated_energy=4444, distance=91), DailyDrivingStats(date=datetime.datetime(2024, 3, 12, 0, 0), total_consumed=6344, engine_consumption=4748, climate_consumption=976, onboard_electronics_consumption=620, battery_care_consumption=0, regenerated_energy=4482, distance=53), DailyDrivingStats(date=datetime.datetime(2024, 3, 11, 0, 0), total_consumed=11014, engine_consumption=8735, climate_consumption=1389, onboard_electronics_consumption=890, battery_care_consumption=0, regenerated_energy=4237, distance=90), DailyDrivingStats(date=datetime.datetime(2024, 3, 10, 0, 0), total_consumed=105, engine_consumption=5, climate_consumption=0, onboard_electronics_consumption=100, battery_care_consumption=0, regenerated_energy=2, distance=0), DailyDrivingStats(date=datetime.datetime(2024, 3, 9, 0, 0), total_consumed=107, engine_consumption=7, climate_consumption=0, onboard_electronics_consumption=100, battery_care_consumption=0, regenerated_energy=0, distance=0), DailyDrivingStats(date=datetime.datetime(2024, 3, 8, 0, 0), total_consumed=7945, engine_consumption=6899, climate_consumption=486, onboard_electronics_consumption=560, battery_care_consumption=0, regenerated_energy=5307, distance=75), DailyDrivingStats(date=datetime.datetime(2024, 3, 7, 0, 0), total_consumed=20564, engine_consumption=16517, climate_consumption=2687, onboard_electronics_consumption=1360, battery_care_consumption=0, regenerated_energy=9432, distance=160), DailyDrivingStats(date=datetime.datetime(2024, 3, 5, 0, 0), total_consumed=7648, engine_consumption=5966, climate_consumption=1042, onboard_electronics_consumption=640, battery_care_consumption=0, regenerated_energy=3148, distance=60), DailyDrivingStats(date=datetime.datetime(2024, 3, 4, 0, 0), total_consumed=8804, engine_consumption=7277, climate_consumption=997, onboard_electronics_consumption=530, battery_care_consumption=0, regenerated_energy=3335, distance=72)], month_trip_info=None, day_trip_info=None, ev_battery_percentage=37, ev_battery_soh_percentage=None, ev_battery_remain=None, ev_battery_capacity=None, ev_battery_is_charging=False, ev_battery_is_plugged_in=0, _ev_driving_range=105.0, _ev_driving_range_value=105.0, _ev_driving_range_unit='km', _ev_estimated_current_charge_duration=195, ev 2024-04-02 20:34:18.125 Hyundai: estimated_current_charge_duration_value=195, _ev_estimated_current_charge_duration_unit='m', _ev_estimated_fast_charge_duration=40, _ev_estimated_fast_charge_duration_value=40, _ev_estimated_fast_charge_duration_unit='m', _ev_estimated_portable_charge_duration=750, _ev_estimated_portable_charge_duration_value=750, _ev_estimated_portable_charge_duration_unit='m', _ev_estimated_station_charge_duration=195, _ev_estimated_station_charge_duration_value=195, _ev_estimated_station_charge_duration_unit='m', _ev_target_range_charge_AC=251, _ev_target_range_charge_AC_value=251, _ev_target_range_charge_AC_unit='km', _ev_target_range_charge_DC=222, _ev_target_range_charge_DC_value=222, _ev_target_range_charge_DC_unit='km', ev_first_departure_enabled=False, ev_second_departure_enabled=False, ev_first_departure_days=[0], ev_second_departure_days=[9], ev_first_departure_time=datetime.time(16, 0), ev_second_departure_time=datetime.time(0, 0), ev_off_peak_start_time=datetime.time(9, 0), ev_off_peak_end_time=datetime.time(18, 0), ev_off_peak_charge_only_enabled=True, _fuel_driving_range=None, _fuel_driving_range_value=None, _fuel_driving_range_unit=None, fuel_level=None, fuel_level_is_low=None, engine_type=<ENGINE_TYPES.EV: 'EV'>, data={'vehicleLocation': {'coord': {'lat': 52.372586, 'lon': 6.906769, 'alt': 18, 'type': 0}, 'head': 326, 'speed': {'value': 86, 'unit': 1}, 'accuracy': {'hdop': 0, 'pdop': 0}, 'time': '20240402203415'}, 'vehicleStatus': {'airCtrlOn': False, 'engine': True, 'doorLock': True, 'doorOpen': {'frontLeft': 0, 'frontRight': 0, 'backLeft': 0, 'backRight': 0}, 'trunkOpen': False, 'airTemp': {'value': '00H', 'unit': 0, 'hvacTempType': 0}, 'defrost': False, 'acc': True, 'evStatus': {'batteryCharge': False, 'batteryStatus': 37, 'batteryPlugin': 0, 'remainTime2': {'etc1': {'value': 40, 'unit': 1}, 'etc2': {'value': 750, 'unit': 1}, 'etc3': {'value': 195, 'unit': 1}, 'atc': {'value': 195, 'unit': 1}}, 'drvDistance': [{'rangeByFuel': {'evModeRange': {'value': 105, 'unit': 1}, 'totalAvailableRange': {'value': 105, 'unit': 1}}, 'type': 2}], 'reservChargeInfos': {'reservChargeInfo': {'reservChargeInfoDetail': {'reservInfo': {'day': [0], 'time': {'time': '0400', 'timeSection': 1}}, 'reservChargeSet': False, 'reservFatcSet': {'defrost': False, 'airTemp': {'value': '14H', 'unit': 0, 'hvacTempType': 0}, 'airCtrl': 0, 'heating1': 0}}}, 'offpeakPowerInfo': {'offPeakPowerTime1': {'starttime': {'time': '0900', 'timeSection': 0}, 'endtime': {'time': '0600', 'timeSection': 1}}, 'offPeakPowerFlag': 1}, 'reserveChargeInfo2': {'reservChargeInfoDetail': {'reservInfo': {'day': [9], 'time': {'time': '1200', 'timeSection': 0}}, 'reservChargeSet': False, 'reservFatcSet': {'defrost': False, 'airTemp': {'value': '14H', 'unit': 0, 'hvacTempType': 0}, 'airCtrl': 0, 'heating1': 0}}}, 'reservFlag': 1, 'ect': {'start': {'day': 9, 'time': {'time': '1200', 'timeSection': 0}}, 'end': {'day': 9, 'time': {'time': '1200', 'timeSection': 0}}}, 'targetSOClist': [{'targetSOClevel': 80, 'dte': {'rangeByFuel': {'evModeRange': {'value': 222, 'unit': 1}, 'totalAvailableRange': {'value': 222, 'unit': 1}}, 'type': 2}, 'plugType': 0}, {'targetSOClevel': 90, 'dte': {'rangeByFuel': {'evModeRange': {'value': 251, 'unit': 1}, 'totalAvailableRange': {'value': 251, 'unit': 1}}, 'type': 2}, 'plugType': 1}]}}, 'ign3': True, 'hoodOpen': False, 'transCond': False, 'steerWheelHeat': 0, 'sideBackWindowHeat': 0, 'tirePressureLamp': {'tirePressureLampAll': 0, 'tirePressureLampFL': 0, 'tirePressureLampFR': 0, 'tirePressureLampRL': 0, 'tirePressureLampRR': 0}, 'battery': {'batSoc': 86, 'batState': 0}, 'sleepModeCheck': False, 'time': '20240402203413', 'remoteWaitingTimeAlert': {'remoteControlAvailable': 1, 'remoteControlWaitingTime': 168, 'elapsedTime': '00:00:00'}, 'systemCutOffAlert': 0, 'tailLampStatus': 0, 'hazardStatus': 0}, 'odometer': {'value': 59457.2, 'unit': 1}}) 2024-04-02 20:34:18.125 Hyundai: base=192 baseFree=0 2024-04-02 20:34:18.125 Hyundai: Add devices for car IONIQ with base index 192 2024-04-02 20:34:18.174 Hyundai: Car found at base 192 2024-04-02 20:35:01.395 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:01.396 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:06.440 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:06.441 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:11.412 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:11.413 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:16.608 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:16.609 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:21.580 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:21.581 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:26.540 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:26.541 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:31.756 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:31.757 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:36.627 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:36.628 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:41.435 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:41.436 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:46.470 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-02 20:35:46.471 Error: GetJSonDevices: exception occurred : 'stoll'

Then if I restart domoticz: Fatal crash and domoticz stops working So, after restoring working domoticz.db database I added the plugin again. Now I did not restart domoticz but looked a bit around and saw sensor "Hyundai - IONIQ EV opwek undefined" with idx 455 To add some data to this counter I did: http://192.168.1.150/json.htm?type=command&param=udevice&idx=455&svalue=0

Then disabled the pluging (did not remove the plugin) and restarted domoticz again but still the GetJSonDevices: exception occurred : 'stoll' After activating the plugin again I saw in the log:

2024-04-02 22:36:26.120 Hyundai: STEERINGWHEELON=False 2024-04-02 22:36:26.133 Hyundai: OPEN=True 2024-04-02 22:36:26.140 Hyundai: TRUNK=False 2024-04-02 22:36:26.148 Hyundai: HOOD=False 2024-04-02 22:36:26.155 Hyundai: 12VBATT=86 2024-04-02 22:36:26.165 Hyundai: TIRES=False 2024-04-02 22:36:26.175 Hyundai: EVPWRCONS90DAYS=411288 2024-04-02 22:36:26.185 Hyundai: EVESTCHGDURATION=400 2024-04-02 22:36:26.196 Hyundai: EVTARGETCHGRANGE=252 2024-04-02 22:36:26.206 Hyundai: EVPWRREGEN90DAYS=185555 2024-04-02 22:36:26.236 Hyundai: ERROR: unable to retrieve the value of user variable with IDX 454 <Response [404]> 2024-04-02 22:36:26.255 Hyundai: ERROR: unable to retrieve the value of user variable with IDX 455 <Response [404]> 2024-04-02 22:36:26.255 Hyundai: updateDevices() completed!

I also noticed that no data could be retreived for sensor with IDX 454: Hyundai - IONIQ EV verbruik

So again I added some data to that counter: http://192.168.1.150/json.htm?type=command&param=udevice&idx=454&svalue=0

To my surprise the GetJSonDevices: exception occurred : 'stoll' error disapeared!!

Again disabled plugin (just to be sure....as I was afraid for another fatal crash) and restarted domoticz again.....no errors Activated plugin again......no 'stoll' errors but again following info in log:

2024-04-02 22:36:26.236 Hyundai: ERROR: unable to retrieve the value of user variable with IDX 454 <Response [404]> 2024-04-02 22:36:26.255 Hyundai: ERROR: unable to retrieve the value of user variable with IDX 455 <Response [404]>

454 is Hyundai - IONIQ EV verbruik 455 is Hyundai - IONIQ EV opwek

I also own a KIA, I will try to add the car tomorrow to see If same errors ocur.

CreasolTech commented 5 months ago

Hi @bbossink , this problem is related to the last feature introduced few days ago. @WillemD61 will investigate. Unfortunally I did not test this feature because the Hyundai/Kia cloud is not returning the "daily_stats" since few days, so the new devices you mentioned did not appear yet. About your Kia, if you have added its VIN to the same Hyundai/Kia account that you're using for Ioniq, you should automatically see both cars in the same plugin (one plugin, up to 4 cars). Please check on Setup -> Devices , filter by Hyundai plugin, and let me know if you can see both cars, or only Ioniq (with base address=192: normally, base address should be zero for the first car, 64 for the 2nd car, ....)

WillemD61 commented 5 months ago

O.K. I will investigate. From the error description it seems the first time the plugin runs and creates the new power devices it is also trying to add data to it and first checking the counters and that seems to fail. This will probably be hard to test if it happens only the first run but I will investigate.

bbossink commented 5 months ago

@WillemD61 that would be no problem. I have to add our KIA so that would be the first time ;-) And then again, if it's not working I delete the KIA hardware, delete all KIA entries in domoticz database and will try again after you changed some code.....

CreasolTech commented 5 months ago

Ok, now I also get the following errors (with a Kia eNiro):

2024-04-03 09:38:00.579  Error: GetJSonDevices: exception occurred : 'stoll'
2024-04-03 09:38:00.585  Kia: ERROR: unable to retrieve the value of user variable with IDX 2307 <Response [200]>
2024-04-03 09:38:00.605  Error: GetJSonDevices: exception occurred : 'stoll'
2024-04-03 09:38:00.611  Kia: ERROR: unable to retrieve the value of user variable with IDX 2308 <Response [200]>
2024-04-03 09:38:00.611  Kia: updateDevices() completed!

These are the daily stats returned by the clouds:

daily_stats=[DailyDrivingStats(date=datetime.datetime(2024, 4, 3, 0, 0), total_consumed=1078, engine_consum
ption=625, climate_consumption=353, onboard_electronics_consumption=100, battery_care_consumption=0, regenerated_energy=953, distance=7)

Hope this helps.... Thanks Willem.

WillemD61 commented 5 months ago

Thanks, I realised I have a second empty domoticz installation that I can use for testing. Expect solution latest tomorrow, maybe today.

WillemD61 commented 5 months ago

I was unable to replicate the error (sensor were created and updated without problems on clean domoticz installation) but nevertheless made some changes to possibly address the issue. I improved the error handling for the JSON query and also added some extra logging. Can you test?

By the way: it does require 127.0.0.1 to be in the trusted network list in the settings (or you have to add your own domoticz IP in the code on line 77)

CreasolTech commented 5 months ago

Errors disappear:

2024-04-03 18:10:04.390  Kia: OPEN=False
2024-04-03 18:10:04.412  Kia: TRUNK=False
2024-04-03 18:10:04.439  Kia: HOOD=False
2024-04-03 18:10:04.467  Kia: 12VBATT=66
2024-04-03 18:10:04.490  Kia: TIRES=False
2024-04-03 18:10:04.514  Kia: EVESTCHGDURATION=110
2024-04-03 18:10:04.542  Kia: EVTARGETCHGRANGE=440
2024-04-03 18:10:04.568  Kia: updateDevices() completed!

I'm waiting for Kia cloud sending the daily stats, because they are not always available. I'll let you know later. Thanks for now.

WillemD61 commented 5 months ago

I am getting daily stats each time, but data of today is only available after I have actually used my car. I tried the plugin both before and after usage of my car today, with a clean re-install in between. I can only test on Domoticz 2023.2 because my test environment is on a RPi zero (I would not expect an issue as result of later versions. I am using the latest JSON call.).

bbossink commented 5 months ago

on fresh install on Ubuntu 22.04 and domoticz 2024.4 with Hyundai IONIQ. Counter EVPWRREGENTOTAL gives UNDEFINED and counter VPWRCONSTOTAL is not created.

See log...

2024-04-03 21:47:27.230 Hyundai: 12VBATT=85 2024-04-03 21:47:27.232 Hyundai: TIRES=False 2024-04-03 21:47:27.234 Hyundai: EVPWRCONS90DAYS=419852 2024-04-03 21:47:27.236 Hyundai: EVESTCHGDURATION=90 2024-04-03 21:47:27.237 Hyundai: EVTARGETCHGRANGE=250 2024-04-03 21:47:27.238 Hyundai: EVPWRREGEN90DAYS=190205 2024-04-03 21:47:27.240 Hyundai: copying today's values 2024-04-03 21:47:27.240 Hyundai: today 2024-04-03 00:00:00 date 2024-04-03 00:00:00 2024-04-03 21:47:27.240 Hyundai: consumed 8564 2024-04-03 21:47:27.240 Hyundai: regenerated 4650 2024-04-03 21:47:27.242 Hyundai: ERROR: unable to retrieve the value of device with IDX 27 <Response [401]> 2024-04-03 21:47:27.242 Hyundai: Counter Check of device EVPWRCONSTOTAL failed. Postponing update till next time 2024-04-03 21:47:27.244 Hyundai: ERROR: unable to retrieve the value of device with IDX 28 <Response [401]> 2024-04-03 21:47:27.244 Hyundai: Counter Check of device EVPWRREGENTOTAL failed. Postponing update till next time 2024-04-03 21:47:27.244 Hyundai: updateDevices() completed!` 2024-04-03 21:52:20.431 Error: GetJSonDevices: exception occurred : 'stoll' 2024-04-03 21:52:20.431 Error: GetJSonDevices: exception occurred : 'stoll'

After restart domoticz, again crash: 2024-04-03 21:56:28.287 Status: Domoticz V2024.4 (c)2012-2024 GizMoCuz 2024-04-03 21:56:28.287 Status: Build Hash: 731719420, Date: 2024-01-30 09:16:34 2024-04-03 21:56:28.287 Status: Startup Path: /home/bbossink/domoticz/ 2024-04-03 21:56:28.290 Error: Default admin password has NOT been changed! Change it asap! 2024-04-03 21:56:28.291 Sunrise: 07:01:00 SunSet: 20:10:00 2024-04-03 21:56:28.291 Day length: 13:10:00 Sun at south: 13:36:00 2024-04-03 21:56:28.292 Civil twilight start: 06:26:00 Civil twilight end: 20:45:00 2024-04-03 21:56:28.292 Nautical twilight start: 05:43:00 Nautical twilight end: 21:28:00 2024-04-03 21:56:28.292 Astronomical twilight start: 04:57:00 Astronomical twilight end: 22:14:00 2024-04-03 21:56:28.305 Status: PluginSystem: Started, Python version '3.10.12', 2 plugin definitions loaded. 2024-04-03 21:56:28.306 Active notification Subsystems: (0/13) 2024-04-03 21:56:28.306 Status: WebServer(HTTP) started on address: :: with port 8080 2024-04-03 21:56:28.308 Status: WebServer(SSL) startup failed on address :: with port: 443: bind: Permission denied [system:13 at /usr/local/include/boost/asio/detail/reactive_socket_service.hpp:161 in function 'bind'], trying :: 2024-04-03 21:56:28.309 Status: WebServer(SSL) startup failed on address :: with port: 443: bind: Permission denied [system:13 at /usr/local/include/boost/asio/detail/reactive_socket_service.hpp:161 in function 'bind'], trying 0.0.0.0 2024-04-03 21:56:28.309 Error: WebServer(SSL) startup failed on address 0.0.0.0 with port: 443: bind: Permission denied [system:13 at /usr/local/include/boost/asio/detail/reactive_socket_service.hpp:161 in function 'bind'] 2024-04-03 21:56:28.309 Error: WebServer(SSL) check privileges for opening ports below 1024 2024-04-03 21:56:28.309 Starting shared server on: :::6144 2024-04-03 21:56:28.309 Status: TCPServer: shared server started... 2024-04-03 21:56:28.310 Status: RxQueue: queue worker started... 2024-04-03 21:56:30.311 Hyundai: Worker thread started. 2024-04-03 21:56:30.311 Status: Hyundai: Entering work loop. 2024-04-03 21:56:30.311 Status: Hyundai: Started. 2024-04-03 21:56:30.311 Status: NotificationSystem: thread started... 2024-04-03 21:56:30.311 Status: EventSystem: reset all events... 2024-04-03 21:56:30.311 Status: EventSystem: reset all device statuses... terminate called after throwing an instance of 'std::invalid_argument' what(): stoull 2024-04-03 21:56:30.319 Error: Domoticz(pid:571006, tid:571015('MainWorker')) received fatal signal 6 (Aborted) 2024-04-03 21:56:30.319 Error: siginfo address=0x3e80008b67e, address=0x7fa44b0829fc 2024-04-03 21:56:30.322 Error: Failed to start gdb, will use backtrace() for printing stack frame

2024-04-03 21:56:30.324 Error: #0 ./domoticz : + 0x4129d3 [0x55be2e8fb9d3] 2024-04-03 21:56:30.324 Error: #1 ./domoticz : signal_handler(int, siginfo_t, void) + 0x29d [0x55be2e8fc4bd] 2024-04-03 21:56:30.324 Error: #2 /lib/x86_64-linux-gnu/libc.so.6 : + 0x42520 [0x7fa44b02e520] 2024-04-03 21:56:30.324 Error: #3 /lib/x86_64-linux-gnu/libc.so.6 : pthread_kill + 0x12c [0x7fa44b0829fc] 2024-04-03 21:56:30.324 Error: #4 /lib/x86_64-linux-gnu/libc.so.6 : raise + 0x16 [0x7fa44b02e476] 2024-04-03 21:56:30.324 Error: #5 /lib/x86_64-linux-gnu/libc.so.6 : abort + 0xd3 [0x7fa44b0147f3] 2024-04-03 21:56:30.324 Error: #6 ./domoticz : + 0x303009 [0x55be2e7ec009] 2024-04-03 21:56:30.324 Error: #7 ./domoticz : cxxabiv1::terminate(void ()()) + 0x6 [0x55be2f050b96] 2024-04-03 21:56:30.324 Error: #8 ./domoticz : + 0xb67c01 [0x55be2f050c01] 2024-04-03 21:56:30.324 Error: #9 ./domoticz : + 0xb67d55 [0x55be2f050d55] 2024-04-03 21:56:30.324 Error: #10 ./domoticz : std::__throw_invalid_argument(char const) + 0x3d [0x55be2e7edadb] 2024-04-03 21:56:30.324 Error: #11 ./domoticz : + 0x355e74 [0x55be2e83ee74] 2024-04-03 21:56:30.324 Error: #12 ./domoticz : CEventSystem::GetCurrentStates() + 0xf00 [0x55be2e8636c0] 2024-04-03 21:56:30.324 Error: #13 ./domoticz : CEventSystem::StartEventSystem() + 0x110 [0x55be2e863c20] 2024-04-03 21:56:30.324 Error: #14 ./domoticz : MainWorker::Do_Work() + 0x43c [0x55be2e8c49dc] 2024-04-03 21:56:30.324 Error: #15 ./domoticz : + 0xbe1640 [0x55be2f0ca640] 2024-04-03 21:56:30.324 Error: #16 /lib/x86_64-linux-gnu/libc.so.6 : + 0x94ac3 [0x7fa44b080ac3] 2024-04-03 21:56:30.324 Error: #17 /lib/x86_64-linux-gnu/libc.so.6 : + 0x126850 [0x7fa44b112850]

Deleted domotcz.db and installed plugin again, after activating plugin filled two sensors with data again: http://192.168.1.100:8080/json.htm?type=command&param=udevice&idx=27&svalue=0 http://192.168.1.100:8080/json.htm?type=command&param=udevice&idx=28&svalue=0

Now after restart no crash and no errors. So, to solve the problem, the sensors need to be filled with data. Is it possible to add data 0 (zero) to the counters at creation? Then....will it be updated correctly once it is receiving the right data?

WillemD61 commented 5 months ago

Thanks for your feedback.

I uploaded a new version 1.1.6 in which the PWR sensors are initially loaded with a 0 value (not using a JSON call but using the Domoticz plugin environment).

I assume the JSON counter check will still not return any values on the first run, therefore I have added an additional check so the PWR device update with today's values is postponed till the second run.

Sorry for the hit and miss approach, but on my system no errors occurred. If this version 1.1.6 still has problems I will also switch to testing in Ubuntu.

bbossink commented 5 months ago

on fresh install on Ubuntu 22.04 and domoticz 2024.4 with Hyundai IONIQ configured it runs now with no problems and errors.

Log on first run:

2024-04-04 10:48:11.361 Hyundai: base=192 baseFree=0
2024-04-04 10:48:11.361 Hyundai: Add devices for car IONIQ with base index 192
2024-04-04 10:48:11.380 Hyundai: creating device EVPWRCONSTOTAL
2024-04-04 10:48:11.385 Hyundai: creating device EVPWRREGENTOTAL
2024-04-04 10:48:11.388 Hyundai: Car found at base 192
2024-04-04 10:48:11.393 Hyundai: EVBATTLEVEL=68
2024-04-04 10:48:11.395 Hyundai: EVRANGE=187.0
2024-04-04 10:48:11.397 Hyundai: EVLIMITAC=90
2024-04-04 10:48:11.399 Hyundai: EVLIMITDC=80
2024-04-04 10:48:11.401 Hyundai: ENGINEON=False
2024-04-04 10:48:11.402 Hyundai: ODOMETER=59556.6
2024-04-04 10:48:11.404 Hyundai: Latitude or Longitude have changed
2024-04-04 10:48:11.594 Hyundai: Location address: Somewhere
2024-04-04 10:48:11.604 Hyundai: Vehicle IONIQ has odometer=59556.6 speed=0 distance_from_home=0.0 EV battery=68%
2024-04-04 10:48:11.605 Hyundai: CLIMAON=False
2024-04-04 10:48:11.609 Hyundai: CLIMATEMP=15.0
2024-04-04 10:48:11.613 Hyundai: DEFROSTON=False
2024-04-04 10:48:11.618 Hyundai: REARWINDOWON=0
2024-04-04 10:48:11.623 Hyundai: STEERINGWHEELON=False
2024-04-04 10:48:11.627 Hyundai: OPEN=True
2024-04-04 10:48:11.630 Hyundai: TRUNK=False
2024-04-04 10:48:11.633 Hyundai: HOOD=False
2024-04-04 10:48:11.636 Hyundai: 12VBATT=85
2024-04-04 10:48:11.637 Hyundai: TIRES=False
2024-04-04 10:48:11.639 Hyundai: EVPWRCONS90DAYS=419852
2024-04-04 10:48:11.641 Hyundai: EVESTCHGDURATION=90
2024-04-04 10:48:11.642 Hyundai: EVTARGETCHGRANGE=250
2024-04-04 10:48:11.643 Hyundai: EVPWRREGEN90DAYS=190205
2024-04-04 10:48:11.645 Hyundai: Not updating new PWR devices on first run with today's values
2024-04-04 10:48:11.645 Hyundai: updateDevices() completed!

Log after restart domoticz:

2024-04-04 10:53:17.189 Hyundai: base=192 baseFree=0
2024-04-04 10:53:17.189 Hyundai: Add devices for car IONIQ with base index 192
2024-04-04 10:53:17.189 Hyundai: Car found at base 192
2024-04-04 10:53:17.198 Hyundai: EVBATTLEVEL=68
2024-04-04 10:53:17.202 Hyundai: EVRANGE=187.0
2024-04-04 10:53:17.206 Hyundai: EVLIMITAC=90
2024-04-04 10:53:17.210 Hyundai: EVLIMITDC=80
2024-04-04 10:53:17.215 Hyundai: ENGINEON=False
2024-04-04 10:53:17.218 Hyundai: ODOMETER=59556.6
2024-04-04 10:53:17.220 Hyundai: Latitude or Longitude have changed
2024-04-04 10:53:17.401 Hyundai: Location address: somewhere
2024-04-04 10:53:17.408 Hyundai: Vehicle IONIQ has odometer=59556.6 speed=0 distance_from_home=0.0 EV battery=68%
2024-04-04 10:53:17.408 Hyundai: CLIMAON=False
2024-04-04 10:53:17.412 Hyundai: CLIMATEMP=15.0
2024-04-04 10:53:17.415 Hyundai: DEFROSTON=False
2024-04-04 10:53:17.419 Hyundai: REARWINDOWON=0
2024-04-04 10:53:17.423 Hyundai: STEERINGWHEELON=False
2024-04-04 10:53:17.427 Hyundai: OPEN=True
2024-04-04 10:53:17.430 Hyundai: TRUNK=False
2024-04-04 10:53:17.432 Hyundai: HOOD=False
2024-04-04 10:53:17.434 Hyundai: 12VBATT=85
2024-04-04 10:53:17.436 Hyundai: TIRES=False
2024-04-04 10:53:17.439 Hyundai: EVPWRCONS90DAYS=419852
2024-04-04 10:53:17.440 Hyundai: EVESTCHGDURATION=90
2024-04-04 10:53:17.442 Hyundai: EVTARGETCHGRANGE=250
2024-04-04 10:53:17.444 Hyundai: EVPWRREGEN90DAYS=190205
2024-04-04 10:53:17.445 Hyundai: updateDevices() completed!

After adding KIA EV6 same result, no errors on a fresh installed domoticz installation. Log output KIA after install:

2024-04-04 10:57:52.932 KIA: base=192 baseFree=0
2024-04-04 10:57:52.932 KIA: Add devices for car EV6 with base index 192
2024-04-04 10:57:52.953 KIA: creating device EVPWRCONSTOTAL
2024-04-04 10:57:52.957 KIA: creating device EVPWRREGENTOTAL
2024-04-04 10:57:52.961 KIA: Car found at base 192
2024-04-04 10:57:52.965 KIA: EVBATTLEVEL=51
2024-04-04 10:57:52.967 KIA: EVRANGE=233.0
2024-04-04 10:57:52.969 KIA: EVLIMITAC=90
2024-04-04 10:57:52.971 KIA: EVLIMITDC=80
2024-04-04 10:57:52.972 KIA: ENGINEON=False
2024-04-04 10:57:52.974 KIA: ODOMETER=38912.0
2024-04-04 10:57:52.976 KIA: Latitude or Longitude have changed
2024-04-04 10:57:53.095 KIA: Location address: Somewhere
2024-04-04 10:57:53.101 KIA: Vehicle EV6 has odometer=38912.0 speed=0 distance_from_home=18.7 EV battery=51%
2024-04-04 10:57:53.101 KIA: CLIMAON=False
2024-04-04 10:57:53.104 KIA: CLIMATEMP=15.0
2024-04-04 10:57:53.107 KIA: DEFROSTON=False
2024-04-04 10:57:53.109 KIA: REARWINDOWON=0
2024-04-04 10:57:53.112 KIA: STEERINGWHEELON=False
2024-04-04 10:57:53.115 KIA: OPEN=True
2024-04-04 10:57:53.118 KIA: TRUNK=False
2024-04-04 10:57:53.121 KIA: HOOD=False
2024-04-04 10:57:53.124 KIA: 12VBATT=87
2024-04-04 10:57:53.125 KIA: KEYBATT=False
2024-04-04 10:57:53.127 KIA: WASHER=False
2024-04-04 10:57:53.129 KIA: BRAKE=False
2024-04-04 10:57:53.131 KIA: TIRES=False
2024-04-04 10:57:53.132 KIA: EVPWRCONS90DAYS=927573
2024-04-04 10:57:53.134 KIA: EVESTCHGDURATION=180
2024-04-04 10:57:53.135 KIA: EVTARGETCHGRANGE=425
2024-04-04 10:57:53.136 KIA: EVPWRREGEN90DAYS=255853
2024-04-04 10:57:53.138 KIA: Not updating new PWR devices on first run with today's values
2024-04-04 10:57:53.138 KIA: updateDevices() completed!

Log output after restart domoticz:

2024-04-04 11:01:00.743 KIA: base=192 baseFree=0
2024-04-04 11:01:00.743 KIA: Add devices for car EV6 with base index 192
2024-04-04 11:01:00.743 KIA: Car found at base 192
2024-04-04 11:01:00.752 KIA: EVBATTLEVEL=51
2024-04-04 11:01:00.756 KIA: EVRANGE=233.0
2024-04-04 11:01:00.759 KIA: EVLIMITAC=90
2024-04-04 11:01:00.764 KIA: EVLIMITDC=80
2024-04-04 11:01:00.768 KIA: ENGINEON=False
2024-04-04 11:01:00.772 KIA: ODOMETER=38912.0
2024-04-04 11:01:00.774 KIA: Latitude or Longitude have changed
2024-04-04 11:01:00.966 KIA: Location address: Somewhere
2024-04-04 11:01:00.975 KIA: Vehicle EV6 has odometer=38912.0 speed=0 distance_from_home=18.7 EV battery=51%
2024-04-04 11:01:00.975 KIA: CLIMAON=False
2024-04-04 11:01:00.979 KIA: CLIMATEMP=15.0
2024-04-04 11:01:00.983 KIA: DEFROSTON=False
2024-04-04 11:01:00.988 KIA: REARWINDOWON=0
2024-04-04 11:01:00.992 KIA: STEERINGWHEELON=False
2024-04-04 11:01:00.996 KIA: OPEN=True
2024-04-04 11:01:00.999 KIA: TRUNK=False
2024-04-04 11:01:01.001 KIA: HOOD=False
2024-04-04 11:01:01.003 KIA: 12VBATT=87
2024-04-04 11:01:01.005 KIA: KEYBATT=False
2024-04-04 11:01:01.007 KIA: WASHER=False
2024-04-04 11:01:01.009 KIA: BRAKE=False
2024-04-04 11:01:01.011 KIA: TIRES=False
2024-04-04 11:01:01.012 KIA: EVPWRCONS90DAYS=927573
2024-04-04 11:01:01.014 KIA: EVESTCHGDURATION=180
2024-04-04 11:01:01.015 KIA: EVTARGETCHGRANGE=425
2024-04-04 11:01:01.017 KIA: EVPWRREGEN90DAYS=255853
2024-04-04 11:01:01.018 KIA: copying today's values
2024-04-04 11:01:01.018 KIA: today 2024-04-04 00:00:00 date 2024-04-04 00:00:00
2024-04-04 11:01:01.018 KIA: consumed 4380
2024-04-04 11:01:01.018 KIA: regenerated 2378
2024-04-04 11:01:01.020 KIA: ERROR: unable to retrieve the value of device with IDX 58 <Response [401]>
2024-04-04 11:01:01.020 KIA: Counter Check of device EVPWRCONSTOTAL failed. Postponing update till next time
2024-04-04 11:01:01.021 KIA: ERROR: unable to retrieve the value of device with IDX 59 <Response [401]>
2024-04-04 11:01:01.021 KIA: Counter Check of device EVPWRREGENTOTAL failed. Postponing update till next time
2024-04-04 11:01:01.021 KIA: updateDevices() completed!
WillemD61 commented 5 months ago

I still see that the counter check failed on the EV6 after restart. Let's wait and see for the second run of the day to see if the devices are updated then. (you could also for ce a refresh with the "data updtae switch"). Do you see all devices created, specifically the 4 power devices?

bbossink commented 5 months ago

Also tested on running domoticz with Debian 11. After updating pluging I've added KIA EV6. No errors show up in the log. Also no fatal crahses anymore.

I still see that the counter check failed on the EV6 after restart. Let's wait and see for the second run of the day to see if the devices are updated then. (you could also for ce a refresh with the "data updtae switch").

2024-04-04 11:32:30.311 KIA: onCommand(Unit=203, Command=On, Level=0, Hue=)
2024-04-04 11:32:30.315 KIA: Force update command
2024-04-04 11:32:30.315 KIA: *** check_and_refresh_token()...
2024-04-04 11:32:30.315 KIA: *** check_and_force_update_vehicles(30)...
2024-04-04 11:32:40.841 KIA: regenerated 2378
2024-04-04 11:32:40.843 KIA: ERROR: unable to retrieve the value of device with IDX 58 <Response [401]>
2024-04-04 11:32:40.843 KIA: Counter Check of device EVPWRCONSTOTAL failed. Postponing update till next time
2024-04-04 11:32:40.844 KIA: ERROR: unable to retrieve the value of device with IDX 59 <Response [401]>
2024-04-04 11:32:40.844 KIA: Counter Check of device EVPWRREGENTOTAL failed. Postponing update till next time
2024-04-04 11:32:40.844 KIA: updateDevices() completed!

Maybe I've to drive first? I'll check later today/tomorrow...

Do you see all devices created, specifically the 4 power devices?

All devices are created now....see screenshots for 4 power devices I think?....

image

and for IONIQ:

image

WillemD61 commented 5 months ago

the 401 response code means unauthorised apparently. Do you have 127.0.0.1 in your trusted network settings? What if your run http://domoticzIP:domoticzPort/json.htm?type=command&param=getdevices&rid=58 from your browser.

bbossink commented 5 months ago

the 401 response code means unauthorised apparently. Do you have 127.0.0.1 in your trusted network settings?

No,did not thought of that, was a fresh test install. Now I added 127.0.0. and 192.168.0. to trusted networks. And after restart:

2024-04-04 12:24:18.849 KIA: 12VBATT=87
2024-04-04 12:24:18.851 KIA: KEYBATT=False
2024-04-04 12:24:18.853 KIA: WASHER=False
2024-04-04 12:24:18.854 KIA: BRAKE=False
2024-04-04 12:24:18.856 KIA: TIRES=False
2024-04-04 12:24:18.858 KIA: EVPWRCONS90DAYS=927573
2024-04-04 12:24:18.859 KIA: EVESTCHGDURATION=180
2024-04-04 12:24:18.860 KIA: EVTARGETCHGRANGE=425
2024-04-04 12:24:18.862 KIA: EVPWRREGEN90DAYS=255853
2024-04-04 12:24:18.863 KIA: copying today's values
2024-04-04 12:24:18.863 KIA: today 2024-04-04 00:00:00 date 2024-04-04 00:00:00
2024-04-04 12:24:18.863 KIA: consumed 4380
2024-04-04 12:24:18.863 KIA: regenerated 2378
2024-04-04 12:24:18.866 KIA: PwrConsumed Counter 0 counterToday 0 daily stat 4380 Increment 4380
2024-04-04 12:24:18.869 KIA: PwrRegenerated Counter 0 counterToday 0 daily stat 2378 Increment 2378
2024-04-04 12:24:18.870 KIA: updateDevices() completed!
2024-04-04 12:24:18.865 Status: [web:8080] Incoming connection from: 127.0.0.1
2024-04-04 12:24:26.226 Hyundai: Name=IONIQ Odometer=59556.6km Battery=0

That did it :-)