Clipsal C-Bus add-on

I have a C-Bus lighting system that was running using Cgateweb and MQTT on my Hassbian RPI3.
The problem now is that I am wanting to migrate over to VM running Ubuntu with Hassio image - this means I lose my C-Bus lighting integration to Hass.

Has anyone or is anyone planning on developing a C-Bus add on for Hassio?

Very keen for this also.!!!

Running hassio on RPi and have cbus lighting… what’s required to get his working?

At the moment I’m running two systems to achieve this task

  1. A raspberry pi running as the c-bus to Mqtt bridge - following these instructions - http://blog.jamescowan.com/2017/04/home-automation-homeassistant-and.html

  2. A NUC with a hassio running on a docker - the best thing I ever did with hassio , so much easier and faster with home assistant ! - I had trouble with running the cbus- Mqtt bridge and hassio running on the same system (most likely to my lack of knowledge!)

It would be great if someone developed a cbus to Mqtt docker file, so you could run it along with hassio docker on one system

1 Like

Heya, I’m the person who maintains Python/Twisted bindings for C-Bus.

I’ve recently gotten a branch working on Python 3 which supports exposing C-Bus Light Controls over MQTT, and even supports auto-discovery in Home Assistant. I intend for this to replace custom web interface and D-Bus code I’ve previously maintained.

I’m still polishing the Python 3 branch; but there’s a Dockerfile in that branch that’ll run cmqttd (the C-Bus-MQTT gateway) to a connected serial or USB PCI:

git clone -b python3 https://github.com/micolous/cbus.git
cd cbus
docker build .
docker run --device /dev/ttyUSB0 -e "MQTT_SERVER=192.0.2.1" -e "SERIAL_PORT=/dev/ttyUSB0" -e "TZ=Australia/Adelaide" -it cmqttd

With some small changes to Dockerfile it should be possible to use this with a CNI (or other TCP-based PCI).

I’m planning on implementing MQTT authentication and migrating from Twisted to asyncio before declaring this “done”.

2 Likes

Hi Micolous

Great to see another Aussie!..

Keen to understand if this cbus integration is workable to setup using Hassio and HA.? Any details on exactly whats needed to setup and how (dummies guide :slight_smile: )??

Unfortunately, there’s not a “dummies guide” yet – the Docker container build instructions I mention above are about as “dummy friendly” as I’ve done right now :wink:

There’s an MQTT broker add-on in HassIO which will get you at least half way there.

It may be possible to build this out into a HassIO add-on, but I haven’t investigated this yet. My priority at the moment is polishing off the rest of this library before taking on more features! :sweat_smile:

2 Likes

Just watching this also as I am quite interested in integrating C-BUS devices to HA.

1 Like

Hello @micolous

Thanks for sharing this. Having been a long term cgateweb user, I have just bought a nuc and am busy converting everything I can see in to docker.

A couple of questions, if I may

  • is it possible to pass login credentials to the MQTT broker?
  • I have a generic serial to USB converter plugged in to my c-bus unit (and use ser2sock with cgateweb). Do you think this has a chance of working, or will I need to find the specific Clipsal model?

Hi @micolous

I’m about to connect my Raspberry Pi to my c-bus 5500PCU, and wondering if I should try this, or use C-gate with cgatetoweb method?

My MQTT server(mosquito) is authenticated, so I guess I would need to wait for you add that feature, any idea when that may possible?

Thanks for your efforts, it looks like you are almost there!

Checking in - am about to attempt to merge my cgate web to this project. Thanks so much for what you’ve done!

Love the little cbus pocket of people who are on HA !

1 Like

@Lowgoz - is your project likely to be similar to the one mentioned above: a docker C-Bus/MQTT converter?

yup - i’ve currently got cgateweb in a VM but really want to run the whole thing as a docker. Either somehow running the JS files of Cgate server / Cgateweb in a docker, or using the above in it’s own docker container.

So far i’ve had zero luck as im an absolute gumby at coding, but ill keep trying until someone manages to get a docker up

1 Like

Hi there - just touching base to see if you’ve managed to make any progress?

I am a Docker newbie, but have managed to set up three containers which work and have managed to replace my Pi Zero:
1 ser2sock - to convert a usb to serial converter to a socket
2 Cgate - a Cgate server
3 Cgateweb - to interface between Cgate and MQTT

I am still optimising the containers, but if anyone is interested in my progress then just shout

1 Like

Love this. Im a total noob to HA. Ive been using homebridge for a while but want to move into something that will allow more granular control.

Is it possible yet for this to work with a CNI? If so, could someone be kind enough to post the correct syntax I need to connect to a network based Cgate server? Thanks so much!

Just adding in that I also would love to see a Add-on for cmqttd.

I would love to be able to run hassio and cmqttd as an add-on on the same machine.

It seems the docker build details have been provided and the configuration options well documented. It is unfortunately atm a little beyond my capabilities to create an add on.

Any assistance from the community would be very much appreciated. I can probably get a little done myself but the bash script for run.sh is beyond me.

My three docker containers I mentioned above have been working pretty flawlessly since May.

But I see that HA has now been integrated into the libcbus project, so things should be much cleaner now. Has anyone tried this yet?

https://cbus.readthedocs.io/en/latest/cmqttd.html#cmdoption-cmqttd-broker-auth

2 Likes

i tried, but im getting a heap of socker errors when talking to the mqtt broker. apparently ill need to run TLS or at least authentication. but that means changing everything else. anyway, ill muck around with it when i have a few hours to kill

2 Likes

I can’t get it to connect to my 5500SHAC CNI using a docker container approach, but then I can’t get cgateweb to work either even though the instructions about the place are pretty simple.

PianSom - I want to find a solution that will give me a dedicated tablet running Home Assistant in our downstairs kitchen.

I have c-bus and have managed to install home-bridge on a Raspberry PI with a wired network plug:-

  • ser2sock (to convert my 5500PC to a CNI compatible device)
  • Cgate
  • Homebridge

I am able to connect to a local IP address via a web browser and use the Homebridge page but it is far from user friendly from a dashboard/usability perspective.
I’ve also added a plugin for home bridge for google (we have a google hub) so can issue voice commands for some stuff. I can connect to the c-bus network through Clispal Toolkit so I think all that is running successfully.

But after reading more, I think I need to get Home Assistant installed to get what I want so that it looks more user friendly and I can extend to include more smart home devices.

Can I ask how you have gone with yours and if you can provide some advice.

Can I actually leave the Raspberry Pi where it currently is connected to the 5500PC and home network (it’s actually in a server room so very much out of the way) and go about installing this Home Assistant and all other things directly in to the tablet and leaving the Raspberry PI where it is connected to the c-bus network via the 5500PC. Is it then possible to have the surface pro tablet “tap-in” to the c-bus network via the RPI without having to do any direct integration between the tablet and C-Bus/5500PC?

Cheers,
Paul