Hi openHAB community.
For quite some time I’ve struggled to get my smart meter SDM54-2T up and running with openHAB (serial) modbus binding.
I chose the SDM54 over the SDM630 because of its more compact size (only 3 modules wide as to 4 modules width of the SDM630).
In case anyone of you is trying the same I thought I’d quickly post my setup here as a template:
My hardware:
- Raspberry Pi 4B 8GB
- RS485/USB adapter connected to USB port of Raspberry Pi
- about 30m of RS485 cable
- one smart meter SDM54-2T (another one is to be integrated soon) - I did set its RS485-address to 21
- (additionally there’s one growatt SPH10000TL3 BH-UP and on growatt MIC3000 solar inverter on the same RS485-bus - not included in the example thing/item files below)
- 120 ohm resistor at one end of the RS485 cable (in my installation it’s on the smart meter)
- no additional resistor at the other end of the cable (in my installation that is the RS485-USB adapater on the Raspberry - there might be a resistor integrated in the adapter? - not sure)
The thing file:
//Modbus message parser: https://rapidscada.net/modbus/
Bridge modbus:serial:SDM54_1 "SDM54-T2 SmartMeter" [ port="/dev/ttyUSB0", id=21, baud=9600, stopBits="1.0", parity="none", dataBits=8, encoding="rtu", timeBetweenTransactionsMillis=1000 ]
{
Bridge poller BasisWerte [start=0, length=36, type="input", refresh=5000]
{
Thing data voltage1 "Spannung Phase 1" [readStart="0", readValueType="float32" ]
Thing data voltage2 "Spannung Phase 2" [readStart="2", readValueType="float32" ]
Thing data voltage3 "Spannung Phase 3" [readStart="4", readValueType="float32" ]
Thing data current1 "Stromstärke Phase 1" [readStart="6", readValueType="float32" ]
Thing data current2 "Stromstärke Phase 2" [readStart="8", readValueType="float32" ]
Thing data current3 "Stromstärke Phase 3" [readStart="10", readValueType="float32" ]
Thing data power1 "Leistung Phase 1" [readStart="12", readValueType="float32" ]
Thing data power2 "Leistung Phase 2" [readStart="14", readValueType="float32" ]
Thing data power3 "Leistung Phase 3" [readStart="16", readValueType="float32" ]
Thing data va1 "VA 1" [readStart="18", readValueType="float32" ]
Thing data va2 "VA 2" [readStart="20", readValueType="float32" ]
Thing data va3 "VA 3" [readStart="22", readValueType="float32" ]
Thing data var1 "VAR 1" [readStart="24", readValueType="float32" ]
Thing data var2 "VAR 2" [readStart="26", readValueType="float32" ]
Thing data var3 "VAR 3" [readStart="28", readValueType="float32" ]
Thing data powerfactor1 "Leistungsfaktor 1" [readStart="30", readValueType="float32" ]
Thing data powerfactor2 "Leistungsfaktor 2" [readStart="32", readValueType="float32" ]
Thing data powerfactor3 "Leistungsfaktor 3" [readStart="34", readValueType="float32" ]
}
Bridge poller Frequenz [start=70, length=2, type="input", refresh=5000]
{
Thing data frequency "Netzferquenz" [readStart="70", readValueType="float32" ]
}
Bridge poller SystemPower [start=52, length=2, type="input", refresh=5000] {
Thing data systemPower "Systemleistung" [readStart="52", readValueType="float32" ]
}
Bridge poller kwh [start=342, length=22, type="input", refresh=5000] {
Thing data totalKwh "Gesamtverbrauch" [readStart="342", readValueType="float32" ]
Thing data totalkVarh "Gesamt VARH" [readStart="344", readValueType="float32" ]
Thing data importKwh1 "Import 1" [readStart="346", readValueType="float32" ]
Thing data importKwh2 "Import 2" [readStart="348", readValueType="float32" ]
Thing data importKwh3 "Import 3" [readStart="350", readValueType="float32" ]
Thing data exportKwh1 "Export 1" [readStart="352", readValueType="float32" ]
Thing data exportKwh2 "Export 2" [readStart="354", readValueType="float32" ]
Thing data exportKwh3 "Export 3" [readStart="356", readValueType="float32" ]
Thing data totalKwh1 "Gesamt 1" [readStart="358", readValueType="float32" ]
Thing data totalKwh2 "Gesamt 2" [readStart="360", readValueType="float32" ]
Thing data totalKwh3 "Gesamt 3" [readStart="362", readValueType="float32" ]
}
}
The item-file
(not all thing-channels are being mapped to items in this example but I’m sure it’s sufficient info to get the idea how to map the remaining ones):
Group:Number:Power:SUM gCurrentWatts "Summe aller gemessenen Verbräuche" <energy>
Group gSDM54_2T_1 "SDM54-2T Smart Meter Nr 1" <controller> (gUG_Flur) ["RemoteControl"]
// SmartMeter SDM52-T2 Nr 1 (Zählerschrank UG) ///////////////////////////
Number:Power SDM54_T2_1SystemPower "Systemleistung [%.2f %unit%]" <energy> (gSDM54_2T_1) {channel="modbus:data:SDM54_1:SystemPower:systemPower:number"}
Number:Frequency SDM54_T2_1Frequenz "Netzfrequenz [%.2f %unit%]" <energy> (gSDM54_2T_1) {channel="modbus:data:SDM54_1:Frequenz:frequency:number"}
Number:Energy SDM54_T2_1TotalKwh "Gesamt Verbrauch [%.2f %unit%]" <energy> (gSDM54_2T_1) {channel="modbus:data:SDM54_1:kwh:totalKwh:number"}
Number SDM54_T2_1TotalVarh "Gesamt kVArh [%.2f VA]" <energy> (gSDM54_2T_1) {channel="modbus:data:SDM54_1:kwh:totalkVarh:number"}
//Treppenhauslicht/Steckdosen (SDM54-T2 Nr 1, Phase 3)
Number:ElectricPotential TreppenhausLobbyVoltage "Spannung [%.2f %unit%]" <energy> (gSDM54_2T_1, gCurrentWatts) ["Energy"] {channel="modbus:data:SDM54_1:BasisWerte:voltage3:number"}
Number:ElectricCurrent TreppenhausLobbyCurrent "Stromstärke [%.2f %unit%]" <energy> (gSDM54_2T_1) ["Energy"] {channel="modbus:data:SDM54_1:BasisWerte:current3:number"}
Number:Power TreppenhausLobbyCurrentWatts "aktueller Verbrauch [%.2f %unit%]" <energy> (gSDM54_2T_1) ["Power"] {channel="modbus:data:SDM54_1:BasisWerte:power3:number"}
Number:Energy TreppenhausLobbyImportKwh "L3 Import [%.2f %unit%]" <energy> (gSDM54_2T_1) ["Energy"] {channel="modbus:data:SDM54_1:kwh:importKwh3:number"}
Number:Energy TreppenhausLobbyExportKwh "L3 Export [%.2f %unit%]" <energy> (gSDM54_2T_1) ["Energy"] {channel="modbus:data:SDM54_1:kwh:exportKwh3:number"}
Number:Energy TreppenhausLobbyTotalKwh "Gesamtverbrauch [%.2f %unit%]" <energy> (gSDM54_2T_1) ["Energy"] {channel="modbus:data:SDM54_1:kwh:totalKwh3:number"}
Hope this is useful for some of you!?
Kind regards,
Ralph…