Skip to main content

GitHub Tag PyPI - Version

viessmann-optolink2mqtt

This project provides an open source interface between a Viessmann device (heat pump, gas heater, etc) and MQTT.

Some Viessmann devices (at least those manufactured before roughly year 2014) expose an optical interface for communication with external devices named "Optolink".

This interface is typically located in the Vitotronic panel and officially supports a connection to the VitoConnect device. On the other hand such interface also allows tinkerers to read and write registers of the Viessmann devices to e.g. read telemetry data (temperatures, status of internal parts, etc) and write settings (e.g. heating mode, target temperatures, etc).

This project allows you to take control of your Viessmann device by hooking into the Optolink interface and sending all data to a local MQTT server, so that all your data is local and is never transiting the cloud of any vendor.

Architecture

Architecture

Hardware Required

  • A Single Board Computer (SBC) which is capable of running Python and has a USB-A connector (if you plan to use the original Viessmann Optolink USB cable). A typical choice is the Raspberry; myself I've been using the OLinuXino A64 as (slightly cheaper) alternative.
  • The Optolink-to-USB cable to read/write on the Optolink interface; you have two main options: a) buy the original Viessmann cable on specialized shops such as https://www.loebbeshop.de/; see exact item here or b) build your own cable, more details available from other tinkerers like MyVitotronicLogger or at Optolink splitter readme

Software features

This project main features are:

  • Written to be reliable and run 24/7: careful exception handling, reconnects automatically to the MQTT broker in case of transient network issues, automatically re-establishes serial port connection in case of failures, etc.
  • Easy declarative configuration: configure all aspects of your Viessmann device from a single YAML config file (easy to backup and/or version in git); no need to hand-write HomeAssistant MQTT entity definitions! All config parameters have a clear name and associated documentation.
  • Read and write support: allows both to read from your Viessmann device and also to set writable registers to e.g. change heating mode, change target temperatures, etc.
  • HomeAssistant friendly: although this project can be used with any home automation platform; it provides a number of features that make it very HomeAssistant friendly: in particular MQTT discovery messages make it possible to magically have all your Viessmann entities appear in HomeAssistant.
  • Easy installation via Pypi and docker and easy upgrades

What this project does NOT have at this time:

Installation

This project supports 2 main installation methods: PyPi and Docker. Both methods are meant to be used from a Linux Operating system which has the USB/DIY cable attached (see "Hardware" section above).

Pypi package

python3 -m venv optolink2mqtt-venv
source optolink2mqtt-venv/bin/activate
pip install viessmann-optolink2mqtt

optolink2mqtt --help

Docker

When using Docker you will need to provide the YAML config file path in the docker run command and also provide the name of the serial port (e.g. /dev/ttyUSB0 in the following example):

docker run -d -v <your config file>:/etc/optolink2mqtt/optolink2mqtt.yaml \
    --device=/dev/ttyUSB0 \
    --hostname $(hostname) \
    --name optolink2mqtt \
    --restart=unless-stopped \
    ghcr.io/f18m/optolink2mqtt:latest

docker logs -f optolink2mqtt

Please note that the --restart=unless-stopped makes sure that the optolink2mqtt docker will be restarted after a reboot.

The docker image of optolink2mqtt supports 3 main architectures: amd64, armv7 and arm64.

For an MQTT broker that requires authentication, set MQTT_BROKER_PASSWORD to provide the password through an environment variable. To use a Docker secret instead, mount the secret file and set MQTT_BROKER_PASSWORD_FILE to its path:

docker run -d -v <your config file>:/etc/optolink2mqtt/optolink2mqtt.yaml \
    -v <path to secret file>:/run/secrets/mqtt_broker_password:ro \
    --env MQTT_BROKER_PASSWORD_FILE=/run/secrets/mqtt_broker_password \
    --device=/dev/ttyUSB0 \
    --hostname $(hostname) \
    --name optolink2mqtt \
    --restart=unless-stopped \
    ghcr.io/f18m/optolink2mqtt:latest

The broker username is configured in mqtt.broker.username in the YAML file. MQTT_BROKER_PASSWORD takes precedence over MQTT_BROKER_PASSWORD_FILE, and either environment variable overrides mqtt.broker.password in the YAML configuration. A trailing newline in the password file is ignored.

Docker Compose

If you prefer Docker Compose you can grab the docker-compose.yml file and just edit the name of your serial port (e.g. replace /dev/ttyUSB0 with the serial port you get on your device).

Serial port naming

Something you might notice running this project on certain HW platforms is that sometimes due to errors on the USB bus the Linux kernel might force your Optolink-to-USB adapter to reinitialize and when this happens the device might change its name e.g. from /dev/ttyUSB0 to /dev/ttyUSB1. If your config file is referencing /dev/ttyUSB0, then optolink2mqtt will stop working. To prevent this, the best approach is to setup a a udev rule that would create a symbolic link to the Optolink-to-USB device:

  1. Use lsusb utility to find out all details on your Optolink-to-USB cable. Mine appears as:
Bus 002 Device 006: ID 1a86:7523 QinHeng Electronics CH340 serial converter

The portion after ID is the vendor ID colon product ID. In my case 1a86 is the vendor ID and 7523 is the product ID.

  1. Create the udev rule:
sudo nano /etc/udev/rules.d/99_optolink_usb.rules

and copy-paste there a line containing a reference to the same vendor ID and product ID that appeared in the lsusb output:

SUBSYSTEM=="tty", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="optolinkUSB"
  1. Unplug and plug again your Optolink cable

  2. Use in the optolink2mqtt.yaml config file the symlink /dev/optolinkUSB as serial port name. Also remember to use --device=/dev/optolinkUSB in your docker run command if you're using Docker.

Configuration file

This software accepts a declarative configuration in YAML format. Please look at the optolink2mqtt.yaml file as reference source for the syntax.

How to discover register addresses

TO BE WRITTEN

HomeAssistant Integration

This project allows a very easy integration with HomeAssistant. It's enough to populae the ha_discovery section of each register defined in the configuration file with some metadata specific for each sensor, to get the sensor automatically appear inside your HomeAssistant:

HA integration

This makes it possible to build in your HomeAssistant dashboard visual representation of your Viessmann device. E.g.. for my heat pump I was able to build the following dashboard:

HA dashboard

Labelling of the HW

Most likely your Viessmann device will stay around for a lot of time (many years hopefully), and so will do the SBC that connects it to your home automation platform. For this reason I suggest to provide some documentation for what is running on your SBC. A simple approach I like is to print a QR code pointing at this page and stick it physically on the SBC, to make it obvious to anybody inspecting it where to find the docs.

Here you can find a QR code I produced with the optimal miniQR code generator:

QRCode

Roadmap

I plan to add

  • Prometheus support to export health stats (errors on the Optolink interface, network errors, etc)

If you are looking for a specific feature, let me know by opening an issue.

  • Optolink Splitter: this is the original project that inspired this one

  • Optolink Bridge: inspired from the "Optolink Splitter"; requires you to own a VitoConnect device and allows you to setup a "man in the middle" device

  • openv vcontrold: seems abandoned but contains a C-based implementation of the VS1 and VS2 protocols apparently. Its wiki has plenty of details although in German

  • VitoWiFi: a C++ implementation of VS1 (KW) and VS2 (P300) Optolink protocols, for use on ESP microcontrollers but also Linux systems

  • FloorHeatingController: firmware for a controller of floor heating valves, to help replace physical thermostat with HomeAssistant virtual thermostats

Metadata

Release files for viessmann-optolink2mqtt 1.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for viessmann-optolink2mqtt 1.2.6
File Size Uploaded Provenance Actions
viessmann_optolink2mqtt-1.2.6.tar.gz 704.3 kB With provenance Details for viessmann_optolink2mqtt-1.2.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for viessmann-optolink2mqtt 1.2.6
File Interpreter ABI Platform Actions
viessmann_optolink2mqtt-1.2.6-py3-none-any.whl Python 3 none any Details for viessmann_optolink2mqtt-1.2.6-py3-none-any.whl

Total release size: 756.1 kB

Release files / viessmann_optolink2mqtt-1.2.6.tar.gz

Download URL viessmann_optolink2mqtt-1.2.6.tar.gz
Size 704.3 kB
Tags Source
SHA-256 checksum
How to use checksums
93984cbe74ca1153934ba21197cb06b465e6b7bb09bd783d29eebd519c71bee5
BLAKE2b-256 checksum
How to use checksums
c4509ae37d19aea9ab3e6dbfa9c04f51f5b395e3451b09ed52320905770451e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / viessmann_optolink2mqtt-1.2.6-py3-none-any.whl

Download URL viessmann_optolink2mqtt-1.2.6-py3-none-any.whl
Size 51.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33179ffb86ffcc2c2adad1d1b430100a100ed3e132d4ab4470acb604d72bc6b9
BLAKE2b-256 checksum
How to use checksums
9710652d91c066d457e01a8ed1a36c162ea4cf59867b9e68e6ac85b97c5af4c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for viessmann-optolink2mqtt 1.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for viessmann_optolink2mqtt-1.2.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page