How geekcoding007/flexmodbus works
FlexModbus is a configurable Home Assistant integration for reading and writing user-selected Modbus TCP registers, including RTU framing over TCP. The main workflow is device setup, register definition (or YAML import), shared polling and decoding, then exposure as Sensor, Number, and Switch entities; writable entities send values back through the coordinator. The graph also preserves connection configuration and optional log filtering. Polling internals are sampled, while some flow and setup links rely on the excerpted-file reference index or README; unsampled platform details are not inferred.
Main entry points: __init__.py Entry setup · coordinator.py Polling coordinator · config_flow.py Config and options flow · register.py Register parsing and decoding
Components 14
Setup and Configuration
- Config and options flow
custom_components/flexmodbus/config_flow.py - YAML importer
custom_components/flexmodbus/yaml_import.py - Entry setup
custom_components/flexmodbus/__init__.py - Integration settings
custom_components/flexmodbus/const.py - Optional log filter
custom_components/flexmodbus/log_filter.py
Register Definitions
- Register parsing and decoding
custom_components/flexmodbus/register.py
Polling and Connection
- Polling coordinator
custom_components/flexmodbus/coordinator.py - TCP client factory
custom_components/flexmodbus/connection.py
Home Assistant Entities
- Sensor entities
custom_components/flexmodbus/sensor.py - Number entities
custom_components/flexmodbus/number.py - Switch entities
custom_components/flexmodbus/switch.py - Shared entity behavior
custom_components/flexmodbus/entity.py
Other components
- Home Assistant user
- Modbus device or gateway
Connections 22
- Home Assistant user → Config and options flow: configures device
README.md - Home Assistant user → Config and options flow: defines registers
README.md - Config and options flow → YAML importer: converts YAML
custom_components/flexmodbus/config_flow.py - YAML importer → Register parsing and decoding: validates registers
custom_components/flexmodbus/yaml_import.py - Config and options flow → Register parsing and decoding: parses register settings
custom_components/flexmodbus/config_flow.py - Entry setup → Register parsing and decoding: parses entry registers
custom_components/flexmodbus/__init__.py - Entry setup → TCP client factory: creates client
custom_components/flexmodbus/__init__.py - Entry setup → Polling coordinator: starts polling
custom_components/flexmodbus/__init__.py - Entry setup → Optional log filter: enables optionally
custom_components/flexmodbus/__init__.py - Polling coordinator → Modbus device or gateway: reads and writes registers
custom_components/flexmodbus/coordinator.py - Polling coordinator → Register parsing and decoding: decodes values
custom_components/flexmodbus/coordinator.py - Sensor entities → Shared entity behavior: inherits behavior
custom_components/flexmodbus/sensor.py - Number entities → Shared entity behavior: inherits behavior
custom_components/flexmodbus/number.py - Switch entities → Shared entity behavior: inherits behavior
custom_components/flexmodbus/switch.py - Sensor entities → Polling coordinator: uses runtime data
custom_components/flexmodbus/sensor.py - Number entities → Polling coordinator: reads and writes values
custom_components/flexmodbus/number.py - Switch entities → Polling coordinator: reads and writes values
custom_components/flexmodbus/switch.py - Entry setup → Sensor entities: forwards platform setup
custom_components/flexmodbus/__init__.py - Entry setup → Number entities: forwards platform setup
custom_components/flexmodbus/__init__.py - Entry setup → Switch entities: forwards platform setup
custom_components/flexmodbus/__init__.py - Config and options flow → Modbus device or gateway: tests connection
README.md - Integration settings → Register parsing and decoding: defines register options
custom_components/flexmodbus/register.py