frigate-hass-integration: Adding debug: true to Home Assistant 2024.5.0b0 generates Exception in _state_message_received errors
Version of the custom_component
5.1.0
Configuration
Logger: homeassistant.util.logging
Source: util/logging.py:98
First occurred: 6:45:40 AM (10 occurrences)
Last logged: 6:45:41 AM
Exception in _state_message_received when handling msg on 'frigate/camera/recordings/state': 'ON' Traceback (most recent call last): File "/config/custom_components/frigate/camera.py", line 241, in _state_message_received self._attr_is_recording = msg.payload.decode("utf-8") == "ON" ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Exception in _motion_message_received when handling msg on 'frigate/camera_2/motion/state': 'ON' Traceback (most recent call last): File "/config/custom_components/frigate/camera.py", line 247, in _motion_message_received self._attr_motion_detection_enabled = msg.payload.decode("utf-8") == "ON" ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Exception in _state_message_received when handling msg on 'frigate/camera_2/recordings/state': 'ON' Traceback (most recent call last): File "/config/custom_components/frigate/camera.py", line 241, in _state_message_received self._attr_is_recording = msg.payload.decode("utf-8") == "ON" ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Exception in _motion_message_received when handling msg on 'frigate/g_camera/motion/state': 'ON' Traceback (most recent call last): File "/config/custom_components/frigate/camera.py", line 247, in _motion_message_received self._attr_motion_detection_enabled = msg.payload.decode("utf-8") == "ON" ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Exception in _state_message_received when handling msg on 'frigate/g_camera/recordings/state': 'ON' Traceback (most recent call last): File "/config/custom_components/frigate/camera.py", line 241, in _state_message_received self._attr_is_recording = msg.payload.decode("utf-8") == "ON" ^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?
Describe the bug
Changing line 247 and 241 from decode to encode fixes the error but I have no idea if this is the right path
Debug log
Add your logs here.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 5
- Comments: 41
New release: https://github.com/blakeblackshear/frigate-hass-integration/releases/tag/v5.2.0
Confirming 5.2.0 working as expected, and many thanks for the prompt fix. (thumbs-up + party emoticons)
The fix PR is merged. I’ll do a
v5.2.0release tomorrow.Prior to the “fix”, the backend would report ‘ON’ but the integration would interpret it as ‘OFF’. That causes the HA state to appear to be out of sync. Here’s how it looks now:
It’s a little hard to see without the mouse cursor, but:
Some progress: The recordings state data is being received as
b'ON'notON, yet the comparison to determine the state in the integration is just againstONIf we decode the string first, the recordings switch starts to work correctly. There’s a similar issue in reverse incamera.pywhich explains the exceptions shown at the start of this issue.I think motion might be a subtly different problem / race condition, still looking…
I suspect there might be multiple unrelated reports mixed here. I cannot get any exceptions thrown no matter what I do, with or without
debug: true.However, I can definitely see the switch state behavior problem with
recordingsandmotiononly. In this image, I turn all 4 entities on and 2 of them immediately reset:Versions:
5.1.0/0.13.2-6476f8a2024.5.1I have the same issue with the “Motion” boolean. I can confirm the other booleans (Detect, Recordings, Snapshot) work correct after the v5.2 update .
Thank you for your support and attention to this. Much appreciated!
YMMV on this but I rolled back to 2024.4.4 without any issues. Everything is back to working as expected.