Connecting to 2 Eastron SDM120 Modbus Meters

If I may jump in, I too can’t see the two Eastron SDM120M meters I’ve connected to monitor my heat pump and heat battery. I’ve got an EmonPi and the meters are plugged through the RS485 adapters into the two black USB ports.
I’ve added the code listed here:
https://docs.openenergymonitor.org/emonhub/emonhub-interfacers.html#modbus-electric-meters
into the config file.
I just don’t see the two devices in the Input list. Nothing. I’ve checked A to A, B to B… I’ve even disconnected G because the picture only shows the two connections. So I’m stuck. I presume it could be the address…
What have I done wrong? I’m sure it’s something utterly basic. And I have restarted multiple times. One thing to note is that since plugging them in my temperature sensors have got scrambled. Which is kind of annoying.

Andrea

I think @TrystanLea mentioned in another thread on modbus with multiple devices the need to manually set the second device’s ID. He also suggested connecting one device at a time iirc.

PS The device IDs are set to 1, so get the first working and change it to 2. Then add the second as 1.

Phil

When I take the plunge and buy hardware I will be connecting to my Midea ASHP. Depending on whether I learn how to read a cloud api I may add the electric meter.

Phil

This is likely to be an emonhub issue (this is the part of the system that reads this data and passes it on to emoncms).

In the webUI click on ‘emonhub’ and then ‘restart’ at the top right.

Copy and paste the log at startup here (use Ctl-E and just paste).

Hello. Thanks for the advice. I tried deleting one of the meters from config file and then restarted. Nothing appears in the inputs list. This is the log - I can see that there’s an issue with the SDM120.

2023-04-11 07:47:51,694 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.2.6
2023-04-11 07:47:51,695 INFO     MainThread Opening hub...
2023-04-11 07:47:51,695 INFO     MainThread Logging level set to DEBUG
2023-04-11 07:47:51,695 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi'
2023-04-11 07:47:51,696 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2023-04-11 07:47:53,706 INFO     MainThread RFM2Pi device firmware version: [emonPi.29.20]
2023-04-11 07:47:53,707 INFO     MainThread RFM2Pi device current settings:  E i5 g210 @ 433 MHz q1 USA 0 
2023-04-11 07:47:53,708 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2023-04-11 07:47:54,709 DEBUG    MainThread Setting RFM2Pi pubchannels: ['ToEmonCMS']
2023-04-11 07:47:54,710 DEBUG    MainThread Setting RFM2Pi subchannels: ['ToRFM12']
2023-04-11 07:47:54,711 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2023-04-11 07:47:54,714 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2023-04-11 07:47:54,715 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2023-04-11 07:47:54,715 INFO     MainThread Setting MQTT node_format_enable: 1
2023-04-11 07:47:54,716 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2023-04-11 07:47:54,716 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2023-04-11 07:47:54,717 INFO     MainThread Setting MQTT node_JSON_enable: 0
2023-04-11 07:47:54,718 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2023-04-11 07:47:54,719 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2023-04-11 07:47:54,719 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2023-04-11 07:47:54,720 INFO     MainThread Setting emoncmsorg apikey: set
2023-04-11 07:47:54,720 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2023-04-11 07:47:54,720 INFO     MainThread Setting emoncmsorg senddata: 1
2023-04-11 07:47:54,721 INFO     MainThread Setting emoncmsorg sendstatus: 1
2023-04-11 07:47:54,722 INFO     MainThread Creating EmonHubMinimalModbusInterfacer 'SDM120'
2023-04-11 07:47:54,734 INFO     MainThread Connecting to Modbus device=/dev/ttyUSB0 baud=2400
2023-04-11 07:47:54,735 DEBUG    RFM2Pi     device settings updated: E i5 g210 @ 433 MHz q1 USA 0
2023-04-11 07:47:54,745 INFO     MainThread Setting SDM120 read_interval: 10
2023-04-11 07:47:54,745 INFO     MainThread Setting SDM120 nodename: sdm120
2023-04-11 07:47:54,746 INFO     MainThread Setting SDM120 prefix: 
2023-04-11 07:47:54,746 ERROR    MainThread Unable to create 'SDM120' interfacer: sequence item 0: expected str instance, int found

I haven’t got any kit yet, so you are miles ahead of me! I’m just researching which way to go: HomeAssistant or emonCMS.

Phil

Please use Ctl-E as asked so it formats the log correctly.

Please post all of the Interfacers section of the emonhub configuration (using Ctl-E to format)

Ah! Oops. Apologies. This time I hope I’ve pasted correctly.

### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
        com_baud = 38400                        # 9600 for old RFM12Pi
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        subchannels = ToRFM12,

        group = 210
        frequency = 433
        baseid = 5                              # emonPi / emonBase nodeID
        calibration = 230V                      # (UK/EU: 230V, US: 110V)
        quiet = true                            # Disable quite mode (default enabled) to enable RF packet debugging, show packets which fail crc
        # interval =  300                         # Interval to transmit time to emonGLCD (seconds)


