Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Python Library for the Velbus protocol

Project description

## python-velbus: A python library to control the Velbus home automation system

This library was created to support the Velbus protocol in my home automation efforts.

It is currently being used by the Velbus component in [home assisstant]( but can also be used indepenently.

The latest version of the library is *2.0.12* and it is published as a python package on [pypi](

I would like to extend this module to support all Velbus modules and offer higher-level functionality such as auto-discovery, so feel free to submit pull requests or log issues through [github]( for functionality you like to have included.

API documentation is available [here](

# Example usage

The library currently only supports a serial connection to the Velbus controller (either through USB module or through RS-232 interface). In order to use the library, you need to first initialize the controller and can then send and receive messages on the Velbus. The library currently does not validate if a message is supported by a certain module (e.g., you can send a blind up message to a relay)

import velbus
import time

# serial (or USB over serial) device connected to Velbus controller
port = "/dev/ttyACM0"

connection = velbus.VelbusUSBConnection(port)
controller = velbus.Controller(connection)

# set module address
module_address = 0xdc
message = velbus.SwitchRelayOnMessage(module_address)

channel_number = 1

message.relay_channels = [channel_number]


def _on_message(received_message):
print("Velbus message received")



# Installation

You can install the library with pip (*pip install python-velbus*) or by checking out the [github]( repository and running *python install* at the root of the repository.

# Supported modules

The following Velbus modules are currently supported by this library:

| Module name | Description | Status | Comments |
| ----------- | ----------- | ------ | -------- |
| VMB6IN | 6 channel input module | SUPPORTED | All messages are supported |
| VMB7IN | 7 channel input module | SUPPORTED | Only messages from VMB6IN are supported |
| VMB4RYLD | 4 channel relay module | SUPPORTED | All messages are supported |
| VMB4RYNO | 4 channel relay module | SUPPORTED | All messages are supported |
| VMB1RS | Serial interface | SUPPORTED | All messages are supported |
| VMB1USB | USB configuration module | SUPPORTED | All messages are supported |
| VMBRSUSB | Configuration module with USB and RS-232 interface | SUPPORTED | All messages are supported |

# Adding support for other modules

The [velbus website]( contains an overview of the different available modules and their protocol documentation. In order to add support for an additional module, read through the protocol documemntation and add support for missing messages (many messages are shared between modules so make sure to check if a message already exists or not)

Steps to add support for an additional module:

- [ ] Look up the protocol documentation of the module you want to include at the [velbus website]( Select the module, go to *Downloads* and search for the info sheet with protocol information.
- [ ] Go through the messages directory and look for messages in the protocol information sheet that are not yet supported. Create a new file in the *messages* folder for each unsupported message. Every new message should inherit from the *Message* object and reuse common functionality.
- [ ] Implement constructor method for each new message
- [ ] Implement the *populate* and *data_to_binary* methods for each new message
- [ ] If the message has other than low priority or no RTR set (which are defaults), then re-implement *set_defaults* method
- [ ] Add new messages to the ** file in the *messages* folder
- [ ] Test and iterate
- [ ] Update the Supported modules section of the ** file
- [ ] Submit a pull request on Github

# Further development

The library currently offers only the lowest level of functionality: sending and receiving messages to modules. I plan to extend this library with more higher-level functionality such as:

- [ ] Modeling modules and their supported functions as entities
- [ ] Only allowing to send supported messages to modules
- [ ] Auto-discovery of modules
- [ ] Exposing the velbus controller as an external API so it can be shared between different consumers

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
python_velbus-2.0.15-py3-none-any.whl (41.9 kB) Copy SHA256 hash SHA256 Wheel py3 Apr 7, 2018
python-velbus-2.0.15.tar.gz (17.8 kB) Copy SHA256 hash SHA256 Source None Apr 7, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page