DIY: SDM630 Smart Meter Interface

Actually, this is quite normal for the SDM630 (or all other Eastron SDM meters) . There errors are read errors from the RS485 bus - mostly just one bit errors. Nothing to worry about. sdm630_httpd just attempts to re-read the value from the device and produces this log message.

For comparison: I am implementing support for Janitza DIN rail meters right now. My setup was running over the weekend. These are the stats:

$ curl --silent http://localhost/status | jq

{
    "Starttime": "2017-07-14T16:06:54.298318459+02:00",
    "UptimeSeconds": 238135.331374839,
    "Goroutines": 13,
    "Memory": {
        "Alloc": 8067040,
        "HeapAlloc": 8067040
    },
    "Modbus": {
        "TotalModbusRequests": 7784409,
        "ModbusRequestRatePerMinute": 1961.3407943435868,
        "TotalModbusErrors": 25,
        "ModbusErrorRatePerMinute": 0.006298939310433158
    }
}

Of the 7784409 requests, only 25 failed. The Janitza meters are much faster and more reliable than the Eastrons, but still, they are not perfect. You have to expect some corrupted messages over MODBUS/RTU for all devices.

Ok, thanks, now i’m calm :slight_smile:

OK, the benchmarks are in. Over the same 9600 Baud connection meters perform like this:

  • Eastron SDM230: 716 Requests/Min.
  • Janitza B23: 1970 Requests/Min.

There is no practical difference between these meters if you only need a reading a minute. But in some of my usecases, we regulate things based on the meter readings - and having a higher resolution always helps.

But 716 Requests/Min are 12 readings per second… I think this is fast enough.

How much readings can openhab2 do? Can you make a realtime display with it or is openhab to slow for this?

Now i read out my power meter with an usb ir-reader. It´s with sml protocol, so i can read out about every 30 seconds. For real time display it´s to slow.

It depends :wink: If you consider the 21 parameters I’m reading in a loop an update of e.g. the L1 power reading takes almost 2 seconds. In my main usecase (not related to OpenHAB in any way) we’re controlling big batteries based on PV production and household consumption. I have at least two meters involved, and the update rate is - depending on the setup - in the 2-3 second range. This is rather slow for a battery management system :wink:

So, for this usecase, a faster meter is highly desirable.

I’ve never tried this - others are more competent to answer this. But if you mean “1-2 second updates”, I think OpenHAB should be able to do this.

A comment on openhab performance.

Users have reported pretty good performance using modbus binding alone, around 1700 requests per minute. This was in openhab1 so performance might be better or lower with openhab2. Naturally depending on details your mileage might vary, as discussed in this thread also.

With openhab1 some users have complained high cpu usage with many events in the event bus. Not sure how it goes with openhab2.

So from performance perspective the openhab itself should easily handle vast amount of updates per second.

Best
Sami

Thanks for sharing this!

-Mathias

Youd should add some more infos about Janitza B23 power meter:

B23-312 is the one with RS-485 Output (Modbus), which can be used with your software.

B23-311 is only s0 and B23-313 is M-Bus.

@halloween: Thank you for pointing this out. I added this to the README.

-Mathias

@sirLeone can you please provide details regarding intergration with Openhab2? Which transformation is required: JSONpath or Javascript?

@gonium I managed to make it work with OH2 following your instructions for OH1.8. It didn’t work at first because I had no http binding installed.
I am able to get L1-L3 power readings. What is json transform structure to get Total power?

This is for Phase 1:

JSON.parse(input).Power.L1;

Hi @nicodemi, i have 3 files: SDM630GetLXPower.js where x is 1-3 to each phase and for now thats all - unfortunatelly due to lack of time i did not do much more in my openhab2.

After few months of flaweless working i had problems with my ups and had unforeseen restart of my server. After everything went up connection to sdm630 stopped working. I thought that there is a problem with my meter but not - using python i can read values, using gosdm630 not :confused:

