cmroche / OctoPrint-HomeAssistant

Home Assistant plugin for OctoPrint, enabling MQTT discovery of you device and sensors
110 stars 18 forks source link

only one instance at a time #48

Closed NinDTendo closed 3 years ago

NinDTendo commented 3 years ago

Might be related to #29

I am trying to get my 2 instances of Octoprint recognized by HA. Both instances have a different base topic and I made sure that the Node ID is unique per instance/printer.

The payloads (in HA "MQTT Info) confirm that the unique_id and state_topic are unique as well. Only the "connections:" part is identical.

I do manage to connect both, but not at the same time. Additionally the printers are not recognized as individual devices, which I would prefer to have for better organizing.

Unfortunately I have no idea how to print logs, since I'm not that familiar with linux commands. But can provide if someone sends me the commands for it.

I have tried the solution provided in #29 already with no success. (restarted HA, and both instances- individually and together)

cmroche commented 3 years ago

Could you paste the payloads please, and what do you mean by the "connections: part"?

Thanks.

NinDTendo commented 3 years ago

image image

This is what I mean by "connection:" image

somehow, just now both instances got recognized, but still only as one device in HA

cmroche commented 3 years ago

Hmmm, maybe the connections is causing an issue. Though I would expect this to lead to 1 devices, but with sensor duplicated for each instance. Can you show me the list of sensors you have under the working device?

Edit: On second thought I'm not so sure this is the problem... unique identifiers for each device still.

NinDTendo commented 3 years ago

It's somewhat of a hit and miss... just earlier all sensors got recognized and worked parallel, after a reboot only 1 instance is working correctly. But as u pointed out in your edit too, I would expect two different devices (which is not the case). Currently only the 2nd instance got recognized, I will post the list of sensors later if the first instance ever gets recognized again.

For now at least now the 2nd sensor (alone) is working fine. image

NinDTendo commented 3 years ago

on a sidenote, I think u need to change the camera platform to mjpeg instead of generic in the readme

camera:
  - platform: mjpeg
    name: OctoPrint Ender 3
    still_image_url: http://octoprint.local/webcam/?action=snapshot
    stream_source: http://octoprint.local/webcam/?action=stream
cmroche commented 3 years ago

You have two separate devices registered, so it looks like the config is good, and they do work sometime so the data is getting to the right topics.

Have you checked the MQTT topics for both printer to see what is being posted there, and if they are both updating?

NinDTendo commented 3 years ago

They are usually both registered as either the geeetech a10 OR the anet a8. (1 device with sensors from both instances)

I am not sure how to check the topics tbh.

cmroche commented 3 years ago

You can use any MQTT client, like http://www.jensd.de/apps/mqttfx/1.7.0/ to subscribe to path you see in state_topic in both screenshots. With this you will see all the messages being sent to home assistant and will verify if the octoprint is 1) sending messages to both topics at the same time and 2) what messages are being sent.

Check you MQTT logs as well to make sure they are not throwing errors for any of the connecting clients.

NinDTendo commented 3 years ago

image Managed to get both working again. But they are still 1 device ...

cmroche commented 3 years ago

https://developers.home-assistant.io/docs/device_registry_index/

According to this, it's due to the mac address.. so I think this gives an easy way to solve the problem. I'll take a look at it once I have a moment to reread and test this.

cmroche commented 3 years ago

@NinDTendo Would you try the following please:

  1. Uninstall the plugin and shutdown octoprint
  2. Delete the device from HomeAssistant
  3. Reinstall the octoprint plugin from this URL: https://github.com/cmroche/OctoPrint-HomeAssistant/archive/fix-multi-instance-20201105.zip

I think this might fix your issue, please confirm and I'll merge the fix.

NinDTendo commented 3 years ago

Just tested, works as intended so far! Thanks for the help and quick fix!