I am new to Home Assistant. I have the cmqttd daemon connected to the mosquito broker plugin but the mqtt integration is not discovering the lights and binary sensors as expected.
I have Home Assistant 0.111.1 running on Raspberry Pi 4 Model B 2019 4GB
I have a Clipsal 5500PCU attached to my established c-bus network and a USB connection between the RPi and the 5500PCU. Both status lights are lit.
I loaded the Mosquito broker plugin and can manually publish and receive messages on the mosquitto broker from the CLI
I discovered the IP address of the mqtt broker on the hassio network with
docker network inspect hassio
I installed the cmqttd docker image and initiate the daemon with:
docker run --device /dev/ttyUSB0 --network hassio -e “TZ=Australia/Melbourne” cmqttd cmqttd -s /dev/ttyUSB0 -b 172.30.33.0 --broker-disable-tls
and get: “Connected to MQTT broker”
I installed the mqtt integration and enabled discovery.
The first thing I would do is confirm cmqttd is publishing discovery topics for the C-bus devices (lights) it manages. These topics look like homeassistant/light/light_name/config where “light_name” is the device’s actual name.
Use an MQTT Client, like MQTT Explorer, to view all the topics published to your MQTT Broker. You should see topics, one for each light, beginning with homeassistant.
I installed MQTT Explorer and created a new connection to 192.168.1.8 - my RPi HA server. I reopened the HA web interface and to my surprise was presented with 257 devices and 513 entities in the mqtt integration. That was easy! But perhaps coincidental to MQTT Explorer as the logs indicate that the devices appeared some hours earlier.
There seems to be a considerable delay between configuring MQTT & cmqttd and the discovery process in HA or MQTT explorer.
I am still stuck unfortunately…
It would appear that cmqttd is publishing discovery topics:
When I click one of the light toggles in HA I see…
{"state":"ON"}
… but the toggle slides back into the off/grey position after a couple of seconds - and no action in the real-world (ie no light turning on/off).
I am having trouble relating the 000-255 light switches in HA to something on my c-bus network. I am working with a very old copy of C-Cus Installation Software V2.1.1 on an ancient laptop, running windoze 95. I have 3 x 12 channel VFR, 7xPIR, 7xKEY2, 7xKEY4 etc. Each of the 12 channels in a VFR is assigned a Group (such as KitchenLight) and I can only assume that the 000-255 light switches in HA relate to these c-bus Groups - but it is not at all clear how. Are you able to shed some light on this (pun unintended).
SOLVED. It turns out that anonymous access to the Mosquito broker was highly unreliable (it worked, but only very occasionally)
set Mosquito broker configuration option anonymous: false
added Home Assistant User cmqttd
added new file to micolous\cbus MQTTcredentials containing username & password
added line to micolous\cbus Dockerfile COPY MQTTcredentials
added cmqttd option --broker-auth MQTTcredentials
Background
With the Mosquito broker configured as anonymous:true I could subscriibe fairly reliably to the MQTT broker from the CLI with mosquito_sub from my laptop, from the RPi, or from within one of the Docker containers. Subscribing from my PC with MQTT Explorer was successful every other time. Subscribing with cmqqtd from within a Docker container was very rarely successful. All of these subscriptions were successful according to the MQTT logs - but failed to receive mqtt messages.
The MQTTcredential file was added to the root of the micolous/cbus git archive and contains 2 lines:
cmqttd
cmqttdPasswordMatchingHomeAssistantUser
This MQTTcredentials file was copied into the Docker image by adding a single line to the micolous\cbus Dockerfile:
This implementation partially failed. HomeAssistant could turn lights on/off but did not recognise on/off changes made with cbus switches. The MQTT log was filled with:
Socket error on client <unknown>, disconnecting.
New connection from 172.30.32.2 on port 1883.
This failure was caused by a rename of a docker container from core-mosquitto to addon_core_mosquitto.