How martinstafford/daikin_d3net works
1. What this repository is
- A Home Assistant custom integration for Daikin DIII-Net systems, specifically the DTA116A51 DIII-Net/Modbus adapter.
- It sits between Home Assistant and a Daikin HVAC bus, translating Home Assistant entity actions and state updates into Modbus traffic.
2. Top-level architecture
- The repo is split into two main layers:
- custom_components/daikin_d3net/: Home Assistant integration code.
- custom_components/daikin_d3net/d3net/: protocol and gateway logic for talking to the Daikin/Modbus adapter.
- This separation is important: Home Assistant concerns stay in the entity/config modules, while bus communication and encoding live in the d3net subpackage.
3. Home Assistant integration entrypoints
- __init__.py is the integration bootstrap point.
- config_flow.py handles UI-based setup in Home Assistant, so the integration is configured through the frontend rather than static YAML.
- manifest.json defines the integration metadata, dependencies, and runtime identity used by Home Assistant.
4. Core protocol layer
- d3net/gateway.py is the likely central communication abstraction for talking to the adapter and enumerating devices on the DIII-Net bus.
- d3net/encoding.py handles protocol-specific conversion between Modbus/register values and Daikin DIII-Net concepts.
- d3net/const.py holds low-level protocol constants shared by the gateway and encoding logic.
5. External hardware boundary
- The external system is a Daikin HVAC installation on DIII-Net, accessed through a DTA116A51 adapter and a Modbus gateway.
- The README states support for:
- Modbus TCP
- Modbus RTU over TCP
- The integration does not claim support for hot water functions, and the DCPA01 is explicitly not supported.
6. Entity model exposed to Home Assistant
- The integration exposes multiple Home Assistant entity platforms:
- climate.py for the main HVAC control/state entity per unit
- sensor.py for telemetry/read-only values
- binary_sensor.py for boolean status flags
- switch.py for on/off controls
- select.py for mode/preset-style discrete choices
- number.py for numeric settings
- button.py for one-shot actions
- This indicates a fairly rich device model, not just a single thermostat entity.
7. Data flow through the integration
- Home Assistant starts the integration and loads configuration.
- The integration creates a gateway connection to the DTA116A51/Modbus side.
- The gateway enumerates units attached to the DIII-Net bus.
- Entity platforms then expose each discovered unit as Home Assistant entities and use the shared gateway/protocol layer to read or update state.
8. Primary exposed device concept
- The README says it “enumerates units attached to DIII-Net bus” and “provides Climate entities for each.”
- That suggests the climate entity is the canonical representation of each HVAC unit, with the other platforms layering additional controls and telemetry around it.
9. Localization and UX support
- strings.json and translations/en.json provide Home Assistant UI text and translations.
- This matters architecturally because the integration is meant to be installed and configured interactively inside Home Assistant, not as a low-level library.
10. Packaging and distribution
- hacs.json shows it is designed for HACS distribution as a custom repository.
- .github/workflows/validate.yml and release.yml indicate CI for validation and release packaging, which is typical for Home Assistant custom integrations.
11. Hardware/documentation boundary
- hardware.md and the images folder document a DIY hardware implementation and show integration/device screenshots.
- These are supporting materials rather than runtime components, but they clarify that the repo’s runtime boundary ends at the adapter and HVAC network.
12. How to draw the architecture
- Draw Home Assistant as the host.
- Inside it, place the daikin_d3net integration with config flow, entity platforms, and shared constants.
- Behind that, place the d3net protocol/gateway layer.
- Outside the integration boundary, place the DTA116A51 adapter / Modbus TCP or RTU-over-TCP gateway, then the Daikin DIII-Net bus with attached HVAC units.
Main entry points: __init__.py Bootstrap · gateway.py Gateway · climate.py Climate · sensor.py Sensors
Components 18
Home Assistant integration
Entry points, setup, and entity platforms exposed to Home Assistant.
- Bootstrap · Loads the integration and wires Home Assistant lifecycle hooks.
custom_components/daikin_d3net/__init__.py - Setup flow · Frontend configuration flow used to create and manage the integration.
custom_components/daikin_d3net/config_flow.py - Climate · Canonical HVAC control and state entity for each discovered unit.
custom_components/daikin_d3net/climate.py - Sensors · Read-only measurements and status values exposed to Home Assistant.
custom_components/daikin_d3net/sensor.py - Binary sensors · Boolean flags representing device and system states.
custom_components/daikin_d3net/binary_sensor.py - Switches · On/off controls for supported device functions.
custom_components/daikin_d3net/switch.py - Selects · Mode and preset style choice entities.
custom_components/daikin_d3net/select.py - Numbers · Numeric settings exposed as adjustable entities.
custom_components/daikin_d3net/number.py - Buttons · One-shot actions such as commands or maintenance operations.
custom_components/daikin_d3net/button.py - Integration consts · Shared integration identifiers and configuration constants.
custom_components/daikin_d3net/const.py
D3-Net protocol
Shared gateway and encoding logic for the Daikin/Modbus adapter.
- Gateway · Connects to the adapter, discovers units, and mediates read/write traffic.
custom_components/daikin_d3net/d3net/gateway.py - Encoding · Converts between Modbus register data and Daikin DIII-Net values.
custom_components/daikin_d3net/d3net/encoding.py - Proto consts · Low-level protocol values shared across gateway and encoding layers.
custom_components/daikin_d3net/d3net/const.py
External hardware
Adapter, bus, and HVAC units outside the integration boundary.
- DTA116A51 · External Daikin DIII-Net to Modbus adapter used as the hardware boundary.
- DIII-Net bus · Daikin bus carrying commands and state for attached equipment.
- HVAC units · Attached Daikin indoor/outdoor units exposed to Home Assistant.
Connections 25
- Bootstrap → Setup flow: setup · Bootstrapped integration exposes frontend configuration.
- Bootstrap → Climate: loads · Initializes the climate platform and other entities.
- Bootstrap → Sensors: loads · Initializes telemetry entities.
- Bootstrap → Binary sensors: loads · Initializes boolean status entities.
- Bootstrap → Switches: loads · Initializes switch entities.
- Bootstrap → Selects: loads · Initializes select entities.
- Bootstrap → Numbers: loads · Initializes number entities.
- Bootstrap → Buttons: loads · Initializes button entities.
- Bootstrap → Gateway: connects · Creates the shared gateway used by all platforms.
- Bootstrap → Integration consts: uses · Uses integration constants and identifiers.
- Bootstrap → UI text: publishes · Exposes localized UI strings to Home Assistant.
- Climate → Gateway: reads/writes · Primary entity exchanges state and commands through the gateway.
- Sensors → Gateway: reads · Telemetry entities query device state through the gateway.
- Binary sensors → Gateway: reads · Status flags are derived from gateway state.
- Switches → Gateway: writes · Switch actions are translated into gateway commands.
- Selects → Gateway: writes · Discrete choices map to protocol updates.
- Numbers → Gateway: writes · Numeric adjustments propagate through the gateway.
- Buttons → Gateway: acts · One-shot actions invoke gateway operations.
- Gateway → Encoding: encodes · Gateway relies on the codec for register and value translation.
- Gateway → Proto consts: uses · Gateway consumes shared protocol constants.
- Encoding → Proto consts: uses · Codec uses shared low-level protocol values.
- Gateway → DTA116A51: modbus · Gateway communicates with the external adapter over Modbus.
- DTA116A51 → DIII-Net bus: bridges · Adapter bridges Modbus traffic onto the Daikin field bus.
- DIII-Net bus → HVAC units: connects · Bus carries data to and from attached HVAC units.
- CI/CD → Bootstrap: validates · CI validates integration structure and packaging.