EmonHub: Automatic serial device detection for MBUS and Modbus interfacers

Version 2.7.1 of emonHub now has the ability to automatically detect the right serial port for connected MBUS and Modbus devices (EmonHubMBUSInterfacer and EmonHubMinimalModbusInterfacer interfacers).

This makes configuration of Level 3 heat pump monitors easier and is designed to fix an issue where sometimes a device jumps on to another serial port e.g changing from ttyUSB0 to ttyUSB1.

The following emonhub.conf configuration options are now valid:

Wildcard filter:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB*
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = heatpump
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = standard

Vendor and product ID filters:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device_vid = 1659
        device_pid = 9123
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = heatpump
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = standard

Can also be used with a wildcard filter:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB*
        device_vid = 1659
        device_pid = 9123
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = heatpump
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = standard

and of course the conventional specific reference is also fine:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = heatpump
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = standard

and the symbolic link option:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller_BPBNb13AL20-if00-port0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        validate_checksum = False
        nodename = heatpump
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = standard
2 Likes

Great stuff, I’ve added this info to the emonHub docs: https://docs.openenergymonitor.org/emonhub/default-configuration.html#usb0

I note this statement by @TrystanLea

And the docs

The statement suggests the wildcard is only valid for those 2 specific interfacers.

Have the options been added to the info in the Interfacer file itself as well?