@Samsonsite I would love to try this out, but I am a Home Assistant Container (Docker) user, so can’t use add-ons. Any chance of a standalone Docker container?
Oh WOW!! – Could be just what i have been waiting for… Only a HA OS (running on nuc) so Addon are no problem but just have to work out how to get the underlying components stood up!
Hi @PianSom
There have been standalone docker containers for this for the past two years. That is what the add-on is based on, its the already available docker container with a few tweaks to run in Home Assistant.
On your Docker host run git clone https://github.com/Nik19792000/cbus
drop into the cbus directory below which has been created
run docker build .
done.
If you get that working then come back to me and I can suggest a few minor changes to the Dockerfile to build on a newer base version and update a couple of the other files.
Personally, you may find it difficult to work out the environment variables to pass etc which you have to read the doco to understand. If just running for yourself as a standalone docker then personally I would just edit the cmqttd-entry.sh file, comment it all out and just run the cmqttd with the required parameters for you. I would also add an exit statement so the container fails if cmqttd dies. I assume there is some sort of watchdog service you can run to restart stopped containers (im no Docker expert).
modify the script to look something like this to suit your startup parameters.
cmqttd --broker-address 192.0.2.1 --broker-disable-tls --serial /dev/ttyUSB0 or cmqttd --broker-address 192.0.2.1 --broker-disable-tls --tcp 192.0.2.2:10001
exit
Its all there in the original doco cmqttd — libcbus 0.2-dev documentation
and the files to build the container and run it are at https://github.com/Nik19792000/cbus
Mike
Hi @Borgy
Hope it works for you. I don’t have CBUS but I made the add-on for for a friend to run his connector inside HA and get backed up etc. His machine is a NUC running Home Assistant OS also.
Not sure what you mean by the underlying components. If you’re referring the the MQTT server its an official add on, just takes a few clicks to add it and start it. Once that’s started the integration will be discovered anyway and you will be prompted to install it.
You then add a user in home assistant for other services like cbus2mqtt to use to authenticate to MQTT. All of this should take no more than 5 minutes.
You can then install and run the add-on.
If you meant the underlying connection to CBUS, then I can’t help. If you have a PCI with a serial interface you will likely need a USB to serial cable to connect to your HA host. If you have a CNI then connect it to your network and check your router or DHCP server to identify its address. Reserve the address if possible.
That’s really it.
Thanks for the info.
Mqtt server install will be fine.
What I was not clear on yet is the connection you cbus2 network. We have a 5500pc serial and have a serial to usb (we did in the past connect to a pc with the cause software) so wasn’t sure of this can be directly to the NUC running HA and with the mqtt and your add on is that is all is needed then??
I can’t test serial, but yes from what I understand that should be all that’s needed. You just need to know the device Path in ha to your serial device. You can search for it in hardware info or just install zwavejs go to config tab and they are listed. Then uninstall the addon. I could list serial devices similarly but then it confuses if you’re using an IP connection, there’s not many ways to present the options in HA.
I did bump a python serial library so it is possible it broke it but it errors exactly the same without a connection which indicates to that point it is not impacted by the upgrade. If you have trouble I could roll it back. It should be as easy you describe, connect the serial to the NUC, add addon, configure, start, name your lights, the remaining go to entities select them and choose disable. done.
HI @Samsonsite
Thanks, I’ll take a look at that GitHub.
I am currently running a container for cbus
and a container for cgateweb
. Though I last updated my setup in Feb 2020, and I was hoping that someone who knows Docker better than me was going to do the work on cmttqd
, so I can forget what little I learned back then
I installed this addon yesterday and it has been running without issue.
I’m running HAOS on a RPi4, Mosquitto addon, and I’m actually using a Wiser2 for the IP connection.
FYI I’m using cbus switches to control philips hue lights via HA now.
Hi,
Thank you very much for your feedback. It is very much appreciated. Its interesting, I have had a few positive responses and one negative.
The negative was a report that cmqttd seems to drop commands when doing lots of changes. eg: a user tested with 12 relays in two scenes, all off and all on. When he set the all on scene it worked fine, when he tested the all off scene it missed some relays.
If you ever get a chance to test something like this that would be great. They didn’t seem to think the issue lie with the add-on but more a issue with cmqttd in general. If it is a problem, Id like to get it investigated and resolved ass it seems a much easier and better solution for CBUS than configuring cgate and cgateweb but that is only my opinion. I have considered making a CGATE and CGATEWEB add-on which should be fairly simple if required but was hoping to avoid that.
Anyway, appreciate the feedback, hope it keeps working for you. If you can manage to test a scene with a lot of on to off changes that would be great, but either way please accept my gratitude for testing and providing the feedback.
Mike
Hi i have installed Mosquitto broker which seems to be running successfully and installed cbus2mqtt as an add-on i think i have it configured to my cni. my issue is when i click start in seems to be working fine but when i go out and back in to add-ons it shows the start option again and i am not sure what i have missed
Also is there anything else that i need to install
Any help would be greatly appreciated
this is the log file I am getting
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
Importing the add-on configuration options as script variables
Completed importing addon configuration options
The following variable values were passed through via the Home Assistant add on configuration options
MQTT_USER = l60mcm
MQTT_PASSWORD = NOT DISPLAYED IN LOG FILE
MQTT_SERVER = core-mosquitto
TCP_OR_SERIAL = Use a IP connection to CBUS
CBUS_CONNECTION = 192.168.1.253:10001
MQTT_USE_TLS = null
MQTT_PORT = 1833
CMQTTD_CA_CERT_PATH = null
CMQTTD_CLIENT_CERT_PATH = null
CMQTTD_CLIENT_KEY_PATH = null
CMQTTD_PROJECT_FILE = null
CBUS_TIMESYNC = null
CBUS_CLOCK = null
CMQTTD_LOG_LEVEL = null
Creating file /etc/cmqttd/auth
Using TCP CNI at 192.168.1.253:10001
Disabling TLS support.
Using MQTT login details in /etc/cmqttd/auth
No value was provided for CMQTTD_PROJECT_FILE; using generated labels.
Local time zone: Europe/Dublin
Current time: Thu, 22 Sep 2022 23:10:35 +0100
Running cmqttd with flags: --broker-address core-mosquitto --timesync 300 --broker-port 1833 --tcp 192.168.1.253:10001 --broker-disable-tls --broker-auth /etc/cmqttd/auth
2022-09-22 23:10:36,396 Transport security disabled!
Traceback (most recent call last):
File "/usr/bin/cmqttd", line 33, in <module>
sys.exit(load_entry_point('cbus==0.2', 'console_scripts', 'cmqttd')())
File "/usr/lib/python3.10/site-packages/cbus/daemon/cmqttd.py", line 492, in main
run(_main())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/usr/lib/python3.10/site-packages/cbus/daemon/cmqttd.py", line 485, in _main
mqtt_client.connect(option.broker_address, port, option.broker_keepalive)
File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 914, in connect
return self.reconnect()
File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
File "/usr/lib/python3.10/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
File "/usr/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/usr/lib/python3.10/socket.py", line 833, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
The error you are getting means its not making a successful connection to the CNI.
“ConnectionRefusedError: [Errno 111] Connection refused”
This is generally for one of two reasons:
- Your IP and port number is incorrect - 192.168.1.253:10001
or a common mistake - You still have another instance connected to the CNI and therefore the port is occupied. ie: is cgate running somewhere and connected? Left toolkit open and running somewhere?
Hope one of those solve it for you.
Hi thanks very much for your reply i only just saw it there now for some reason the forum did not notify me of the reply.
I have checked the ip and port as pic below. i also restarted any pc that may have Toolkit open (no active connection but just to double check). i disconnected and turned off my wiser 1. i restarted the CNI and disconnected and reconnected it to the cbus network
Is there anything else that you can think of or anything else that i may need to install
thanks
Edit
Update
Hi mike thanks very much for your help and suggestion.
First i tried with a new network with just pi (home assistant) CNI, switch and still getting issue
Then I tried to remove Cbus2mqtt and reinstall it, but it would not allow me to reinstall.
I wiped home assistant and started fresh, and everything is working as expected.
Thanks
Leonard
One other question
I did not have the project file added and mqtt has added them as c-bus light 000 etc I have now successfully added the project file. Does anyone know of any easy way to get mqtt to rediscover and get the names?
Edit
The above was my error i had put the file.cbz in the correct location but i wrongly assumed that cbus2mqtt was expecting to see the file in the cbus folder, once i put the path in /share/cbus/project.cbz all worked and the labels updated.
Does anyone know how to call a cbus scene to turn off/On a group of my lights as this is how i currently do it when using my cbus light switches. The only thing i cannot see the cbus scene showing as an entity or i am not sure how to get home assistant to activate a cbus scene, directly
I am having issues where I have a dashboard switch that turns on and off a group of lights sometimes they do not all turn on and some times they do not all turn off. if i look at the individual control for that light in home assistant it always shows the correct command but cbus does not always seem to get the command.
Hi guys,
Looking for some help in the CBUS space please…
Ive been using HomeAssistant for a while (running on a Synology NAS) but have never connected it in anyway to my CBUS system.
To be honest the CBUS system is something that was in the house when we bought it and Ive never touched it… All I know is that we have lights, blinds (via timed relays rather than bklind controllers I believe) and scenes setup on it. There is no external connectivity that I can plug a serial / usb / LAN into.
Im upto speed on TCP/IP networking and the HA side of things, but what hardware and possibly software) do I need to be able tio get the cbus2mqtt addon taking to CBUS?
Any help or pointers would be greatly appreciated.
Thanks
Jon
Do you have a wiser by any chance?
No Wiser Im afraid. Just C-Bus running independantly of anything with no current means of connecting to it and a HomeAssistant instance running on my local LAN (which Id like to interface with the C-Bus via MQTT).
We have owned the house for about 8 - 10 years… The previous owner had the C-Bus installed a year or two before that when they did their reno’s.
Thx
Jon
I used to use Cgateweb which works by running C-gate on a linux machine (raspberry pi or similar single board computer will do) and having it publish C-bus events to MQTT. You will need either a C-bus RS232 CNI or a network CNI for this to work.
It hasn’t been updated for a few years so you may need to run an older version of linux to get it to work.
A more recent update is a docker container that @samsonsite reffered to earlier in this thread
Easier option is to buy and install C-bus SHAC (no sparky required), but they are not cheap.
Thanks. I have a Synoogy NAS running 24x7 and so ca install Docker to run the above container.
I just looked on the Clipsal site and the 5500SHAC is apparently discontinued (??). Perhaps the next dumb quesiton of the day… Is the network interface connector (to connect to my LAN over Ethernet), the 5500CN2?
Doing a quick read of the docker container readme link above, the 5500CN / CN2 needs to have an IP address before it can be used… Would it be naive of me to think the 5500CN will grab an IP address automatically via DHCP or do I need to use the CBus Toolkit to manually allocate it an IP address?
Also, once the 5500CN is installed and Docker container running, what sort of functionality can I expect in Homeassistant? I assume its a 2-way comms thing, ie press a physical light switch button and the Homeasistant entitiy updates (via MQTT) and visa-versa, toggle a Homeassistant switch and MQTT sends the command via the container to the CBus?
Apologies for the basic questions! Ive been putting this journey off for years and now’s the time to dive in!
Thanks
Jon
Forgot they discontinued the SHAC. It’s been replaced with a new model - Clipsal C-Bus Spacelogic Application controller… Who in marketing thought that was a good idea for a name?
https://www.clipsal.com/products/detail?CatNo=5500AC2&itemno=5500AC2&tab-document-1=0
Basically it’s a single board computer with built in C-Bus control and LUA scripting language.
The LUA script has MQTT built-in so Home assistant to talk to C-Bus only requires a couple of basic scripts. One has been done by ssaunders that even works with Home Assistant discovery.
As for the docker container, its been years since I used it so going off rough memory here. The 5500CN will need a static IP address - that can be done in your router (bind IP to MAC) or I think using the Lantronix Device Installer. Clipsal application note for using the device installer below.
https://updates.clipsal.com/ClipsalSoftwareDownload/mainsite/cis/technical/AN06-044-2.pdf
Once you have the docker container working and C-Bus is publishing topics to MQTT, you will need to add each light to your Home Assistant MQTT yaml file.
light:
############################# C-Bus Lights ############################
- name: Front Exterior
command_topic: "cbus/write/254/56/0/switch"
state_topic: "cbus/read/254/56/0/state"
payload_on: "ON"
payload_off: "OFF"
Hope that helps gets you started Jon.