Hi there,
I ordered “Smartnetz Energymeter GAS SCE 3.0” from austria and tasmota is running fine with it!
MQTT is connected and theoretically working but!!!
There is a script generator from Smartnetz austria which provided a code snip for Homeassistant:
Script which is running on the esp:
>D
resetb=0
p:m1=0
p:g1=0
p:g2=0
p:month1=0
p:month2=0
p:month3=0
p:gesamt=0
c1=0
s1=0
h1=0
hkw1=0
gkw1=0
gkw2=0
mkw1=0
mkw2=0
mkw3=0
mkwgs=0
skw1=0
hgp=0
g1gp=0
g2gp=0
m1gp=0
m2gp=0
m3gp=0
gsgp=0
hr=0
dy=0
zu=0.96
br=10.2
gp=7.71
gasinit=2465.240
gastotal=0
>B
=>sensor53 l255
=>Teleperiod 60
=>CounterDebounceLow 500
=>CounterDebounceHigh 500
>S
if resetb==1
then
=>counter1 0
=>reset 2
endif
h1=s1-m1
hkw1=h1*br*zu
hgp=(hkw1*gp)/100
gkw1=g1*br*zu
gkw2=g2*br*zu
mkw1=month1*br*zu
mkw2=month2*br*zu
mkw3=month3*br*zu
mkwgs=gesamt*br*zu
g1gp=(gkw1*gp)/100
g2gp=(gkw2*gp)/100
m1gp=(mkw1*gp)/100
m2gp=(mkw2*gp)/100
m3gp=(mkw3*gp)/100
gsgp=(mkwgs*gp)/100
skw1=s1*br*zu
hr=hours
dy=day
if chg[hr]>0
and hr==0
then
m1=s1
g2=g1
g1=h1
month1=month1+h1
gesamt=gesamt+h1
if chg[dy]<2
and dy==1
then
month3=month2
month2=month1
month1=0
endif
svars
endif
if upsecs%tper==0{
=>Publish tasmota/%topic%/main/td_m3 %2h1%
=>Publish tele/%topic%/main/td_kwh %2hkw1%
=>Publish tele/%topic%/main/yd_m3 %2g1%
=>Publish tele/%topic%/main/yd_kwh %2gkw1%
=>Publish tele/%topic%/main/dbyd_m3 %2g2%
=>Publish tele/%topic%/main/dbyd_kwh %2gkw2%
=>Publish tele/%topic%/main/value %2s1%
=>Publish tele/%topic%/main/gastotal %2gastotal%
=>Publish tele/%topic%/json {"gastotal": "%2gastotal%", "value": "%2s1%", "today_m3": "%2h1%", "today_kwh": "%2hkw1%", "yesterday_m3": "%2g1%", "yesterday_kwh": "%2gkw1%", "db_yesterday_m3": "%2g2%", "db_yesterday_kwh": "%2gkw2%"}
}
>T
s1=Counter#C1/100
c1=Counter#C1
gastotal=(c1/100)+gasinit
>W
<br><br>
Smartnetz Smart {m} Gas Reader 3.0 SCE
<a href="https://script.smartnetz.at" target="_blank">Script Configurator</a>
<br><br>
GAS gezählt: {m} %3s1% m³
Zählerstand: {m} %gastotal% m³
<br>
Zustandszahl: {m} %zu%
Brennwert: {m} %br% kWh/m³
Gaspreis: {m} %gp% Cent/kWh
<br>
Verbrauch:
Heute: {m} %2h1% m³ | %2hkw1% kWh
Kosten: {m} %2hgp% €
Gestern: {m} %2g1% m³ | %2gkw1% kWh
Kosten: {m} %2g1gp% €
Vorgestern: {m} %2g2% m³ | %2gkw2% kWh
Kosten: {m} %2g2gp% €
<br>
Aktueller Monat: {m} %2month1% m³ | %2m1gp% €
Letzter Monat: {m} %2month2% m³ | %2m2gp% €
Vorletzter Monat: {m} %2month3% m³ | %2m3gp% €
Gesamt: {m} %2gesamt% m³ | %2gsgp% €
bu(resetb "..." "Zählerreset")
#
Config of MQTT Settings attached in the pictures.
Now I can get the countervalue of the reed contact of the Tasmota device but the code for the additional sensors like dayli, weekly consumption and costs are nor shown and of course not working. Status: unavailable.
code is in cofig.yaml
-platform: mqtt
sensors:
- name: "Zählerstand"
unique_id: sensor.gaszaehler_zaehlerstand
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.gastotal }}'
unit_of_measurement: 'm³'
payload_available: "Online"
payload_not_available: "Offline"
device_class: gas
state_class: "total_increasing"
- name: "Zählung seit Nullung"
unique_id: sensor.gaszaehler_zaehlung_seit_nullung
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.value }}'
unit_of_measurement: 'm³'
payload_available: "Online"
payload_not_available: "Offline"
device_class: gas
state_class: "total_increasing"
- name: "Verbrauch Volumen heute"
unique_id: sensor.gaszaehler_verbrauch_volumen_heute
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.today_m3 }}'
unit_of_measurement: 'm³'
payload_available: "Online"
payload_not_available: "Offline"
device_class: gas
state_class: "total_increasing"
- name: "Verbrauch Energie heute"
unique_id: sensor.gaszaehler_verbrauch_energie_heute
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.today_kwh }}'
unit_of_measurement: 'kWh'
payload_available: "Online"
payload_not_available: "Offline"
device_class: energy
state_class: "total_increasing"
- name: "Verbrauch Volumen gestern"
unique_id: sensor.gaszaehler_verbrauch_volumen_gestern
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.yesterday_m3 }}'
unit_of_measurement: 'm³'
payload_available: "Online"
payload_not_available: "Offline"
device_class: gas
state_class: "total_increasing"
- name: "Verbrauch Energie gestern"
unique_id: sensor.gaszaehler_verbrauch_energie_gestern
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.yesterday_kwh }}'
unit_of_measurement: 'kWh'
payload_available: "Online"
payload_not_available: "Offline"
device_class: energy
state_class: "total_increasing"
- name: "Verbrauch Volumen vorgestern"
unique_id: sensor.gaszaehler_verbrauch_volumen_vorgestern
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.db_yesterday_m3 }}'
unit_of_measurement: 'm³'
payload_available: "Online"
payload_not_available: "Offline"
device_class: gas
state_class: "total_increasing"
- name: "Verbrauch Energie vorgestern"
unique_id: sensor.gaszaehler_verbrauch_energie_vorgestern
state_topic: "tele/gaszaehler/json"
value_template: '{{ value_json.db_yesterday_kwh }}'
unit_of_measurement: 'kWh'
payload_available: "Online"
payload_not_available: "Offline"
device_class: energy
state_class: "total_increasing"
Does anyone is smart enough to solve what I do not see?
I am pretty new to tasmota and thought it could not so hard, proofed myself wrong