Watch
1
0
Fork
You've already forked simplebus2-mqtt-bridge
0
mirror of https://github.com/Elektroarzt/simplebus2-mqtt-bridge.git synced 2026-08-04 12:15:02 +00:00
No description
  • HTML 96.5%
  • C++ 3.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-01 10:05:30 +02:00
hardware New pictures after redesign of housing 2024-04-02 12:58:58 +02:00
mechanics Added Housing for DIN Rail Mount 2025-03-11 10:53:22 +01:00
software docs: add Home Assistant entities screenshot to README 2026-08-01 10:02:01 +02:00
.gitignore Release firmware 2.0.0 with robust Simplebus2 decoder and PlatformIO layout 2026-08-01 08:54:47 +02:00
LICENSE Initial commit 2024-01-10 22:56:37 +01:00
README.md docs: display HA entities screenshot at half width 2026-08-01 10:05:25 +02:00

Simplebus2 MQTT Bridge stability-mature

Table of contents

1. Overview
2. Software
3. Hardware
4. Mechanics
5. Disclaimer
6. Credits

Overview

This project focuses on integrating Comelit intercom systems running the Simplebus2 protocol into a Smart Home, typically equipped with an MQTT broker for information exchange. The following functions have been implemented:

  • Doorbell signal main entrance
  • Doorbell signal apartment door
  • Opening main entrance door
  • Ring-to-Open (automatic opening)
  • Permanent web configuration UI (dark theme)
  • Home Assistant MQTT auto-discovery
  • Configurable MQTT topic prefix (default SimpleBus)
  • WiFi provisioning portal (first boot / factory reset)
  • Teach-in of intercom address
  • OTA updates (URL or file upload)

Current firmware: 2.0.0 — see software/docs/RELEASE-NOTES.md and the setup guide.

Bridge front Bridge front PCBA Bridge connector

Software

Build and flash (PlatformIO)

cd software
pio run                 # build
pio run -t upload       # flash via USB

Target: ESP32-C3 (esp32-c3-devkitm-1 / Seeed XIAO ESP32C3).

Pre-built binaries for v2.0.0:

File Use
software/firmware/simplebus2-firmware-2.0.0.bin OTA / app update (same settings version only — see upgrade note)
software/firmware/simplebus2-merged-2.0.0.bin Full flash from 0x0 (after erase)

First boot — WiFi

On first boot (or after factory reset) the bridge opens AP Simplebus2-Bridge (open network). Connect and open http://192.168.4.1/ to set home WiFi. After joining the LAN, open:

  • http://Simplebus2-Bridge.local/ or the device IP

Permanent web interface

Status, WiFi, MQTT (broker, credentials, topic prefix), device parameters (address, gain, threshold, Ring-to-Open duration), OTA, restart / factory reset:

Simplebus2-Bridge web UI

ESP32 WiFi is 2.4 GHz only. Prefer Chrome or Edge for OTA upload.

Hardware tuning

Gain and threshold (mV) adapt to cable length and bus loading. Gain ≈ OPV amplification; threshold = comparator level before the signal reaches the ESP32. Gain 20 / threshold 600 mV works well for ~20 m cable in tested installations. See also software/docs/tuning-process.md.

Ring-to-Open

Enable via MQTT (<prefix>/RingToOpen) or Home Assistant switch. Duration is set in the web UI or via <prefix>/SetRingToOpenTime (11440 minutes). Ring-to-Open only opens on Entry Door rings, not Floor Door. After a successful auto-open, RtO turns off.

Firmware update (OTA)

In the web UI: paste an HTTP URL to a .bin and OTA Flash, or upload simplebus2-firmware-2.0.0.bin via Upload & Flash. Within the same settings layout version, EEPROM is kept — see Upgrading from older firmware below.

Address adjustment

Each intercom unit has an 8-bit address (DIP switch S1, LSB). Example table:

Switch No. 1 2 3 4 5 6 7 8
Value 1 2 4 8 16 32 64 128
DIP switch panel

Teach-in: hold SW1 34 s (LED double-blink), then ring within 3 minutes — or use MQTT StartTeachIn / set address in the web UI.

MQTT data structure

Default topic prefix: SimpleBus (configurable). Change in the web UI if you prefer another root.

Published topics

Topic Values Notes
<prefix>/FloorDoor ON bell rings on floor door of apartment
<prefix>/EntryDoor ON bell rings on entry door of building
<prefix>/RingToOpenStatus ON / OFF Ring-to-Open active or off (retained)
<prefix>/RingToOpenOpened ON door opened via Ring-to-Open
<prefix>/RingToOpenTime minutes current RtO duration (retained)
<prefix>/Heartbeat ON every 5 min
<prefix>/availability online published on connect

Subscribed topics

Topic Values Notes
<prefix>/OpenDoor ON open the door
<prefix>/RingToOpen ON / OFF / min enable RtO (optional duration)
<prefix>/SetRingToOpenTime 1 … 1440 set RtO duration in minutes
<prefix>/SetGain 2 … 40 amplifier gain (default 20)
<prefix>/SetComparatorVoltage 100 … 1500 threshold mV (default 600)
<prefix>/StartConfigMode ON start WiFi AP portal
<prefix>/StartTeachIn ON / OFF teach-in / cancel
<prefix>/Restart ON restart ESP32

Home Assistant

On MQTT connect the bridge publishes MQTT discovery. Entities appear under device Simplebus2 Bridge (Entry/Floor doorbell, Open Door button, Ring-to-Open switch & duration, etc.). Details: software/docs/SETUP-GUIDE.md.

Home Assistant entities

Highlights vs previous public firmware

  • Robust Simplebus2 bus decoder — state machine + ISR ring buffer, tighter timing, longer duplicate window (fixes double publish / false positives); see RELEASE-NOTES
  • Permanent web UI, configurable MQTT prefix (default still SimpleBus), HA MQTT discovery, safer ESP32-C3 restart (safeRestart / GPIO9)

Upgrading from older firmware (previous public sketch)

Device settings in EEPROM are not migrated. The old firmware stored MQTT/broker/gain/address without a settings-version header; this release uses a new Settings layout (SETTINGS_VERSION = 3). On first boot after the upgrade the bridge detects a version mismatch, wipes those EEPROM fields, and loads factory defaults.

Data Survives upgrade?
WiFi SSID / password (WiFiManager NVS) Usually yes
MQTT broker, user, password No — re-enter
Topic prefix No — defaults to SimpleBus
Intercom address, gain, threshold No — re-enter
Ring-to-Open duration / automation flag No — re-enter

