Skip to content

Use Python to communicate with a Clipsal C-Bus PCI or CNI! Includes MQTT bridge (for Home Assistant), PCI simulator, and reverse engineering notes.

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

micolous/cbus

Repository files navigation

libcbus

Build Status Coverage Status Documentation Status

Talks to Clipsal C-Bus using Python 3.7+.

Copyright 2012-2020 Michael Farrell. Licensed under the GNU LGPL3+. For more details see COPYING and COPYING.LESSER.

Note: This software is not certified or endorsed by Clipsal or Schneider Electric. Clipsal claim that use of C-Bus with non-Clipsal hardware or software may void your warranty.

More information about the project is available on the libcbus ReadTheDocs site, and in the docs directory of the source repository.

About this project

This is a reimplementation of the PCI serial protocol from scratch. This is done using a combination Clipsal's Open C-Bus documentation and reverse engineering (to fill in the gaps).

Unlike some contemporary alternatives, it does not use the libcbm library/DLL from Clipsal, or C-Gate, which have serious problems:

  • The libcbm module is written in C, and does not support x86_64 or comparatively-modern ARM architectures (such as that used in the Raspberry Pi).

    libcbm was previously only available as a static library for x86_32 Linux and Windows systems. Source is available under the Boost license, but this was last updated in 2009.

  • C-Gate requires an OS and architecture specific closed source serial library (SerialIO), the Java runtime, and itself has various licensing restrictions.

Because this is a pure-Python implementation, it should run on any Python supported platform. It has been primarily developed on Linux on armhf, x86_32 and x86_64 and macOS on x86_64.

At a high level, this project includes cmqttd, a daemon to bridge a C-Bus PCI to an MQTT Broker. cmqttd supports Home Assistant's MQTT Light model and MQTT topic auto-discovery.

Integration with Hass.io is still a work in progress.

Hardware interface support

This should work with the following C-Bus PC Interfaces (PCIs):

Recent updates (2020-02-22)

This project has recently completed a migration to Python 3.7.

Most things should work, but I'm still going through updating all the documentation properly.

There are many backward-incompatible changes:

  • This only supports Python 3.7 and later.

  • Python 2.x support has been entirely removed, as Python 2 has been sunset as of 2020.

    Python 3.6 and earlier support is not a goal. We want to use new language features!

  • D-Bus is no longer used by this project:

    • cmqttd (C-Bus to MQTT bridge) replaces cdbusd (C-Bus to D-Bus bridge).

    • dbuspcid (virtual PCI to D-Bus bridge) has been removed. It has no replacement.

  • sage (libcbus' web interface) and staged (scene management system) have been removed. cmqttd supports Home Assistant's MQTT Discovery schema.

    This allows libcbus to reduce its scope significantly -- Home Assistant can interface with much more hardware than C-Bus, and has a large community around it.

  • This no longer uses Twisted -- asyncio (in the standard library) is used instead.

Many APIs have changed due to refactoring, and is subject to further change without notice. The most stable API is via MQTT (cmqttd).

About

Use Python to communicate with a Clipsal C-Bus PCI or CNI! Includes MQTT bridge (for Home Assistant), PCI simulator, and reverse engineering notes.

Topics

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published