DIY: SDM630 Smart Meter Interface

smartmeter
diy
modbus
Tags: #<Tag:0x00007f1e5ae9d638> #<Tag:0x00007f1e5ae9d390> #<Tag:0x00007f1e5ae9d228>
(nicco demi) #61

@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)?

0 Likes

(Sir Leone) #62

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

0 Likes

(Hallo Ween) #63

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?

0 Likes

(Nick Galfas) #64

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

(Juan) #65

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.

0 Likes

(Nick Galfas) #66

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.

0 Likes

(Juan) #67

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.

0 Likes

(Juan) #68

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:

0 Likes

Modbus switch+ sensor
(Nick Galfas) #69

The Tasmota module configuration is the easiest part. It has pin configuration options for Tx/Rx on SDM120/SDM220 (single phase meters) and seperate pin options for SDM630/SDM530 (these are the 3-phase models and display more registers).

ie, this is the pin configuration for SDM120

1 Like

(Juan) #70

Hi thanks.

Today I got my SDM630. I have flashed a sonoff Basic, and I set it up like this, but I do not see any values on the main page of Sonoff-. What do I miss?

I do not find on the menu, SDM630 Rx and SDM630 Tx.

47

Thanks.

0 Likes

(Juan) #71

Problem solved.

The library SDM630 was commented with // as a comment.

Everything working fine.

0 Likes

(Nick Galfas) #72

Or you can download the ‘sensors’ Tasmota release which has it ready to play.

  • sonoff-sensors.bin = The Sensors version without Wps and SmartConfig configuration but adds even more useful sensors.
0 Likes

(Juan) #73

2 qustions ngalfas:

  • The TotalEnergy is possible to reset to 0? :confused:
  • How I get the ActivePower. It seems that is a String?
{"Time":"2019-01-28T14:07:08","ENERGY":{"Total":11.118,"ActivePower":[86,13,19],"ReactivePower":[-22,-25,-9],"Factor":[0.97,0.45,0.91],"Voltage":[231,229,230],"Current":[0.420,0.158,0.190]}}
0 Likes

(Nick Galfas) #74

just saw this…

I think there is a way to reset TotalEnergy on the SDM itself. i don’t have the manual right now…
the best way to use it is to set a database persistence and store your daily metering.
you will see that the SDM’s TotalEnergy has little use, you can do this from your data.

For your second question. This string is JSON data. You need to setup the things and items scheme for OpenHab to parse the data.
Luckily, i have my setup for both MQTTv1 and MQTTv2 bindings so here it is.

For MQTTv1 binding (“mosquitto” is the broker service name)

Number:Power 				SDM530_W1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[0])]" }
Number:Power 				SDM530_W2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[1])]" }
Number:Power 				SDM530_W3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.ActivePower.[2])]" }
Number:ElectricPotential	SDM530_V1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[0])]" }
Number:ElectricPotential	SDM530_V2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[1])]" }
Number:ElectricPotential	SDM530_V3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Voltage.[2])]" }
Number:ElectricCurrent 		SDM530_A1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[0])]" }
Number:ElectricCurrent 		SDM530_A2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[1])]" }
Number:ElectricCurrent 		SDM530_A3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Current.[2])]" }
Number  					SDM530_F1 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[0])]" }
Number  					SDM530_F2 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[1])]" }
Number  					SDM530_F3 		{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Factor.[2])]" }
Number:Energy 				SDM530_Energy 	{ mqtt="<[mosquitto:tele/SDM530/SENSOR:state:JSONPATH($.ENERGY.Total)]" }

For the newer MQTTv2 binding you have the two seperate files:

.things MQTTv2 file

Thing mqtt:topic:SDM530 (mqtt:broker:mosquitto) {
  Channels:
	Type number : power1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[0]" ]
	Type number : power2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[1]" ]
	Type number : power3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.ActivePower.[2]" ]
	Type number : voltage1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[0]" ]
	Type number : voltage2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[1]" ]
	Type number : voltage3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage.[2]" ]
	Type number : current1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[0]" ]
	Type number : current2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[1]" ]
	Type number : current3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current.[2]" ]
	Type number : factor1		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[0]" ]
	Type number : factor2		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[1]" ]
	Type number : factor3		[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Factor.[2]" ]
	Type number : totalenergy	[ stateTopic="tele/GAIA_SDM530/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total" ]	
}

.items MQTTv2 file

Number:Power 				SDM530_W1 		{ channel="mqtt:topic:SDM530:power1" }
Number:Power 				SDM530_W2 		{ channel="mqtt:topic:SDM530:power2" }
Number:Power 				SDM530_W3 		{ channel="mqtt:topic:SDM530:power3" }
Number:ElectricPotential	SDM530_V1		{ channel="mqtt:topic:SDM530:voltage1" }
Number:ElectricPotential	SDM530_V2		{ channel="mqtt:topic:SDM530:voltage2" }
Number:ElectricPotential	SDM530_V3 		{ channel="mqtt:topic:SDM530:voltage3" }
Number:ElectricCurrent	 	SDM530_A1 		{ channel="mqtt:topic:SDM530:current1" }
Number:ElectricCurrent 		SDM530_A2 		{ channel="mqtt:topic:SDM530:current2" }
Number:ElectricCurrent	 	SDM530_A3 		{ channel="mqtt:topic:SDM530:current3" }
Number  					SDM530_F1		{ channel="mqtt:topic:SDM530:factor1" }
Number  					SDM530_F2 		{ channel="mqtt:topic:SDM530:factor2" }
Number  					SDM530_F3 		{ channel="mqtt:topic:SDM530:factor3" }
Number:Energy 				SDM530_Energy 	{ channel="mqtt:topic:SDM530:totalenergy" }

as you can see, i also have all the UoM set for ease of use on calculations etc.

0 Likes