For the past few years i’ve been faithfully using @the1laz 's MQTT gateway for CBus lighting actions, however I always wished it had a little more functionality and wished for mqtt auto-discovery to make it easier to keep Home Assistant and C-Bus in sync.
Over the past school holidays I found some hours to upgrade the project substantially around looking after my kids.
New functionality:
Support for Lights, Covers, Relays and PIRs
Support for username/password security for cgate
Improved logging, retries and backoffs
MQTT AutoDiscovery and publishing of devices for HAAS
New linux service installer script
Unit testing (83% coverage) + GitHub actions CI.
Would love any feedback and requested additions. Shout out to @the1laz for the original work all those years ago.
THAT is an extensive upgrade! Well done and its been on your mind since 2021 I can see. Good luck, the more test sites the better but the changes bring some good features.
Thanks! I’m considering what to work on next, and wondered if anyone is using SSL support with their CGate? Would love to build it out if anyone wants to test with me?
This is cool! I never got around to improving the code once I got it working because it did the job well enough, good to see someone else has done it. I no longer have Cbus at home so I don’t maintain the code at all, I hope you don’t mind but I’ve linked your repo in my readme, hopefully people using home assistant give yours a go.
I’ve bitten the bullet and packaged your project into a working Docker image to test if there are any improvements over the older builds. Previously I was running C-Gate/OpenHAB on a Pi, and over the past 12 months I’ve been transitioning to Home Assistant.
One issue I’ve run into (which may also affect older versions) is that several of my group addresses — specifically 201/202/203, used for Home/Away/Night modes — are showing as unknown in Home Assistant after a restart, until the next state change occurs.
I’ve confirmed that retainreads = true is set in settings.js, but MQTT messages published from C-Gate responses (via getall or live events) do not appear to be retained (retain: false in MQTT Explorer and HA listener). As a result, Home Assistant can’t recover their state after a restart unless something actively triggers them again.
I’m happy to help test any fix or PR for this — really appreciate the work you’ve done on this project.