root@Santiago:/opt/sdm630# ./sdm630_get.sh /dev/ttyUSB0 1
236.68
2.34
548.54
236.84
0.57
107.56
238.49
0.78
139.62
12714.01
-124.85
0.03
3238.43
155.29
root@Santiago:/opt/sdm630# ./sdm630_httpd -u 192.168.2.100:8082 -s /dev/ttyUSB0
2017/11/15 09:06:46 Starting API httpd at 192.168.2.100:8082
2017/11/15 09:06:51 Device 1 failed to respond - retry attempt 1 of 5
2017/11/15 09:07:02 Device 1 failed to respond - retry attempt 1 of 5
2017/11/15 09:07:03 Device 1 failed to respond - retry attempt 1 of 5
2017/11/15 09:07:03 Device 1 failed to respond - retry attempt 2 of 5
2017/11/15 09:07:03 Device 1 failed to respond - retry attempt 3 of 5
2017/11/15 09:07:03 Device 1 failed to respond - retry attempt 4 of 5
2017/11/15 09:07:03 Device 1 failed to respond - retry attempt 5 of 5
2017/11/15 09:07:04 Failure - deactivating meter 1: Device 1 did not respond.
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 1 of 5
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 2 of 5
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 3 of 5
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 4 of 5
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 5 of 5
2017/11/15 09:07:04 Failure - deactivating meter 1: Device 1 did not respond.
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 1 of 5
2017/11/15 09:07:04 Device 1 failed to respond - retry attempt 2 of 5
2017/11/15 09:07:05 Device 1 failed to respond - retry attempt 3 of 5
2017/11/15 09:07:05 Device 1 failed to respond - retry attempt 4 of 5
2017/11/15 09:07:05 Device 1 failed to respond - retry attempt 5 of 5
2017/11/15 09:07:05 Failure - deactivating meter 1: Device 1 did not respond.

@sirLeone I’ve got it working in the meantime. The only thing I still haven’t figured out is how to get reading of Total power in OH.
Regarding your issue: have you tried the latest release (0.5.1)?

Yes, i have started from updating to latest release but with no luck :confused: I will try to read and compute values using python script

Is there a way to read out the modbus with an esp8266 or arduino and send the data with wifi to the openhab-server or the raspi running the software from the first post?

I have seen some tutorials where you can build a modbus slave with an esp8266. Would this be the right thing to do this?


Or another Idea:

On amazon you can find this: USR-TCP232-410S

Can i use your software with this lan-adapter? Can i read out a sdm630 connected to this and my raspi is only reachable over lan?

1 Like

You can hook an esp8266 with a modbus adapter to the energy meter. I especially use Sonoff’s with Tasmota firmware. In the latest versions it supports all Eastron meters and also some Peacefair energy meters.

If there are more Tasmota(MQTT)/Eastron users out there maybe we should start a new topic and leave this one only for Raspberry/Eastron use cases (the RS485 adapter placed on the Raspberry itself).

2 Likes

Interesting. I am looking for alternatives for Power Metering. My electrical box setup is triphasic, I was thinking to buy the SDM630, but I do not know how to setup the RS485.

You are talking about sonoff with Tasmota. Is it possible to link the a sonoff with Tasmota to the SDM630 send data via MQTT? How is the wiring? and how you modify the firwamre?

I am Tasmota(MQTT) user and I am thinking to buy a SDM630, I am interested on this topic, but I need to make up my mind about how is everthing setup.

check these out


this is the RS485 module you must use.

this is connected between the sonoff and the Eastron meter.

check also

the basic idea is that the sonoff/Tasmota takes the readings through RS485 and then transmitts MQTT status messages.

Cool that is what I was looking for. I will have a look. Next January will arrive my Eastorn an I will start to test it.

I guess that with Sonoff Basic the conection is the same. But I do not know how is the setup when you get in in the local IP of the sonoff. How to setup sonoff basic?

here is some resource: