Repository navigation
Architecture and internals
This page is the developer-oriented technical reference for the SAMSON TROVIS 557x Home Assistant integration.
It explains how the Home Assistant integration, the trovis-modbus device
library, modbus-connection, and the selected Modbus backend fit together; how a
controller is discovered and represented; and where new functionality should be
implemented.
Note
This page documents the integration boundary and Home Assistant architecture.
Detailed TROVIS device-model internals are maintained in the
trovis-modbus wiki
so the same controller knowledge is not documented twice.
The important boundaries in the following dependency chart are:
-
Home Assistantknows how devices and entities are presented and handled. -
trovis-modbus-hassknows how TROVIS data become HA devices and entities. -
trovis-modbusknows what each TROVIS register and coil means ("the data"). -
modbus-connectionknows how Modbus access is abstracted and streamlined. -
tmodbusknows how the actual Modbus communication is performed.
No Home Assistant entity should need to know a TROVIS register address, and no TROVIS datapoint should need to know whether Home Assistant is talking through Modbus TCP to a gateway, RTU over TCP, a remote serial proxy, or a directly attached serial device.
flowchart TD
%%{init: {"themeCSS": ".edgeLabel, .edgeLabel p { font-size: 12px !important; line-height: 1.2 !important; background-color: transparent !important; } .labelBkg { background-color: transparent !important; } .edgeLabel rect { fill: transparent !important; opacity: 0 !important; }"}}%%
HA["Home Assistant
devices, entities, config entries"]
HASS["trovis-modbus-hass
TROVIS integration"]
LIB["trovis-modbus
TROVIS device library"]
subgraph MC["modbus-connection"]
MODEL["model framework"]
UNIT["ModbusUnit
backend-neutral API"]
ADAPTER["tmodbus adapter modbus_connection.tmodbus"]
MODEL --> UNIT
ADAPTER --> UNIT
end
TM["tmodbus
Modbus backend"]
SERIALX["serialx
serial transport"]
TCPGW["Modbus TCP ↔ RTU gateway"]
REMOTE["Remote serial bridge"]
LOCAL["Local serial interface / adapter"]
TROVIS["TROVIS controller
(Modbus RTU)"]
HA --> HASS
HASS --> LIB
LIB --> MODEL
LIB --> UNIT
HASS --> ADAPTER
ADAPTER --> TM
TM --> TCPGW
TM --> SERIALX
SERIALX --> REMOTE
SERIALX --> LOCAL
TCPGW -->|"Modbus RTU"| TROVIS
REMOTE -->|"Modbus RTU"| TROVIS
LOCAL -->|"Modbus RTU"| TROVIS
|
Repository: https://github.com/Tom-Bom-badil/trovis-modbus-hass This is the Home Assistant integration. It owns:
It should not own:
|
Repository: https://github.com/Tom-Bom-badil/trovis-modbus This is the backend-neutral TROVIS device library and the authoritative source for controller-specific knowledge. It owns:
It does not own:
The library receives a That dependency direction is intentional: The same TROVIS model can therefore be used by Home Assistant, the command-line query tool, automated tests, or another application without changing the controller model. |
|
Repository: https://github.com/home-assistant-libs/modbus-connection Documentation: https://home-assistant-libs.github.io/modbus-connection/
Its most important concepts for this project are:
A physical Modbus connection can address multiple unit IDs. A unit = connection.for_unit(unit_id)
device = Trovis557x(unit, ...)
This is the key abstraction that keeps the TROVIS device model independent from |
|
|
Home Assistant currently uses the
It supports, among other transports relevant here:
Its asynchronous serial support uses The TROVIS library itself does not import or depend on |
For this project it is relevant for:
The important distinction is that these remain serial Modbus RTU connections. Only the serial transport is remote. |
Tip
If you are adapting another Home Assistant Modbus integration, this is the
reusable pattern to look for: keep the device model behind ModbusUnit, let
the integration create the connection from backend-neutral parameters, and
avoid teaching the device model about tmodbus, pymodbus, sockets, or serial
transports.
TROVIS controllers are a good example of why a separate connection abstraction is valuable.
The project has to support different physical paths:
Modbus TCP to a TCP↔RTU gateway
RTU over TCP using the Network connection path
remote Modbus RTU through socket://
remote Modbus RTU through ESPHome
local Modbus RTU
The controller model should not contain branches such as:
if tcp:
...
elif socket_serial:
...
elif esphome:
...Instead, all transport-specific work ends before the device model is constructed:
connection settings
│
▼
concrete ModbusConnection
│
▼
connection.for_unit(246)
│
▼
ModbusUnit
│
▼
Trovis557x
From that point onward, the TROVIS code sees the same interface for every transport.
This also makes the backend replaceable:
| Consumer | Concrete backend |
|---|---|
| Home Assistant integration | tmodbus |
trovis-modbus command-line query tool |
normally pymodbus
|
| Library tests | in-memory/mock ModbusUnit
|
| Future consumers | any implementation compatible with ModbusUnit
|
That split is deliberate. A change in the Home Assistant transport stack should not require changes to register definitions, hydronic configurations, or entity logic.
The Home Assistant integration deliberately does not reproduce the TROVIS controller model internally.
trovis-modbus is responsible for resolving the controller-side structure,
including controller profiles, hydronic system information, Rk roles, physical
sensor/input assignments, available subsystems, datapoint metadata, and the
rules required to read or write those datapoints safely.
The integration consumes that model and decides how it should appear in Home Assistant.
For integration development, the important rule is:
If a fact describes the TROVIS controller itself and would still be true in a command-line application without Home Assistant, it belongs in
trovis-modbus.
The detailed model is documented in the library wiki:
Use this table before adding controller logic to the Home Assistant layer.
| Change | Correct project/layer |
|---|---|
| New TROVIS register or coil | trovis-modbus |
| Address conversion rule | trovis-modbus |
| New supported controller model | trovis-modbus |
| Hydronic system / Rk role | trovis-modbus |
| Sensor/input resolver | trovis-modbus |
| Numeric range, step, scale or unit | trovis-modbus |
| Enum values | trovis-modbus |
| TROVIS write precondition | trovis-modbus |
| Generic Modbus field type | modbus-connection |
| Generic read-planning behavior | modbus-connection |
| Generic Modbus exception model | modbus-connection |
tmodbus protocol/backend behavior |
tmodbus |
| Serial transport behavior |
serialx / backend |
| HA config-flow field | trovis-modbus-hass |
| HA device or entity mapping | trovis-modbus-hass |
| Entity availability/gating from library metadata | trovis-modbus-hass |
| Translation | trovis-modbus-hass |
| Coordinator behavior | trovis-modbus-hass |
| HA write-access UI gate | trovis-modbus-hass |
A useful rule of thumb:
If the rule would still be true in a command-line application with no Home Assistant installed, it probably belongs in
trovis-modbus.
The overview above is deliberately kept short. Details live on one dedicated page per topic:
-
Connections-and-transports — connection types,
modbus-connection,tmodbus, connection ownership and dependency strategy - Config-flow-and-reconfiguration — initial setup, probing, config entries and reconfiguration
- Coordinator-and-runtime-updates — polling, availability, communication errors and recovery
- Devices-and-entities — how the controller model becomes Home Assistant devices and entities
- Writing-and-write-access — the Home Assistant write path and the Write access safety gate
- Development-and-Testing — local development, automated tests and live hardware verification
For the controller-side model itself, use the
trovis-modbus wiki.
Useful modbus-connection references for developers moving another integration
to the same architecture:
The project should remain easy to reason about even as the Modbus transport architecture evolves.
The stable center is:
TROVIS knowledge
│
▼
trovis-modbus
│
▼
ModbusUnit
Everything below ModbusUnit may evolve with the Modbus ecosystem.
Everything above it may evolve with Home Assistant.
The controller model should not need to care about either.
Disclaimer: Any information on this wiki is informal advice only. It is not supported nor endorsed by Samson, Sauter, YADOS, Pewo or any other equipment maker or OEM. There is no warranty expressed or implied: you take sole responsibility for everything you do with your heating controller.
-
Wozu dieses Projekt?
What is this project about?
-
Wie funktioniert das?
How does it work?
- Was wird benötigt? Kosten?
What's required? Costs?
- Supported controllers
- Connecting your TROVIS
- Installation and setup
- Current limits and migration
- Troubleshooting
- Architecture and internals
- Connections and transports
- Config flow and reconfiguration
- Coordinator and runtime updates
- Devices and entities
- Writing and write access
- Development and testing
- LAN/WLAN
USR-TCP232-T2, USR-TCP232-410S, USR-K7, USR-DR301 (Hutschiene), Elfin-EE10 (WLAN) - USB
AZDelivery FT232RL, Waveshare USB 2 RS232/485/TTL - ESP
ESP-01, Wemos D1 - SPS
S7 1200, Wago 750-889 - KNX
Masifi Modbus Gateway
- Edomi
- espHome/HomeAssitant
- FHEM
- HomeAssistant
- ioBroker
- KNX
- Loxone
- NodeRed
- openHAB
- SIMATIC Step7
- smarthomeNG
- Tasmota/MQTT
- Wago CODESYS
Wiki - Start