mak-gitdev / HA_enoceanmqtt

Home Assistant wrapper for enocean-mqtt (https://github.com/embyt/enocean-mqtt)
GNU General Public License v3.0
57 stars 17 forks source link

using an external broker #27

Closed commentsonly closed 1 year ago

commentsonly commented 1 year ago

did as suggested, added host: 192.168.1.xxx port: 1883 user: username pwd: password

and do get a Failed to save add-on configuration, not a valid value. Got ...... and so on......

any idea what's wrong? If it does matter .. dev channel version

commentsonly commented 1 year ago

oh found out myself On https://github.com/mak-gitdev/HA_enoceanmqtt at section "Home Assistant Addon Installation" in th esubsection "Configuration" is says: host: localhost port: 1883 user: my_user pwd: my_password but in the /addon-dev/run.sh it looks for host ... OK port ... OK username but user password but pwd

this was the trick. well part of it. It also fails if one simply writed host: 192.168.1.100 or username: james since it expects these to be within '' or "" while when done so and accepted, next time viewed at the addon configuration the values do appear without quotes.

solved but not maked so so that Mark could validate and then close it.

mak-gitdev commented 1 year ago

Hi,

Thanks for spotting the issue when using an external broker. I am surprised that it works for you when using username instead of user and password instead of pwd. Are you sure it works ? In run.sh, you can see that username and password are used when retrieving internal broker parameters, which occurs when the mqtt_broker field is empty.

When using an external broker, only port is required to be into single/double quote. You can try and confirm.

Furthermore, you can see in run.sh that I wanted to prevent the addon to start when all the MQTT broker parameters are not defined (host, port, user and pwd). This is in fact the real issue as you have not defined user and pwd but the addon started.

commentsonly commented 1 year ago

Well it was a mixture of things I’d say.

First of all, I recently switched HA from a PI4 into an Intel thin client, whatever you would call it. A small box which has the opportunity to not only come with USB, WiFi, BT but also with serial ports. Got some of these, mostly i3 or i5 since if you are patient you get them for 100€ or ebay, and ….. I must say I never owned anything better so far.

As said I switched from the Pi. Grafana, node-red, mosquito and others still were located on the Pi only the Home Assistant was moved yet. (short in time) But I wanted to get rid of that split, so first of all I installed Mosquitto on the Home Assistant machine. Then I merged/joined the MQTT servers so that the one from the PI got mirrored into the Home Assistant mosquito. Then I thought to give it a try with EMQX because it looked lots better.

And then the problems started to emerge. I failed in getting EMQX running, better said it did run and I also managed to get some devices publish their topic on EMQX. But I spent more but an hour in trying to let your addon accept EMQX broker instead of the Mosquitto. All attempted resulted in not being privileged. Home assistant did work and was granted access after having created a user with a pw and within EMQX I also added that user with admin rights. But the addon simply failed and I got no idea why.

I then wanted to see if the addon can work with the old mosquito on the PI4 and that worked with username and password instead of user and pwd

mak-gitdev commented 1 year ago

Fixed in the dev version. Addon will not start unless all MQTT parameters are correctly set.