Closed sca075 closed 2 months ago
from this log it looks the Camera is constantly receiving bytes, the payload should be already decoded in HA but as per we subscribed those payloads.. It looks we are converting the data for HA, sometimes MQTT try to do it earlier. for this reason will run with Payload has type: <class ***X***'>
in order to understand whenever is possible the camera is resposible for this. MQTT explorer has an embedded decoding function thee the values from the vacuums are always reported correctly.
2024-07-24 21:04:35.726 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Received roborock_downstairs image data from MQTT
2024-07-24 21:04:35.728 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.729 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Segments: {'16': 'Living Room', '17': 'Kitchen', '18': 'Bath Room', '19': 'Entrance', '20': 'Bedroom'}
2024-07-24 21:04:35.731 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.731 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] roborock_downstairs: Received vacuum docked status.
2024-07-24 21:04:35.732 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.732 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] valetudo/roborock_downstairs: Received vacuum Error: No error
2024-07-24 21:04:35.734 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.734 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] valetudo/roborock_downstairs: Received vacuum connection status: ready.
2024-07-24 21:04:35.736 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.736 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] roborock_downstairs: Received vacuum battery level: 100%.
2024-07-24 21:04:35.749 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Received silenttepidstinkbug image data from MQTT
2024-07-24 21:04:35.750 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.750 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Segments: {}
2024-07-24 21:04:35.755 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.755 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] silenttepidstinkbug: Received vacuum docked status.
2024-07-24 21:04:35.762 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.762 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] valetudo/SilentTepidStinkbug: Received vacuum Error: No error
2024-07-24 21:04:35.762 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.763 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] valetudo/SilentTepidStinkbug: Received vacuum connection status: ready.
2024-07-24 21:04:35.766 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:04:35.767 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] silenttepidstinkbug: Received vacuum battery level: 100%.
An this is what happened few minutes later, this is why I opened this issue.
2024-07-24 21:12:49.225 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 21:12:49.225 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Segments: {}
2024-07-24 21:12:49.226 WARNING (MainThread) [homeassistant.components.mqtt.mixins] Erroneous JSON: b'{}'
Okay.. this is confirming that the problem isn't in the Camera, the Vacuum constantly send binary data, we did convert the data correctly, MQTT in any case "MQTT.sensor" is not able to decode the value => the Camera isn't influencing either MQTT or the Vacuum.
2024-07-24 22:08:39.131 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Payload has type: <class 'bytes'>
2024-07-24 22:08:39.132 DEBUG (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] Decoded payload is a string, integer or float
2024-07-24 22:08:39.132 INFO (MainThread) [custom_components.mqtt_vacuum_camera.valetudo.MQTT.connector] roborock_downstairs: Received vacuum battery level: 97%.
2024-07-24 22:08:39.132 WARNING (MainThread) [homeassistant.components.mqtt.sensor] Invalid undecoded state message 'b'97'' received from 'valetudo/roborock_downstairs/BatteryStateAttribute/level'
Changed the method how we subscribe the topics, using the DEFAULT_ENCODING of Home Assistant. Changed also the subscribe method to use Set's instead of lists.
Checklist
The problem
There was an issue reported also on Home Assistant https://github.com/home-assistant/core/issues/118629. After a fare research the issue apparently is generated from the camera. As we decoded msg.payload automatically python memory pointer would overwrite the received payload in HA MQTT.
What version of an integration has described problem?
2024.07.4
What was the last working version of an integration?
not specified
What vacuum model do you have problems with?
Roborock.S5
Please firmware installed on your Vacuum.
2024.06.0
What type of platform you use?
Intel NUC (or generic x86_64)
What version of Home Assistant do you use?
2024.7.3
What type of installation are you running?
Home Assistant OS
Logs or Errors shown in the HA snapshots (please enable the Debug Mode) text will be auto formatted to code.
No response
Function, that in your opinion is creating the issue.
Not sure / none of the above.
Additional information
We are going to change the connector.py async_decode_mqtt_payload so that we will create a new memory pointer for python in "my_payload" then decode eventually my_payload and also as safe guard convert the data to string and then to integer if necessary.