Closed nickcampbell18 closed 1 month ago
Please enable Debug and send some logs
I'm having this error also
It seems random the time it takes since restart the addon until the error happens.
I've activated the debug, as soon as it happens again and I have more info, I'll post it here
FYI, My car is also a Volvo EX30
I also had this issue last week. But it seems that I get this when the car is charging. Also a Volvo EX30. When the car is not charging the addon is running fine.
Nice find @killabeenl!
I see this in my debug logs right before the crash:
volvo2mqtt | }
volvo2mqtt | Sep 16 14:37:32 volvo2mqtt [1] - DEBUG: Entity battery_charge_level state 39.5
volvo2mqtt | Traceback (most recent call last):
volvo2mqtt | File "/volvoAAOS2mqtt/./main.py", line 16, in <module>
volvo2mqtt | update_loop()
volvo2mqtt | File "/volvoAAOS2mqtt/mqtt.py", line 295, in update_loop
volvo2mqtt | update_car_data()
volvo2mqtt | File "/volvoAAOS2mqtt/mqtt.py", line 361, in update_car_data
volvo2mqtt | update_ha_device(entity, vin, state)
volvo2mqtt | File "/volvoAAOS2mqtt/mqtt.py", line 381, in update_ha_device
volvo2mqtt | logging.debug("Updating icon to " + icon + " for " + entity["id"])
volvo2mqtt | TypeError: can only concatenate str (not "NoneType") to str
Found it. get_icon_between
can return None
because these boundaries are not exclusive:
>>> get_icon_between(icon_states["battery_charge_level"], 39)
'battery-30'
>>> get_icon_between(icon_states["battery_charge_level"], 39.5)
>>> get_icon_between(icon_states["battery_charge_level"], 40)
'battery-40'
@Dielee would you like me to send a PR?
Fixed with V1.9.7
Describe the bug
I'm seeing this in the logs when starting:
It doesn't seem to be fatal since events are still being emitted over MQTT. Maybe there needs to be a null check somewhere?
Also, this event is being emitted twice, I'm wondering if there should be a mutex or something around the update loop to prevent it running in parallel.
My car is an EX30, if that helps!