Installing Emoncms onto a PC (or Mac) and using with multiple modbus meters (e.g. SDM230)

Ah, that’s because of the desktop environment, which you don’t really need. It takes up a lot of disk space and a lot of CPU time. Try Raspberry PI OS Lite. It’s much smaller and runs much faster.

1 Like

I couldn’t find the lite version of the OS for PC. You could always uninstall a load of programs though I guess.

Running on an x86 (or x64) CPU and with more than the 1 GB of RAM on a Pi 2 or 3
means the performance hit is signifiicantly less than running the GUI on a Pi.
Hence, no real need for a PC Lite version

Performance on a Pi 4 with 8 GB of RAM is actually quite good, though.

As you mentioned above, the GUI can be uninstalled, or the OS can be set to not start the GUI.
i.e boot to the command prompt.

I can’t seem to edit this anymore but just wanted to add that on the MYSQL install - you can try:
cd /opt/openenergymonitor/EmonScripts/install and run ./mysql.sh and then re-run ./main.sh

Also, to get the modbus readings to work I found I had to copy minimalmodbus.py from /usr/local/lib/python2.7/dist-packages to /usr/local/bin/emonhub

Hope that helps.

That shouldn’t have been necessary. It sounds as if Minimalmodbus didn’t get installed correctly.

Phoning a friend. Firstly, thank you to everyone involved in getting multiple SDM meters running over Modbus.

I have one SDM120 running successfully over Modbus into my emonPi, but am having trouble adding additional meters.

I have updated Emonhub to the following and have ensured the ID on the second device changed appropriately, but getting the following errors.

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
        baud = 9600
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        [[[[meters]]]]
            [[[[[sdm120a]]]]]
                address = 1
                registers = 0,6
                names = V,I
                precision = 2,3
            [[[[[sdm120b]]]]]
                address = 2
                registers = 0,6
                names = V,I
                precision = 2,3

I’m assuming i’'ve missed another configuration somewhere that’s resulting in the Input not being updated. Any help gratefully received…

2022-10-26 14:25:56,060 DEBUG MainThread Signal 15 received.
2022-10-26 14:25:56,209 INFO MainThread Exiting hub…
2022-10-26 14:25:56,336 INFO MainThread Exit completed
2022-10-26 14:25:57,281 INFO MainThread EmonHub emonHub (emon-pi variant) v2.2.6
2022-10-26 14:25:57,281 INFO MainThread Opening hub…
2022-10-26 14:25:57,282 INFO MainThread Logging level set to DEBUG
2022-10-26 14:25:57,282 INFO MainThread Creating EmonHubJeeInterfacer ‘RFM2Pi’
2022-10-26 14:25:57,283 DEBUG MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2022-10-26 14:25:59,286 WARNING MainThread Device communication error - check settings
2022-10-26 14:25:59,287 INFO MainThread Setting RFM2Pi baseid: 5 (5i)
2022-10-26 14:26:00,288 INFO MainThread Setting RFM2Pi frequency: 433 (4b)
2022-10-26 14:26:01,290 INFO MainThread Setting RFM2Pi group: 210 (210g)
2022-10-26 14:26:02,292 INFO MainThread Setting RFM2Pi quiet: 1 (1q)
2022-10-26 14:26:03,294 INFO MainThread Setting RFM2Pi calibration: 230V (1p)
2022-10-26 14:26:04,296 DEBUG MainThread Setting RFM2Pi pubchannels: [‘ToEmonCMS’]
2022-10-26 14:26:04,296 DEBUG MainThread Setting RFM2Pi subchannels: [‘ToRFM12’]
2022-10-26 14:26:04,298 INFO MainThread Creating EmonHubMqttInterfacer ‘MQTT’
2022-10-26 14:26:04,300 DEBUG MainThread Setting MQTT pubchannels: [‘ToRFM12’]
2022-10-26 14:26:04,301 DEBUG MainThread Setting MQTT subchannels: [‘ToEmonCMS’]
2022-10-26 14:26:04,301 INFO MainThread Setting MQTT node_format_enable: 1
2022-10-26 14:26:04,301 INFO MainThread Setting MQTT nodevar_format_enable: 1
2022-10-26 14:26:04,302 INFO MainThread Setting MQTT nodevar_format_basetopic: emon/
2022-10-26 14:26:04,302 INFO MainThread Setting MQTT node_JSON_enable: 0
2022-10-26 14:26:04,303 INFO MainThread Creating EmonHubEmoncmsHTTPInterfacer ‘emoncmsorg’
2022-10-26 14:26:04,304 DEBUG MainThread Setting emoncmsorg pubchannels: [‘ToRFM12’]
2022-10-26 14:26:04,305 DEBUG MainThread Setting emoncmsorg subchannels: [‘ToEmonCMS’]
2022-10-26 14:26:04,305 WARNING MainThread Setting emoncmsorg apikey: obscured
2022-10-26 14:26:04,306 INFO MainThread Setting emoncmsorg url: https://emoncms.org
2022-10-26 14:26:04,306 INFO MainThread Setting emoncmsorg senddata: 1
2022-10-26 14:26:04,306 INFO MainThread Setting emoncmsorg sendstatus: 1
2022-10-26 14:26:04,307 INFO MainThread Creating EmonHubMinimalModbusInterfacer ‘SDM120’
2022-10-26 14:26:04,318 INFO MainThread Connecting to Modbus device=/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 baud=9600
2022-10-26 14:26:04,329 INFO MainThread Setting SDM120 read_interval: 10
2022-10-26 14:26:04,330 INFO MainThread Setting SDM120 nodename: sdm120
2022-10-26 14:26:04,330 INFO MainThread Setting SDM120 prefix:
2022-10-26 14:26:04,330 ERROR MainThread Unable to create ‘SDM120’ interfacer: sequence item 0: expected str instance, int found

Hello Ben, I cant see what is wrong. Does it work with only one of those meters defined? The error is not giving much to go on either, might be worth approaching by process of elmination, e.g remove one of the meter definitions - see what happens, remove both - does it at least create the interfacer?

Hi,

Just double checking you have the correct baud rate set on both meters and you’ve done this:

1 Like

Thank you, both meters are running at 9600 and work successfully when using the original single meter script.

Thanks Trystan, i should have tried paring back before, thank you for the advice.

Nothing yet. I’ve simplified the config back to single meter below, but unable to get the interfacer to start.

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
        baud = 9600
    [[[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

The hardware seems fine as this test Pi works well with one meter when I switch back to the config below. The interfacer is created and I get data from either SDM120 immediately.

If the config above looks right to you, then it’s behaving as if I’ve missed configuring or declaring something elsewhere in the config file - or perhaps using a different version of minimalmodbus? With that, it’s a fresh emonSD image with basic updates run. Would I need to fetch anything additional perhaps or another part to the config?

This config below works well for both meters.

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
        baud = 9600
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        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

Many thanks in advance.

I suggest you check the system logs as Python errors will show up there.

try

journalctl -f

add -u emonhub to get less (if other stuff is there).

Hello @thedawnbefore thanks for the above, I think you have an older version of emonhub, the version before support for multiple meters. If you run a full update from the emoncms Admin > Update page it should hopefully sort it

1 Like

@thedawnbefore - check the log and make sure it really does update :slight_smile:

As an aside, I don’t think there is anyway of knowing what version you are running from the UI :frowning:

1 Like

It does show the version in the log and on the Admin > Components page?

 2022-10-26 14:25:57,281 INFO MainThread EmonHub emonHub (emon-pi variant) v2.2.6

Looks like version needs to be 2.3.1 or newer for the new multiple meter config format support.

1 Like

Oh yes, missed it, sorry :frowning: might be useful on the Emonhub page as well :slight_smile:

that emon-pi variant note also needs removing now as it’s easily confused with a branch name.

1 Like

Actually that printed version in the log is wrong :man_facepalming: it’s hard coded and has not been updated to reflect the actual version…

1 Like

Fixed it, latest version is 2.4.2 which is now printed to the log

It works a treat now, thank you @TrystanLea and @borpin You were quite right. :man_facepalming: Was sure i’d run full update few days ago… must have failed and not checked logs, doh.

2 Likes