tjhowse / modbus4mqtt

Modbus TCP <-> MQTT glue. YAML configuration. Robust.
Other
81 stars 35 forks source link

added support for JSON tree structures #48

Open tweidelt opened 1 year ago

tweidelt commented 1 year ago

This merge request extends modbus4mqtt to support nested JSON structures.

tweidelt commented 1 year ago

Example configuration:

[...]
registers:
  - json_key: "grid.power"
    pub_topic: "grid/em540"
    address: 40
    scale: 0.1
    type: "int32"
  - json_key: "grid.voltage"
    pub_topic: "grid/em540"
    address: 36
    scale: 0.1
    type: "int32"
  - json_key: "grid.energy_forward"
    pub_topic: "grid/em540"
    address: 52
    scale: 0.1
    type: "int32"
  - json_key: "grid.energy_reverse"
    pub_topic: "grid/em540"
    address: 78
    scale: 0.1
    type: "int32"

  - json_key: "grid.L1.power"
    pub_topic: "grid/em540"
    address: 18
    scale: 0.1
    type: "int32"
  - json_key: "grid.L1.voltage"
    pub_topic: "grid/em540"
    address: 0
    scale: 0.1
    type: "int32"
  - json_key: "grid.L1.current"
    pub_topic: "grid/em540"
    address: 12
    scale: 0.001
    type: "int32"
  - json_key: "grid.L1.energy_forward"
    pub_topic: "grid/em540"
    address: 64
    scale: 0.1
    type: "int32"
[...]