home-assistant / addons

:heavy_plus_sign: Docker add-ons for Home Assistant
https://home-assistant.io/hassio/
Apache License 2.0
1.49k stars 1.46k forks source link

Suggestion for addon OpenZwave to use external MQTT Server for more flexible deployment #1714

Closed munklinde closed 3 years ago

munklinde commented 3 years ago

The problem

Suggestion for addon OpenZwave to use external MQTT Server for more flexible deployment Not easily possible to use Zwave devices with external tools, like Node Red as mqttserver is not exposed outside the container.

Environment

image

Problem-relevant configuration

Traceback/Error logs

Additional information

Maybe look to Zigbee2Mqtt addon for inspiration.

MartinHjelmare commented 3 years ago

If running the mosquitto add-on, the OpenZWave add-on will bridge its broker with the broker in the mosquitto add-on.

munklinde commented 3 years ago

I'm running mosquitto add-on 5.1. Is there some configuration required to get the bridging going ?

MartinHjelmare commented 3 years ago

No, you should be able to connect to the host of the computer where the add-on is running and the mqtt port that the mosquitto add-on has configured.

munklinde commented 3 years ago

My Mosquitto Addon works fine, Zigbee2mqtt works fine, Hass connects fine, automatomations via Node-Red works fine ... nothing from Zwave

image

I actually last week migrated my system from a Linux-server to a RPi4 setup, to be compliant with the guidelines because I had the same problem before. On the Linux system I uninstalled the Addon and ran the docker image ozwdaemon manually, pointing it to use the Mosquitto server. That worked...

kaskader13 commented 3 years ago

If running the mosquitto add-on, the OpenZWave add-on will bridge its broker with the broker in the mosquitto add-on.

In my experience it only works if the mosquitto add-on configured without authentication...

MartinHjelmare commented 3 years ago

I've tested it successfully with the default authentication.

kaskader13 commented 3 years ago

@MartinHjelmare , could you plz share how the OpenZwave configuration with auth should look like? What's the format? I tried "mqtt_user: ... " and "mqtt_password: ..." . It didn't work for me. The docs at https://github.com/home-assistant/addons/blob/master/zwave/DOCS.md do not have auth parameters.

MartinHjelmare commented 3 years ago

There's no special config needed in the OpenZWave add-on.

When connecting with the MQTT integration in Home Assistant to the Mosquitto add-on broker you need to use the correct credentials set by the Mosquitto add-on. The default credentials is the same as your Home Assistant user account.

kaskader13 commented 3 years ago

My HA can connect to the Mosquitto add-on without a problem. I have 20+ devices there. But the bridge from OZW's mqtt to the main mqtt does not work. If I disable logins - all works fine. Somehow OZW in my case fails to find correct credentials.

MartinHjelmare commented 3 years ago

Does the default credentials work?

kaskader13 commented 3 years ago

I have mine set explicitly in Mosquitto brokeradd-on like :

logins:
  - username: my_username
    password: my_password
anonymous: false

Not sure what is the default, sorry ...

MartinHjelmare commented 3 years ago

Remove the auth config and you'll get the default.

MartinHjelmare commented 3 years ago

This is my (default) Mosquitto add-on config:

logins: []
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

I'm connecting from the MQTT integration from my dev computer to another host that runs this add-on with the credentials of my user account of the Home Assistant instance on the same host that runs the Mosquitto add-on.

It would be good to verify that this works for you too.

kaskader13 commented 3 years ago

@MartinHjelmare , thank you! Got it working with a user created using HA GUI and with "require_certificate: false". So there were 2 cases it didn't work:

  1. A user set explicitly in Mosquitto brokeradd-on.
  2. "require_certificate: true" set in in Mosquitto brokeradd-on.

All look good now. I appreciate you pointing me in the right direction.

MartinHjelmare commented 3 years ago

Thanks for the feedback. I'll bring this to our add-on developers.

munklinde commented 3 years ago

Thanks for the help. I now have OpenZWave in the Mosquitto broker .. image