[[MQTT]]

    Type = EmonHubMqttInterfacer
    [[[init_settings]]]
        mqtt_host = 127.0.0.1
        mqtt_port = 1883
        mqtt_user = emonpi
        mqtt_passwd = emonpimqtt2016

    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,

        # emonhub/rx/10/values format
        # Use with emoncms Nodes module
        node_format_enable = 1
        node_format_basetopic = emonhub/

        # emon/emontx/power1 format - use with Emoncms MQTT input
        # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
        nodevar_format_enable = 1
        nodevar_format_basetopic = emon/

        # Single JSON payload published  - use with Emoncms MQTT
        node_JSON_enable = 0
        node_JSON_basetopic = emon/

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey = xxxxxxx
        senddata = 1                    # Enable sending data to Emoncms.org
        sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 30                # Bulk send interval to Emoncms.org in seconds

[[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

Yes perfect :slight_smile:

Take care not to post your API Key (it was part of the config - I have edited it out).

I think this should be 9600 (from other posts I do not have one).

Also check this really is the right serial interface.

Thanks for saving me from myself. :smile:

Still nothing. I may well have the wrong USB socket but I don’t know how they are addressed/which is which and where to set that in the config file. There are two blue ones and two black ones… I have tried connecting only one and moving it between ports shutting down each time, but nothing shows up in the Inputs. utterly baffled.

Just to add from the log, this is the line which reports there error:

Unable to create ‘SDM120’ interfacer: sequence item 0: expected str instance, int found

Does anyone know what i can do about this?

Forum user Nick Ireland had an issue that threw the same error code.

In that particular instance, it turned out to be the data rate setting.

Ref:

It looks like the ‘stable’ branch has not been updated in a while @TrystanLea

In the WebUI, the Admin menu, select components

image

Scroll down to the bottom, and next to emonhub select the master branch from the dropdown. I think it switches immediately. To check then click update

[edit]
It is a small change so possibly not the cause.

Can you confirm the baud is 9600 and you restarted emonhub after changing it?

[edit2]
In fact if you have moved the USB around, restart the emopnPi instead.

Ok. Now I’ve got bigger problems.
I did the update, powered down the emonpi. As I powered it back up it seemed to switch on and off a few times. And now although as it powers up it sayd 2 CTs detected and 5 DB18B20 there is no data feeding through. I communicated with me but alll the inputs are now NULL.
And the Admin panel says that emonHub: emonhub: Activating loaded activating auto-restart
but there’s a blue circle beside it and pressing Start or Enable doesn’t help.

Now in a deeper hole than before.
I think I need an exorcist. :grinning:

Andrea

I think your reply should be pointed at @borpin. It was he who spoke of an update, not me.

I suggested the data rate setting might be the cause. Brian did ask for a confirmation WRT
the data rate. Is it set to 9600? Until we know for sure what it’s set at, helping you is problematic
at best.

Just switched the branch?

First try switching it back to stable.

If that doesn’t work, try a full emoncms update (from the update tab).

At the end of the update, the window disappears. If you click
image
again, it will reappear briefly.

Please download the update log, and then post that here.

You only need to use one RS485 adapter, both SDM120 meters should be connected to the same RS485 modbus USB adapter.

By default, the Modbus IDs are set to 1, therefore you need to set the modbus ID on the 2nd meter to 2. This can be done via the LCD menu, see the SDM120 user guide.

The baud rate of 2400 is definitely the default for SDM120, or at least it has been for the few hundred SDM120s that I’ve setup:

https://docs.openenergymonitor.org/emonhub/emonhub-interfacers.html#sdm120

You can check the baud rate for your meter by scrolling through the SDM120 LCD menu. It’s possible to change the baudrate via the SDM120 LCD menu, this is maybe what @greentangerine did?

I would recommend using the master branch of emonHub. I think this is the reason why you’re getting this error.

Any USB port is fine, it doest matter which you use. However, if you have more than one ttyUSB device plugged in then you should use direct addressing to avoid the ports getting mixed up e.g you’ll need to check the exact address for your device, they are unique to each device.

/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A10LT01M-if00-port0

1 Like

Thank you @borpin and @glyn.hudson :heart_eyes:

In haste because I’m at work. I deleted the SDM120 instructions from the config file and then updated everything and Lo! the emonPi started recording again. Phew. Thank you both!

This evening I’ll try to have another fiddle and see if I can hook things up better this time. I assume that, @glyn.hudson by saying that I can put two SDM120s on the same RS485 that I put the A and B wires from both meters into the appropriate slots in the RS485… I’ll try to RTFM for the Eastrons to set them as 1 and 2, respectively. :thinking:

Can I add that my inability to fiddle with digital stuff really knows no bottom so I’ll probably be back more stupid questions before too long. I owe you multiple refreshing beverages. :stuck_out_tongue_winking_eye:

Correct - or if it’s easier physically, you can daisy-chain them. (RS485 adapter — Eastron — Eastron)

The data bus works on the principle that the controller (the RS485 adapter in your computer) requests data from one of the Eastron meters using its address, and the meter responds. Hence the need for each to have an unique address (Otherwise both will respond together and chaos ensues.)

Daisy chaining is the preferred wiring topology.

As the picture shows, avoid using the others.

image

Ref:

1 Like