-
-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
elkm1 unable to serialize to JSON for climate entities #72981
Comments
elkm1 documentation |
Hey there @gwww, @bdraco, mind taking a look at this issue as it has been labeled with an integration ( |
Could you turn on debug and provide the log. I’ll take a look at the code in the meantime. Logging instructions here: https://community.home-assistant.io/t/elk-m1-interface/4461/983 |
This is the debug log of the elkm1 entries: |
Less filtering to include the actual error. |
Thx for the logs. I don't see the problem in the code by just looking. I don't have time today to setup a dev environment to reproduce this. It will be Sunday/Monday before I can take a deeper look. I'm not sure where the |
The json serializer needs actual str objects as it doesn't know how to serialize enums. Converting them to strings in the asdict function will fix it |
I’m not getting it. Where’s the asdict needed? |
I sent you a PM on discord |
I've noticed this same issue; if additional logs are helpful, let me know. I also have a thermostat device connected to my Elk alarm system. I have a non-production Home Assistant instance running that I can experiment with if that'd be useful. |
Just a "me too." I reverted back to 5.6, but am happy to upgrade once again and help if I can. |
We need to stringify the enums here https://github.com/gwww/elkm1/blob/main/elkm1_lib/elements.py#L92 since the json serializer can't convert the Enum type to a string on its own |
I’ll submit the fix tomorrow or Monday. Not at my computer right now. |
FWIW. On my test Home Assistant instance, I just smashed this change in and the smoke-test passes and climate entity shows up. I don't know if converting both the key and value to strings are necessary..
I've not tried any more extensive testing than restarting Home Assistant and seeing the entity appear and the previous two errors related not show in the log. @gwww, have a great weekend! |
The problem
After the upgrade to 2022.6.0 by climate entities are no longer working:
The following error for both of my climate areas:
140477941995216] Unable to serialize to JSON. Bad data found at$.event.a.climate.lower_floor.a.mode=ThermostatMode.HEAT(<enum ‘ThermostatMode’>, $ .event.a.climate.lower_floor.a.fan=ThermostatFan.AUTO(<enum ‘ThermostatFan’>, $.event.a.climate.upper_floor.a.mode=ThermostatMode.HEAT(<enum ‘ThermostatMode’>, $ .event.a.climate.upper_floor.a.fan=ThermostatFan.AUTO(<enum ‘ThermostatFan’>
And warning in the log as follow:
'* State is not JSON serializable: <state climate.upper_floor=heat; hvac_modes=[<HVACMode.OFF: ‘off’>, <HVACMode.HEAT: ‘heat’>, <HVACMode.COOL: ‘cool’>, <HVACMode.HEAT_COOL: ‘heat_cool’>, <HVACMode.FAN_ONLY: ‘fan_only’>], min_temp=1, max_temp=99, target_temp_step=1, fan_modes=[‘auto’, ‘on’], current_temperature=74, target_temp_high=76, target_temp_low=70, current_humidity=0, fan_mode=on, aux_heat=off, name=Upper floor, mode=ThermostatMode.HEAT, hold=False, fan=ThermostatFan.ON, current_temp=74, heat_setpoint=70, cool_setpoint=76, humidity=0, index=2, friendly_name=Upper floor, supported_features=74 @ 2022-06-01T22:24:29.920081-07:00>: Object of type ThermostatMode is not JSON serializable
What version of Home Assistant Core has the issue?
2022.6.0
What was the last working version of Home Assistant Core?
2022.5.5
What type of installation are you running?
Home Assistant Core
Integration causing the issue
elkm1
Link to integration documentation on our website
https://www.home-assistant.io/integrations/elkm1
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: