Open editter opened 2 years ago
So I dug into this a little bit and I think I figured out the problem (I am not that familiar with the addon development so I might be wrong). The config.json services > mqtt:want will provide settings if it's an addon service, not just magically pulling it from configuration.yaml and because I am using an MQ broker on another machine it doesn't work for me.
My proposed solution would be to add config options and use that if the addon service isn't available. Thoughts?
config.json
"schema": {
...
"mqtt_host": "str?",
"mqtt_port": "port?",
"mqtt_ssl": "bool?",
"mqtt_username": "str?",
"mqtt_password": "str?"
},
start.sh
#!/usr/bin/env bashio
if ! bashio::services.available "mqtt"; then
bashio::log.info "No internal MQTT service found, using addon config"
export MQTT_HOST=$(bashio::config "mqtt_host")
export MQTT_PORT=$(bashio::config mqtt "mqtt_port")
export MQTT_SSL=$(bashio::config "mqtt_ssl")
export MQTT_USER=$(bashio::config "mqtt_username")
export MQTT_PASS=$(bashio::config "mqtt_password")
else
bashio::log.info "MQTT service found, fetching credentials ..."
export MQTT_HOST=$(bashio::services mqtt "host")
export MQTT_PORT=$(bashio::services mqtt "port")
export MQTT_SSL=$(bashio::services mqtt "ssl")
export MQTT_USER=$(bashio::services mqtt "username")
export MQTT_PASS=$(bashio::services mqtt "password")
fi
...
Indeed, it is designed to work with the MQTT addon provided by HA, to make it simple. I will put this on my todo list.
Hello, I set up the addon in a second instance on a raspberry pi 3 and got the lock connected but I never see any MQ messages come through. I am not seeing the "MQTT connected" message in the logs so something isn't working but I'm not sure why. I get my birth/will messages when HA starts/stops so I know the MQ stuff is working but nothing from this addon. Thoughts?
Here is my entire configuration.yaml (note I did try adding the default_config entry in case that was important but I didn't see anything different)
configuration.yaml
I also see this in the logs and I am wondering if the service is not enabled but I'm not sure what Service it is referring to.