Skip to content

Instantly share code, notes, and snippets.

@johannrichard
Last active August 15, 2025 13:49
Show Gist options
  • Save johannrichard/05471d92e12aa0bb03438c3707b746c9 to your computer and use it in GitHub Desktop.
Save johannrichard/05471d92e12aa0bb03438c3707b746c9 to your computer and use it in GitHub Desktop.
gPlugD Scripts for various DSRM Smart Meters
>D
; Based on gPlugD v1.11 DSRM (19.2.25) with additional values read out
; Adapted to work with the Sagemcom XT211 from Groupe E which differs in some OBIS codes
upH=0
sr=0
ss=0
rBlink=0
d=750
bu=0
noWifi=0
; define pins
rL=6
gL=5
bL=7
butA=9
; shared var within local network
g:Pi=0
g:Po=0
>B
; enable mDNS
->setOption55 1
; activate data parsing
->sensor53 r
; Output data in console - use this to identify the raw data returned from your smart meter
;->sensor53 d1
; show data receive with green led
->Sensor53 l5
;configure GPIO
spinm(rL O)
spinm(gL O)
spinm(bL O)
spinm(butA P)
>BS
; lightshow at startup
spin(rL 1)
delay(d)
spin(gL 1)
; r + g = y
delay(d)
spin(rL 0)
delay(d)
spin(gL 0)
spin(bL 1)
delay(d)
spin(bL 0)
; referrer check
->SetOption128 ON
; MQTT publish rate 1/10 Hz
->teleperiod 10
; dynamic wifi Tx power (Tasmota >14.x)
->wifipower 0
; show CPU temperature in webUI
; SetOption146 1
>M 1
+1,4,o,0,115200,z
; Identification (IDs, time, header)
1,0-0:0.0.0(@1,SM-ID,,SMid,0 ; equipment ID
1,0-0:96.1.2(@1,ID,,ID,0 ; serial/identifier
1,0-0:96.1.4(@1,FW,,FW,0 ; firmware
1,0-0:1.0.0(@1,DateTime,,DateTime,0 ; meter time
; Tariff / status / messages / events
1,0-0:96.14.0(@1,Tariff ___ 96_14_0,,Tariff,0 ; tariff indicator (T1/T2)
1,0-0:96.7.21(@1,OutagesShort ___ 96_7_21,,OutagesShort,0 ; short outages count
1,0-0:96.7.9(@1,OutagesLong ___ 96_7_9,,OutagesLong,0 ; long outages count
1,1-0:99.97.0(@1,EventLog ___ 99_97_0,,EventLog,0 ; event log (cause,time,duration)
1,0-0:98.1.0(@1,LP_Records ___ 98_1_0,,LP_Records,0 ; load profile records
1,0-0:96.13.0(@1,Msg1 ___ 96_13_0,,Msg1,0 ; utility msg 1
1,0-0:96.13.1(@1,Msg2 ___ 96_13_1,,Msg2,0 ; utility msg 2
; Voltage quality counters (sags/swells per phase)
1,1-0:32.32.0(@1,SagL1 ___ 32_32_0,,SagL1,0 ; sags L1
1,1-0:52.32.0(@1,SagL2 ___ 52_32_0,,SagL2,0 ; sags L2
1,1-0:72.32.0(@1,SagL3 ___ 72_32_0,,SagL3,0 ; sags L3
1,1-0:32.36.0(@1,SwellL1 ___ 32_36_0,,SwellL1,0 ; swells L1
1,1-0:52.36.0(@1,SwellL2 ___ 32_36_0,,SwellL2,0 ; swells L2
1,1-0:72.36.0(@1,SwellL3 ___ 72_36_0,,SwellL3,0 ; swells L3
; Power (instantaneous active, total and per phase) – kW scaled to W
1,=h<hr/>
1,=h<h4>Real Power In & Out</h4/>
1,1-1:1.7.0(@0.001,Pi ___ 1_7_0,W,Pi,3 ; import total
1,1-1:2.7.0(@0.001,Po ___ 2_7_0,W,Po,3 ; export total
1,=h<hr/>
1,=h<h4>Phase Power In & Out</h4/>
1,1-0:21.7.0(@0.001,P1i ___ 21_7_0,W,P1i,0 ; import L1
1,1-0:41.7.0(@0.001,P2i ___ 41_7_0,W,P2i,0 ; import L2
1,1-0:61.7.0(@0.001,P3i ___ 61_7_0,W,P3i,0 ; import L3
1,1-0:22.7.0(@0.001,P1o ___ 22_7_0,W,P1o,0 ; export L1
1,1-0:42.7.0(@0.001,P2o ___ 42_7_0,W,P2o,0 ; export L2
1,1-0:62.7.0(@0.001,P3o ___ 62_7_0,W,P3o,0 ; export L3
; Phase voltage (V) and current (A)
1,=h<hr/>
1,=h<h4>Phase Voltage & Current</h4/>
1,1-0:32.7.0(@1,V1 ___ 32_7_0,V,V1,1 ; voltage L1
1,1-0:52.7.0(@1,V2 ___ 52_7_0,V,V2,1 ; voltage L2
1,1-0:72.7.0(@1,V3 ___ 72_7_0,V,V3,1 ; voltage L3
;
1,1-0:31.7.0(@1,I1 ___ 31_7_0,A,I1,2 ; current L1
1,1-0:51.7.0(@1,I2 ___ 51_7_0,A,I2,2 ; current L2
1,1-0:71.7.0(@1,I3 ___ 71_7_0,A,I3,2 ; current L3
; Energy (cumulative active, kWh). If 1.8.0/2.8.0 absent, totals are Ei1+Ei2 / Eo1+Eo2 in >S.
1,=h<hr/>
1,=h<h4>Real Energy Counters</h4/>
1,1-1:1.8.1(@1,Ei1 ___ 1_8_1,kWh,Ei1,3 ; import T1
1,1-1:1.8.2(@1,Ei2 ___ 1_8_2,kWh,Ei2,3 ; import T2
1,1-1:2.8.1(@1,Eo1 ___ 2_8_1,kWh,Eo1,3 ; export T1
1,1-1:2.8.2(@1,Eo2 ___ 2_8_2,kWh,Eo2,3 ; export T2
1,1-1:1.8.0(@1,Ei ___ 1_8_0,kWh,Ei,3 ; total import (if present)
1,1-1:2.8.0(@1,Eo ___ 2_8_0,kWh,Eo,3 ; total export (if present)
; Demand (optional)
1,1-0:1.4.0(@0.001,Demand ___ 1_4_0,W,Demand,3 ; avg demand
1,1-1:1.6.0(@1,MaxDemandTS ___ 1_6_0,,MaxDemandTS,3 ; max demand timestamp
#
>S
; every second
sr=sunrise/60
ss=sunset/60
upH=uptime/60
; share latest Pi & Po
Pi=sml[2]
Po=sml[3]
; if no wifi connection after 10 sec, blink red
if wifis==0 {
noWifi+=1
}
if noWifi>10 {
rBlink=3
}
if pin[butA]==0 {
bu+=1
}
if bu>2 {
rBlink=1
bu=0
}
>F
; every 100 ms
if rBlink>0 {
spin(rL 1)
rBlink-=1
noWifi=0
} else {
spin(rL 0)
}
>W
@<style>body{font-family: monospace}h4,h2{margin: 0;color: #1fa3ec}td th{font-weight: normal;}tr th:first-child{text-align: left;}tr td:nth-child(2){text-align: right;color: lime;font-weight:normal;}table{width:100\%;}</style>
@<table><tbody><tr>
<th>Date \& Time</th><td>%tstamp%</td></tr>
<tr><th>Uptime</th><td> %1upH%h</td></tr>
</tbody></table>

The following is an annotated list of OBIS codes returned by a current SAGEMCOM XT211 Smart Meter installed by Groupe E. The raw values can be seen in the Tasmota console by uncommenting / adding the following line in your gPlug's Script:

; Output data in console - use this to identify the raw data returned from your smart meter
->sensor53 d1

BLUF: Here is the reordered table without the Values column, and with concise labels (no redundant OBIS repeats).

Label OBIS Code Unit Description Notes/Interpretation
SM-ID 0-0:0.0.0 - Equipment ID Manufacturer/meter equipment identifier
ID 0-0:96.1.2 - Meter serial number Unique meter identification
FW 0-0:96.1.4 - Firmware version Software version running on meter
DateTime 0-0:1.0.0 - Meter timestamp Telegram time (YYMMDDhhmmss + season)
Tariff 0-0:96.14.0 - Tariff indicator Active tariff (1=T1, 2=T2)
OutagesShort 0-0:96.7.21 count Short power failures Total count of short interruptions
OutagesLong 0-0:96.7.9 count Long power failures Count of extended outages
EventLog 1-0:99.97.0 - Power failure event log Entries with cause, timestamp, duration
LP_Records 0-0:98.1.0 - Load profile records Number of stored profile entries
Msg1 0-0:96.13.0 text Text message Utility message field
Msg2 0-0:96.13.1 text Text message Additional utility message field
SagL1 1-0:32.32.0 count Voltage sags L1 Dips below threshold on phase 1
SagL2 1-0:52.32.0 count Voltage sags L2 Dips below threshold on phase 2
SagL3 1-0:72.32.0 count Voltage sags L3 Dips below threshold on phase 3
SwellL1 1-0:32.36.0 count Voltage swells L1 Rises above threshold on phase 1
SwellL2 1-0:52.36.0 count Voltage swells L2 Rises above threshold on phase 2
SwellL3 1-0:72.36.0 count Voltage swells L3 Rises above threshold on phase 3
Pi 1-0:1.7.0 W Active power import (total) Current draw from grid
Po 1-0:2.7.0 W Active power export (total) Current feed-in to grid
P1i 1-0:21.7.0 W L1 import power Phase 1 consumption
P2i 1-0:41.7.0 W L2 import power Phase 2 consumption
P3i 1-0:61.7.0 W L3 import power Phase 3 consumption
P1o 1-0:22.7.0 W L1 export power Phase 1 feed-in
P2o 1-0:42.7.0 W L2 export power Phase 2 feed-in
P3o 1-0:62.7.0 W L3 export power Phase 3 feed-in
V1 1-0:32.7.0 V Voltage L1 Phase 1 voltage
V2 1-0:52.7.0 V Voltage L2 Phase 2 voltage
V3 1-0:72.7.0 V Voltage L3 Phase 3 voltage
I1 1-0:31.7.0 A Current L1 Phase 1 current
I2 1-0:51.7.0 A Current L2 Phase 2 current
I3 1-0:71.7.0 A Current L3 Phase 3 current
Ei1 1-0:1.8.1 kWh Import energy T1 Cumulative consumption tariff 1
Ei2 1-0:1.8.2 kWh Import energy T2 Cumulative consumption tariff 2
Eo1 1-0:2.8.1 kWh Export energy T1 Cumulative feed-in tariff 1
Eo2 1-0:2.8.2 kWh Export energy T2 Cumulative feed-in tariff 2
Ei 1-0:1.8.0 kWh Import energy total If exposed by meter; else Ei1+Ei2
Eo 1-0:2.8.0 kWh Export energy total If exposed by meter; else Eo1+Eo2
Demand 1-0:1.4.0 W Average active power demand Current calculated demand
MaxDemandTS 1-1:1.6.0 - Maximum demand timestamp Peak demand occurrence time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment