micolous / cbus

Use Python to communicate with a Clipsal C-Bus PCI or CNI! Includes MQTT bridge (for Home Assistant), PCI simulator, and reverse engineering notes.
http://cbus.readthedocs.org/
GNU Lesser General Public License v3.0
49 stars 27 forks source link

Will this work with a CNI? #4

Closed poldim closed 4 years ago

poldim commented 7 years ago

I know the readme states that this is design and tested with PCI's. However, I've only got a CNI (ethernet to cbus) module and wondering if this is something that could be used for this connection. Will it work?

natemason commented 7 years ago

I got it working a couple of weeks back with my CNI. I didn't use any of the dbus services and was just calling the python modules directly and most of the modules supported command line options.

To test you can run the cbus\protocol\pciprotocol.py tool: python pciprotocol.py -t <CNI IP:PORT>

You'll get a stream of events running on the C-Bus network.

It was okay but I wanted to integrate it into my home automation software (Home-Assistant) and ended up using C-Gate and MQTT.

This is the article I followed: http://addictedtopi.tumblr.com/post/101166244678/using-openhab-with-c-bus

Hope that helps.

micolous commented 7 years ago

This code works with CNI-like devices, but it's untested (I normally use a serial-TCP proxy instead, which I'm lead to believe is exactly what the CNI is). You just specify the -t option to cdbusd.

This code is mostly unmaintained these days as I'm not looking after a CBus network anymore. So it doesn't support any of the newer protocols like MQTT, as this predates a lot of the home automation software to come in to the open source space more recently.

However, I wouldn't recommend using C-Gate as it is both proprietary, and from memory Clipsal embed CPU-specific binary blobs (JNI) in the JAR for serial access. C-Gate is also even older than this code. Those blobs and lack of source are part of my motivation for writing this project in the first place.

After inspecting a lot of the proprietary tools, I discovered Clipsal are also bad at following their own recommendations, and use some legacy communication methods which they say in their public docs not to use.

It should be possible to write something similar to cdbusd which proxies a PCI (either connected over serial or TCP) to MQTT, but I don't have much interest in writing it as I no longer have regular access to C-Bus hardware.

timsttam commented 6 years ago

Bit late to this question, however I have used this code successfully with a CNI for several years (my CBUS install was performed in approx 2014), until just recently when my machine running the application died following a storm - I am now in the process of rebuilding ;)

Have also amazed family and friends using the Sage web application, and a little bit of wifi sniffing and some scripting provides you automatic lights on when devices arrive home - all using cdbusd.py and a CNI.

micolous commented 4 years ago

I've re-acquired C-Bus hardware again and built a small test rig on. The current version of master (as merged today) uses MQTT instead of D-Bus (so this now works with Home Assistant, including MQTT Discovery), which I think addresses the earlier comments here.

But getting rid of D-Bus support does mean sage is gone. However, Home Assistant does a better job at that, and also integrates with non-C-Bus hardware.

I'm closing this off, as thanks to the comments here, we know that CNIs work just fine. :)

...but for other folks looking at buying hardware today, unless you already own a CNI, I wouldn't recommend buying one. Anything that can connect to it can take complete control of your C-Bus network, without authentication, so you'd need to totally isolate it on your network.

By comparison, the USB or serial versions are much easier to control (as a directly-connected peripheral). You can still share these into containers and virtual machines, and cheap ARM boards (eg: Raspberry Pi) tend to include USB port(s) these days :)