After flashing, open the web UI (http://Simplebus2-Bridge.local/ or the device IP) and re-enter MQTT + device parameters. Have your previous values ready before you update.

Breaking changes (previous public firmware → 2.0.0)

  • EEPROM layout incompatible — MQTT and device settings must be re-entered (see above)
  • WiFi AP name Config_MQTT_SimpleBus_2 / Config_MQTT_SimpleBus2Simplebus2-Bridge
  • Configuration primarily via permanent web UI (not only WiFiManager menus)

Dependencies (PlatformIO)

Component Version Notes
PubSubClient ^2.8 lib_deps
WiFiManager ^2.0.17 lib_deps
Debounce local software/lib/Debounce
EEPROM, WiFi, Wire, WebServer, HTTPUpdate Arduino-ESP32 framework

Issue fixes in 2.0.0

  • Correct comparison in writeMessageToIntercom (msgCode == MSG_OPEN_DOOR) — fixes #13
  • structInitialized() uses strlen / settings version instead of sizeof on char arrays — #13
  • HA discovery / availability and RingToOpenTime sync — see release notes

Hardware

The electronics draw power from the bus voltage and require no additional power source. A Seeed Studio XIAO ESP32C3 serves as the controller board.

schematics V2 2

Expansion pin header J2

For future use this pin header can connect to a piggy-back. The M2.5 hole in the neighborhood can be used to secure a sandwich PCBA.

Signal Name Pin Notes
D6 1 GPIO 21 of ESP32 (D6 of XIAO module pinout)
3V3 2 directly connected to 3.3V plane
D3 3 GPIO 5 of ESP32 (D3 of XIAO module pinout, outputs PWM signal at boot, strapping pin)
GND 4 directly connected to GND plane

Debug pin header J3

Meant for debugging, header can be populated optionally. The following signals can be measured against GND:

Signal Name Pin Notes
D1 1 voltage divider 1, reference voltage of OPV filter stage 1 ('gain' parameter)
S2 2 cleaned payload signal of Simplebus2
D2 3 voltage divider 2, reference voltage of comparator ('level' parameter)
GND 4 directly connected to GND plane

Filter

In the schematics two filters can be found, one low pass (C5 and R5) and one high pass sallen key active filter with a gain of 2. Between those two filters there is signal amplifier which can be set individually to compensate for a long bus wire. The goal is to filter and amplify the incoming 25 kHz signal.

R1 and R11 are alternative positions to select signal conditioning by hardware (comparator U6) or direct input of the signal into the ESP32. In the second case the firmware should do the signal conditioning via DSP routines or similar. At the moment the DSP option is not implemented in the firmware and is meant for future use, so option "OPV" is default. To change this, desolder R11 and close R1 with a solder drop or a 0Ohms resistor.

Printed Circuit Board (PCB)

The PCB was designed with KiCAD using through-hole technology (THT) and surface-mount device technology (SMD) to match the limited space requirements. Top layer is 3,3V plane and bottom is GND plane. If someone is interested in a complete bridge including all parts (PCBA, ESP32, housing, etc.) you can contact me under elektroarzt@digital-filestore.de.

PCB Layout front

Mechanics

The entire electronics assembly fits into a flush-mounted switch box, resulting in a streamlined enclosure. The latch was designed as a snap closure, eliminating the need for additional mechanical components beyond the housing shells.

image

A second option for the housing is a DIN rail enclosure. For this, I have created an alternative bottom shell with a builtin clip that can be directly clicked onto a DIN rail. It should not be printed in PLA, use a somewhat flexible filament like PETG. Otherwise, there is a risk of cracking the clip if released from the DIN rail again. The top part of the housing is identical to the flush-mounted version.

Bottom DIN Rail Mount Bottom DIN Rail Mount

Antenna

The antenna is mounted inside the housing with adhesive tape. A small cable channel exists for the antenna cable within the housing. Be careful while inserting the PCB in the housing not to shear off the antenna cable if it is not inserted properly into the cable channel.

Bridge Antenna

USB connector

The USB-C socket is externally routed, allowing for easy firmware updates.

LED and button

The onboard LED features a simple light guide, making it visible externally when the housing is closed. The onboard button is operated with a small axis embedded in the housing.

Housing

The housing was designed in Autodesk Fusion 360 and 3D-printed in three colors on Bambu Lab P1S printer:

  • LED diffuser: transparent filament
  • Housing: black filament
  • Labeling: white filament
image

For the type of filament every material is suitable that has low stringing tendency. PETG works for me without needing supports. 0.2mm layer height does a good job on a 0.4mm standard nozzle.

Bambu Lab project

Disclaimer

⚠️ WARNING: You may only USE THIS PROJECT AT YOUR OWN RISK. The information provided is meant to be helpful but may contain errors or may be misinterpreted. Neither myself nor any of the contributors to this project provide any warranty or will assume any responsibility for any damage you cause yourself or others by using this project.

Credits

The project originated from the excellent foundational work on the Simplebus2 protocol by plusvic. These fundamentals will not be reiterated and can be found here.