Export Modbus Poll tags to Home Assistant
Home Assistant reads Modbus devices from YAML. The addresses, data types and word order are the part that goes wrong by hand. Export to SCADA writes a modbus: block from your Modbus Poll blocks, so you take values you have already checked and move them into Home Assistant.
Availability. Export to SCADA was added to the Modbus Poll and BACnet Explorer source after Modbus Poll 1.3.5 and BACnet Explorer 1.2.1 were prepared. It is in the open source repository on GitHub and ships with the next app update; if you do not see the button in the app yet, you are on a build from before that update. It needs Pro.
1. Export from Modbus Poll
- Add the blocks and connect to confirm the values.
- Click Export to SCADA (Pro) and choose Home Assistant (YAML).
- The device name becomes the hub name, lower-cased with underscores. Click Save file.
2. Merge it into configuration.yaml
Copy the modbus: block into your configuration.yaml. If you already have a modbus: key, add the hub as another list item under it. Check the configuration in Developer tools, then restart Home Assistant.
What the file contains
modbus:
- name: "pm5560_meter"
type: tcp
host: "192.168.1.50"
port: 502
timeout: 5
sensors:
- name: "Voltage_3000"
unique_id: "pm5560_meter_voltage_3000"
address: 3000
device_address: 3
input_type: holding
data_type: float32
precision: 3
scan_interval: 1
unit_of_measurement: "V"
binary_sensors:
- name: "Run_state_0"
address: 0
device_address: 3
input_type: coil
Home Assistant counts addresses from 0, the same as Modbus Poll, so the numbers are copied as they are. Holding and input registers become sensors. Coils and discrete inputs become binary sensors. The poll interval is rounded up to whole seconds, which is what scan_interval accepts.
Data types and word order
| Modbus Poll | Home Assistant |
|---|---|
| int16, uint16, int32, float32, float64 | data_type of the same name |
| AB CD (default) | no swap |
| CD AB | swap: word |
| BA DC | swap: byte |
Floats get precision: 3. Home Assistant rounds to whole numbers by default, which would turn 230.5 volts into 230. A scale other than 1 is written as scale and the precision follows its decimals.
Starting from a manual
If you are setting up Home Assistant for a solar inverter or battery, the register map library has blocks files that import into Modbus Poll, so you can check the values before exporting. Inverters: Growatt, Solis, SolaX, Kostal and Fronius. Storage and system data: Victron GX and JK BMS.
Check the connection
Open Settings, Connectivity, Modbus to see whether the hub is connected. If an entity shows as unavailable, compare its address and input type with the same block in Modbus Poll.
Limits
- Writable registers and coils are exported as read-only sensors. Add a switch or number entity by hand if you need to write.
- For RTU, the file has a
type: serialhub. Set the serial port to the one on the Home Assistant machine.
Export your Modbus Poll tags to a SCADA
Read the registers you care about in Modbus Poll, then use Export to SCADA in the blocks panel (Pro) to write the tag list for Ignition, Kepware, Node-RED, RustRED, Home Assistant or Voltrus SCADA.
Get Modbus Poll