Here is where I have got to so far. Just to recap on the setup. I have a machine with hostname dockerarch running docker with both BrewBlox and HA installed with their respective standard setups. If I specify the hass service with no hass-mqtt, the log file for the BrewBlox hass service shows:
2020/10/06 08:40:07 INFO brewblox_service.service Service config: {'host': '0.0.0.0', 'port': 5000, 'bind_http_server': True, 'output': None, 'name': 'hass', 'debug': False, 'eventbus_host': None, 'eventbus_port': None, 'mqtt_protocol': 'mqtt', 'mqtt_host': 'eventbus', 'mqtt_port': None, 'mqtt_path': '/eventbus', 'history_topic': 'brewcast/history', 'state_topic': 'brewcast/state', 'hass_mqtt_protocol': 'mqtt', 'hass_mqtt_host': 'eventbus', 'hass_mqtt_port': None, 'hass_mqtt_path': '/eventbus'},
2020/10/06 08:40:07 INFO brewblox_service.mqtt Starting <EventHandler for mqtt://eventbus:1883>,
2020/10/06 08:40:07 INFO brewblox_service.mqtt Starting <EventHandler for mqtt://eventbus:1883>,
2020/10/06 08:40:07 INFO brewblox_service.mqtt listen(brewcast/state/#),
2020/10/06 08:40:07 INFO brewblox_service.mqtt subscribe(brewcast/state/#),
2020/10/06 08:40:10 INFO brewblox_service.mqtt <EventHandler for mqtt://eventbus:1883> connected,
2020/10/06 08:40:10 INFO brewblox_service.mqtt <EventHandler for mqtt://eventbus:1883> connected,
2020/10/06 08:40:25 INFO brewblox_hass.relay Received 17 blocks from spark-one,
2020/10/06 08:40:25 INFO brewblox_hass.relay publishing new sensor: Air Sensor,
To me this indicates that if you don’t put an explicit external mqtt server, the relay is reading from mqtt://eventbus:1883 and writing to the same place.
If I add the command: ‘–hass-mqtt-host=dockerarch’ to the docker-compose.yml (i.e. still pointing to the same host as runs docker with both apps installed, then I get the following in the hass_1 log:
2020/10/06 08:53:17 INFO brewblox_service.service Service name: hass,
2020/10/06 08:53:17 INFO brewblox_service.service Service info: @ Mon Oct 5 20:28:07 UTC 2020,
2020/10/06 08:53:17 INFO brewblox_service.service Service config: {'host': '0.0.0.0', 'port': 5000, 'bind_http_server': True, 'output': None, 'name': 'hass', 'debug': False, 'eventbus_host': None, 'eventbus_port': None, 'mqtt_protocol': 'mqtt', 'mqtt_host': 'eventbus', 'mqtt_port': None, 'mqtt_path': '/eventbus', 'history_topic': 'brewcast/history', 'state_topic': 'brewcast/state', 'hass_mqtt_protocol': 'mqtt', 'hass_mqtt_host': 'dockerarch', 'hass_mqtt_port': None, 'hass_mqtt_path': '/eventbus'},
2020/10/06 08:53:17 INFO brewblox_service.mqtt Starting <EventHandler for mqtt://eventbus:1883>,
2020/10/06 08:53:17 INFO brewblox_service.mqtt Starting <EventHandler for mqtt://dockerarch:1883>,
2020/10/06 08:53:17 INFO brewblox_service.mqtt listen(brewcast/state/#),
2020/10/06 08:53:17 INFO brewblox_service.mqtt subscribe(brewcast/state/#),
2020/10/06 08:53:25 INFO brewblox_service.mqtt <EventHandler for mqtt://eventbus:1883> connected,
2020/10/06 08:53:34 INFO brewblox_hass.relay Received 17 blocks from spark-one,
2020/10/06 08:53:34 INFO brewblox_hass.relay publishing new sensor: Air Sensor,
2020/10/06 08:53:34 ERROR brewblox_service.mqtt Exception handling MQTT callback for brewcast/state/spark-one: ConnectionError(Publish error="The client is not currently connected.", topic="homeassistant/sensor/spark-one__AirSensor/config"),
2020/10/06 08:53:39 INFO brewblox_hass.relay Received 17 blocks from spark-one,
2020/10/06 08:53:39 INFO brewblox_hass.relay publishing new sensor: Air Sensor,
2020/10/06 08:53:39 ERROR brewblox_service.mqtt Exception handling MQTT callback for brewcast/state/spark-one: ConnectionError(Publish error="The client is not currently connected.", topic="homeassistant/sensor/spark-one__AirSensor/config"),
To me this indicates the relay is reading from the BrewBlox eventbus and writing to the HA mqtt, but hasn’t connected and so gets rejected. I hooked up the mqtt-explorer (very handy, thanks once again), on the same docker host and directed it to use docker-arch:1883. If I do this, no traffic is shown at all. However, if I create a username and password on the HA mqtt and connect with mqtt-explorer using that username and password, I get see regular HA mqtt traffic. (Hurrah!)
So it looks to me as though if you don’t specify an mqtt host with the hass service, the relay doesn’t connect and write internally to the HA mqtt, but instead connects and writes to the BrewBlox eventbus. If you explicitly point to the docker host:1883, then HA rejects the client connection without a username and password.
I suspect from your explanation Bob, this behavior is unexpected and that with no explicit mqttt_host on the service, the relay should read from the BrewBlox eventbus and write to the HA mqtt? I’m not seeing that, but if there turns out to be a way of adding a username/password to the connection request to the HA explicitly specified mqtt, I bet it would burst into life.