sca075 / mqtt_vacuum_camera

Camera Integration for Home Assistant to export and render all Vacuums connected via MQTT( including Valetudo Hypfer and RE(rand256)) Maps.
Apache License 2.0
106 stars 7 forks source link

camera entity does not show image and it seems it does not pick up the mqtt message when mqtt connection is used with user homeassistant #21

Closed NODeeJay closed 1 year ago

NODeeJay commented 1 year ago

Checklist

The problem

I tried to get the valetudo map displayed in the Xiaomi add-on from Piotr. I followed the instructions and installed both add-ons. I configured the camera with my MQTT provider, but it seems not to create an image at all.

I enabled debug logging and see the addon connecting to MQTT and subscribe to the correct topic: 2023-08-25 22:20:55.594 DEBUG (Thread-107 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi

but when the image comes: image

2023-08-25 22:20:58.709 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on valetudo/Robi/MapData/map-data-hass (qos=0): b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x02\xd0\x00\x00\x01\xe0\x08\x02\x00\x00\x00\x03\xa7\xcd\xfb\x00\x00\\6IDATx\xda\xed\xbd\xd9o\x1dU\xda\xb7\xdd\xff@\x9fr\xc4\x11\x07}\xc0\x01\x07HHH-\xa4\x16R\x0b!\x84\x10\x1fM?

[...]

cc$)\xcf\x99\x06\x851\x1c\xae@7\xd9p9\xeb\x89\x08\xf2\xba\xf94J\xb0\xf0\xff\xbb.\xec\xecN9l\xc2\xee\x04\xf6z\x9d\xb87\xec\x15\xa5\xcd\xf4\xc1\x86\x08\xdf\xfc?\x9b"\xf4\xa0\xf8\xe9\xf2\x8d\xc4J\xf3/_c8\x8a\x88;\xad\xbemqs\xaa\x9dk\x1e\xbe\xd9\xe9\xdd\xdd\xadge~\xbb\\\x8f\x94\x9b\rY\xe5\x8c\xea!5\xb7\xd8\x17\xf17\xbf\xed\xd2a\xb5\xa6,\xd7=\rf\x9c\x83\xa6\x96\x07\t\x08\x7f\xa4\x19\xb9R~\xe3\xaew\xce\xfa\xfd\x1e\xbf\x1ds\x90>\x9b\xdbq\xd5p]]zr\xc0\x87\xd3=\xc2Htu\xeb\xb5\x0f\xbfl\xd4\xdf9o\x93^\xf0y\xadN\x0f\x8f\xba\x16R\x9a\xcb\x8f\xef\xdc\xd5W\x9f\xb4L-\xde\xaa\xeb63\x98\xbad\x88\xf9\xcd'

it does not seem to get further processed by the component, at least I am missing _LOGGER.debug("Received " + self._mqtt_topic + " image data from MQTT") which I found in the connector. Also the snapshot directory in the customer_component folder is empty.

In custom:valetudo-map-card the image works fine, which is also saved from the mqtt message.

Can I somehow increase the logging even more? Any idea how to troubleshoot that? Is it because it's an S5 Max? But shouldn't Valetudo provide the map in valetudo form/as PNG?

What version of an integration has described problem?

1.3.4

What was the last working version of an integration?

No response

What vacuum model do you have problems with?

Roborock.S5Max

Please firmware installed on your Vacuum.

2023.08.0

What version of Home Assistant do you use?

2023.8.4

What type of installation are you running?

Home Assistant OS

Camera's configuration

N/A

Logs or Errors shown in the HA snapshots (please enable the Debug Mode)

see above

Additional information

I noticed the component re-registers sporadically several times within a minute a couple of times quickly after each other (~5 - 20 seconds) I get [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi but there is no connection closure _LOGGER.debug(self._mqtt_topic + ": Stopped and disconnected from MQTT broker.") before, as when I disable the configured camera and re-enable it.

sca075 commented 1 year ago

@NODeeJay thanks for the report, do you use the MQTT_add on of Home Assistant or MQTT is on another machine? If during the setup of the camera you configured the Broker Host Name this your config there must be external MQTT machine IP or Host Name, by default the camera point to the HA Broker ADD on host name that is "core-mosquitto". It would be appreciated the the full log you got to better understand what is going on. We did confirm that the Json is correctly grabbed and as per you are in HA OS I guess you run under docker and you use the HA Broker Addon, is that correct? Additionally, I guess later today will release a fix for the rooms configurations. I can add some additional log entry of course to trouble shoot your reported issue. Sorry for the inconvenience so far... I guess on your kind understanding this add on is growing up, and there are several different install way of HA (and way to setup the broker), we are working also on a method to simplify the MQTT client setup and automate it so that this kind of inconveniences would not happen in the future (generically it works but as you experienced can be a little technical to install it). Thanks in advance for your kind help and consideration.

NODeeJay commented 1 year ago

@NODeeJay thanks for the report, do you use the MQTT_add on of Home Assistant or MQTT is on another machine?

I configured core-mosquitto, I use the internal standard MQTT, no fancy new version or external broker running somewhere. image

I played a bit further around, using the connection with SSL core-mosquitto:8883 or the hostname I use from the robot, with or without port and SSL. It seems that the port is not processed at all but I did not check it in the code. Also with SSL it seems not to connect at all to the broker. The FQDN or core-mosquitto as host did not make any difference, I see the client connection in the MQTT broker log, which corresponds to the log entry from the component.

I am still wondering why there are so many reconnects in a short time?

2023-08-26 14:10:55.366 DEBUG (Thread-1538 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi
2023-08-26 14:10:56.370 DEBUG (Thread-1538 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi
2023-08-26 14:10:58.375 DEBUG (Thread-1538 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi
2023-08-26 14:11:00.638 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:05
2023-08-26 14:11:00.648 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.hplj2055dn_printer_status_code is taking over 10 seconds
2023-08-26 14:11:00.653 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.hplj2055dn_printer_error_code is taking over 10 seconds
2023-08-26 14:11:02.379 DEBUG (Thread-1538 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi
2023-08-26 14:11:05.638 WARNING (MainThread) [homeassistant.components.sensor] Updating snmp sensor took longer than the scheduled update interval 0:00:05
2023-08-26 14:11:10.383 DEBUG (Thread-1538 (_thread_main)) [custom_components.valetudo_vacuum_camera.valetudo.connector] Subscribed to MQTT broker with topic: valetudo/Robi

Which full log do you mean?

From what I understand, the newly created entity camera.robi_camera should show me the map rotated as per configuration?

No worries, you started a great piece of work and am very happy to try it and get it running. Thank you for your support!

sca075 commented 1 year ago

Probably I know what is the issue.. the user name and password you need to use are the same one you use to connect the vacuum to MQTT. the user name homeassistant is reserved to home assistant so the client can't connect your MQTT broker for this reason:

Just let me if this is the way you already use or what is the result after using those credentials. If I'm correct you followed to the letter the instructions, this would means I will need to update the documentation instead of the integration :) Thanks once again for time, regards.

NODeeJay commented 1 year ago

Right you are that is the issue. I used the same credentials as for the robi and it worked immediately. Strange, that I have other addons and integrations that connect fine with the homeassistant user.

Thank you for your help, the card is streaming fine into Piotrs card :-)

sca075 commented 1 year ago

It is currently a work in progress soon it will be not required thanks to @rohankapoorcom