Closed markruys closed 8 months ago
When I deleted the integration, restart HA, installed the integration again, I got a similar crash:
2023-11-17 21:30:22.296 INFO (MainThread) [homeassistant.setup] Setting up kia_uvo
2023-11-17 21:30:22.296 INFO (MainThread) [homeassistant.setup] Setup of domain kia_uvo took 0.0 seconds
2023-11-17 21:30:26.078 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.kia_uvo
2023-11-17 21:30:26.080 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.kia_uvo
2023-11-17 21:30:26.081 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.kia_uvo
2023-11-17 21:30:26.082 INFO (MainThread) [homeassistant.components.lock] Setting up lock.kia_uvo
2023-11-17 21:30:26.083 INFO (MainThread) [homeassistant.components.number] Setting up number.kia_uvo
2023-11-17 21:30:26.086 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_engine
2023-11-17 21:30:26.086 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_defrost
2023-11-17 21:30:26.087 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_steering_wheel_heater
2023-11-17 21:30:26.087 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_back_window_heater
2023-11-17 21:30:26.088 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_front_left_door
2023-11-17 21:30:26.088 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_front_right_door
2023-11-17 21:30:26.089 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_back_left_door
2023-11-17 21:30:26.089 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_back_right_door
2023-11-17 21:30:26.090 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_trunk
2023-11-17 21:30:26.090 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_hood
2023-11-17 21:30:26.092 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_front_left_window
2023-11-17 21:30:26.092 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_front_right_window
2023-11-17 21:30:26.092 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_back_left_window
2023-11-17 21:30:26.093 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_back_right_window
2023-11-17 21:30:26.093 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_ev_battery_charge
2023-11-17 21:30:26.093 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_ev_battery_plug
2023-11-17 21:30:26.094 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_smart_key_battery_warning
2023-11-17 21:30:26.094 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_washer_fluid_warning
2023-11-17 21:30:26.094 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_tire_pressure_all
2023-11-17 21:30:26.095 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_tire_pressure_rear_left
2023-11-17 21:30:26.095 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_tire_pressure_front_left
2023-11-17 21:30:26.096 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_tire_pressure_front_right
2023-11-17 21:30:26.096 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_tire_pressure_rear_right
2023-11-17 21:30:26.097 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_air_conditioner
2023-11-17 21:30:26.098 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_ev_charge_port
2023-11-17 21:30:26.098 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_ev_first_scheduled_departure
2023-11-17 21:30:26.098 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_ev_second_scheduled_departure
2023-11-17 21:30:26.099 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new binary_sensor.kia_uvo entity: binary_sensor.ev6_groen_brake_fluid_warning
2023-11-17 21:30:26.099 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_total_driving_range
2023-11-17 21:30:26.100 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_odometer
2023-11-17 21:30:26.100 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_car_battery_level
2023-11-17 21:30:26.100 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_last_updated_at
2023-11-17 21:30:26.101 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_battery_level
2023-11-17 21:30:26.101 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_range
2023-11-17 21:30:26.102 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_set_temperature
2023-11-17 21:30:26.102 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_estimated_charge_duration
2023-11-17 21:30:26.102 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_estimated_fast_charge_duration
2023-11-17 21:30:26.104 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_estimated_portable_charge_duration
2023-11-17 21:30:26.105 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_estimated_station_charge_duration
2023-11-17 21:30:26.105 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_target_range_of_charge_ac
2023-11-17 21:30:26.105 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_target_range_of_charge_dc
2023-11-17 21:30:26.106 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_total_energy_consumption
2023-11-17 21:30:26.106 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_total_energy_regeneration
2023-11-17 21:30:26.107 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_average_energy_consumption
2023-11-17 21:30:26.107 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_first_scheduled_departure_time
2023-11-17 21:30:26.107 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_second_scheduled_departure_time
2023-11-17 21:30:26.108 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_off_peak_start_time
2023-11-17 21:30:26.108 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_ev_off_peak_end_time
2023-11-17 21:30:26.108 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_daily_driving_stats
2023-11-17 21:30:26.109 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new sensor.kia_uvo entity: sensor.ev6_groen_data
2023-11-17 21:30:26.114 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new device_tracker.kia_uvo entity: device_tracker.ev6_groen_location
2023-11-17 21:30:26.115 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new lock.kia_uvo entity: lock.ev6_groen_door_lock
2023-11-17 21:30:26.116 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new number.kia_uvo entity: number.ev6_groen_ac_charging_limit
2023-11-17 21:30:26.116 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new number.kia_uvo entity: number.ev6_groen_dc_charging_limit
2023-11-17 21:30:27.159 ERROR (influxdb) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/usr/src/homeassistant/homeassistant/components/influxdb/__init__.py", line 595, in run
self.write_to_influxdb(json)
File "/usr/src/homeassistant/homeassistant/components/influxdb/__init__.py", line 571, in write_to_influxdb
self.influx.write(json)
File "/usr/src/homeassistant/homeassistant/components/influxdb/__init__.py", line 364, in write_v2
write_api.write(**data)
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 363, in write
self._serialize(record, write_precision, payloads, **kwargs)
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 440, in _serialize
self._serialize(item, write_precision, payload, **kwargs)
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 428, in _serialize
self._serialize(Point.from_dict(record, write_precision=write_precision, **kwargs),
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write_api.py", line 425, in _serialize
self._serialize(record.to_line_protocol(), record.write_precision, payload, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write/point.py", line 186, in to_line_protocol
_fields = _append_fields(self._fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/influxdb_client/client/write/point.py", line 217, in _append_fields
for field, value in sorted(iteritems(fields)):
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<' not supported between instances of 'datetime.date' and 'str'
If I create a new (empty) bucket in InfluxDB and restart HA, I get the same error.
Bug has been introduced in commit d84d595992337f2561480e52bd673ea8dc474578:
key = day.date.date()
value = {
"total_consumed": day.total_consumed,
"engine_consumption": day.engine_consumption,
"climate_consumption": day.climate_consumption,
"onboard_electronics_consumption": day.onboard_electronics_consumption,
"battery_care_consumption": day.battery_care_consumption,
"regenerated_energy": day.regenerated_energy,
"distance": day.distance,
}
m[key] = value
key
must be a string.
Reverted back to v2.15 and the integration works again.
@Triple-S thoughts?
@Triple-S thoughts?
Is there any official requirement by Home Asisstant that attribute keys can only be Strings?
I did not find anything, so I guessed that any comparable python type would be allowed and besides the InfluxDB integration everything works perfectly fine.
I think this is actually a bug in the InfluxDB integration which is handling non-String-type keys wrong, probably because the developers were not thinking of this rather special case.
As a workaround one could convert the date to its default string representation with .strftime("%Y-%m-%d)
but I think long-term this bug should be fixed in the InfluxDB integration by accounting for non-String-type attribute keys properly.
I am facing the same issue with Hyundai / Kia Connect integration getting the same error message described by markruys. I have downgraded the integration to version 2.14.3 and now influxdb works without the error message
@cdnninja What is your opinion on this issue? Do you want to have this woraround I mentioned implemented to overcome the limitation of InfluxDB or do you want to leave everything as it is and have this limitation fixed by the developers of InfluxDB?
my point of view is two fold here;
@fuatakgun I think the downsides of changing the datatype to a string are minimal. I tried to avoid using a string because converting a date to a string depends on where you live - e.g. in Europe "dd.mm.yyyy" is quite common whil amaricans often use "mm/dd/yyyy" (Which I never understood). In my case Python automatically converts the date to "yyyy-mm-dd" when no other format is specified, so I would suggest to use this Python-Standard.
Thanks, from HA perspective, integration is aware of user's preferred date format, we can directly consume it, if it is ok for you too.
Thanks, from HA perspective, integration is aware of user's preferred date format, we can directly consume it, if it is ok for you too.
I would prefer not to use the user's preferred date format for that purpose, because that could cause incosistencies in the stored data if the user at some point changes his opinion concerning the date format. Furthermore, templates consuming the data from this sensor would depend on the user settings and not be universal.
works for me, then let's stick to yyyy-mm-dd which is also a nice comparable in case if user wants to compare them.
can you pick this up or you want me?
thanks a lot @Triple-S
Work around works for me, thank you guys!
Had the same issue and the workaround works for me as well. Just one question: is it just available in master or already in any of the 2.16.x releases? Thank you so much :-)
Thank you @markruys, just updated. Works! 😊
Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/kia_uvo/blob/master/README.md
Version of the integration 2.16.0
Describe the bug When the Hyundai / Kia Connect integration gets started it crashes the InfluxDB thread.
Debug logs if an error occurred
To Reproduce Disable the integration, restart Home Assistant, enable the integration
Additional context I'm using InfluxDB 2.7.4 and the latest stable HA.