openenergymonitor / emonhub

Python service linking and decoding input to MQTT & Emoncms
90 stars 83 forks source link

Minimalmodbus multiple meters #176

Closed glynhudson closed 2 years ago

glynhudson commented 2 years ago

Add support for reading from multiple modbus meters.

The required emonhub.conf interfacer format for Minimalmodbus should be as follows:

Single SDM120 Meter

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        [[[[meters]]]]
            [[[[[sdm120]]]]]
                address = 1
                registers = 0,6,12,18,30,70,72,74,76
                names = V,I,P,VA,PF,FR,EI,EE,RI
                precision = 2,3,1,1,3,3,3,3,3

Multiple SDM120 Meters

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        [[[[meters]]]]
            [[[[[sdm120a]]]]]
                address = 1
                registers = 0,6,12,18,30,70,72,74,76
                names = V,I,P,VA,PF,FR,EI,EE,RI
                precision = 2,3,1,1,3,3,3,3,3
            [[[[[sdm120b]]]]]
                address = 2
                registers = 0,6,12,18,30,70,72,74,76
                names = V,I,P,VA,PF,FR,EI,EE,RI
                precision = 2,3,1,1,3,3,3,3,3

Single Samsung ASHP

[[SAMSUNGASHP]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 9600
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = samsung-mib19n
        # prefix = sdm_
        [[[[meters]]]]
            [[[[[ashp]]]]]
                address = 1
                registers = 75,74,72,65,66,68,52,59,58,2,79
                names = dhw_temp,dhw_target,dhw_status,return_temp,flow_temp,flow_target,heating_status,indoor_temp,indoor_target, defrost_status, away_status
                scales = 0.1,0.1,1,0.1,0.1,0.1,1,0.1,0,1,1,1
                precision = 2,2,1,2,2,2,1,2,2,1,1

Note: in order to read from multiple meters each meter needs to have a unique modbus address and use the same baud rate and modbus data format

On the SDM120 the modbus address can be set via the push button LCD menu