Hallo,
mir ist aufgefallen (vermutlich nach dem letzten Fhem Update), dass in allen shelly-Objekten mit Typ MQTT2_DEVICE die Readings für Energy auf Null bleiben.
Internals:
CFGFN ./FHEM/00_config_MQTT2.conf
CID shelly1pm_F4CFA2E38BD3
DEF shelly1pm_F4CFA2E38BD3
FUUID 61cd9477-f33f-6b52-fd54-6aa8afe8e8ee1b1f
IODev myMQTT2Client
LASTInputDev myMQTT2Client
MSGCNT 298313
NAME MQTT2_SpuelMa
NR 1657
STATE on
TYPE MQTT2_DEVICE
eventCount 2250
myMQTT2Client_MSGCNT 298313
myMQTT2Client_TIME 2023-08-01 13:56:50
READINGS:
2023-07-16 19:34:50 IODev myMQTT2Client
2023-07-20 18:29:08 cond CONN
2023-07-27 14:47:41 event
2023-07-27 14:47:41 event_cnt 0
2023-07-27 14:47:40 fw_ver 20211109-130756/v1.11.7-g682a0db
2023-07-27 14:47:40 id SpuelMa
2023-08-01 13:56:50 input0 0
2023-07-27 14:47:40 ip 192.168.3.65
2023-08-01 10:32:51 loadState off
2023-07-27 14:47:40 mac F4CFA2E38BD3
2023-07-27 14:47:40 model SHSW-PM
2023-07-27 14:47:40 new_fw false
2023-07-27 14:47:40 online true
2023-08-01 13:56:50 overtemperature 0
2023-08-01 13:56:50 relay0 on
2023-08-01 13:56:50 relay_0_energy 0
2023-08-01 13:56:50 relay_0_kWh 0.00
2023-08-01 13:56:50 relay_0_power 0.66
2023-08-01 13:56:50 state on
2023-08-01 13:56:50 temperature 44.84
helper:
bm:
MQTT2_DEVICE_Get:
cnt 6
dmx -1000
dtot 0
dtotcnt 0
mTS 01.08. 11:44:46
max 0.000175952911376953
tot 0.000645875930786133
mAr:
HASH(0x55a4563448)
MQTT2_SpuelMa
?
MQTT2_DEVICE_Set:
cnt 24
dmx -1000
dtot 0
dtotcnt 0
mTS 01.08. 12:14:05
max 0.0328531265258789
tot 0.0521891117095947
mAr:
HASH(0x55a4563448)
MQTT2_SpuelMa
?
Attributes:
DbLogExclude .*
IODev myMQTT2Client
comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs.
devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false"?"10px-kreis-rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "10px-kreis-gelb" : "10px-kreis-gruen"; my $light = ReadingsVal($name,"state","off"); my $cons = ReadingsVal($name,"relay_0_power","unknown"); my $total = ReadingsVal($name,"relay_0_kWh","unknown"); my $temp = ReadingsVal($name,"temperature","-100"); "<a href=\"http://".ReadingsVal($name,"ip","none")." \"target=\"_blank\">".FW_makeImage($onl)."</a> <a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Verbrauch: $cons / Total: $total/ Temp: $temp °C</div>"}
event-on-change-reading relay_0_power:0.2
model shelly1_w_energy_measuring
readingList shellies/SpuelMa/relay/0:.* state
shellies/SpuelMa/relay/0:.* relay0
shellies/SpuelMa/input/0:.* input0
shellies/SpuelMa/online:.* online
shellies/announce:.* { $EVENT =~ m,..id...SpuelMa...mac.*, ? json2nameValue($EVENT) : return }
shellies/SpuelMa/announce:.* { json2nameValue($EVENT) }
shellies/SpuelMa/relay/0/power:.* relay_0_power
shellies/SpuelMa/relay/0/power:.* { my $compare = $EVTPART0 < 100 ? "off":"on"; ReadingsVal($NAME,"loadState","off") ne $compare ? { 'loadState' => $compare } : return }
shellies/SpuelMa/temperature:.* temperature
shellies/SpuelMa/input_event/0:.* { json2nameValue($EVENT) }
shellies/SpuelMa/overtemperature:.* overtemperature
shellies/SpuelMa/relay/0/energy:.* relay_0_energy
shellies/SpuelMa/relay/0/energy:.* {'relay_0_kWh' => sprintf("%.2f",$EVENT/60/1000)}
shellies/SpuelMa/longpush/0:.* longpush_0
shelly1pm_F4CFA2E38BD3:shellies/SpuelMa/info:.* { json2nameValue($EVENT) }
shelly1pm_F4CFA2E38BD3:shellies/SpuelMa/temperature_status:.* temperature_status
room MQTT2_DEVICE
setList relay0:on,off,toggle shellies/SpuelMa/relay/0/command $EVTPART1
toggle:noArg shellies/SpuelMa/relay/0/command toggle
off:noArg shellies/SpuelMa/relay/0/command off
on:noArg shellies/SpuelMa/relay/0/command on
x_update:noArg shellies/SpuelMa/command update_fw
x_mqttcom shellies/SpuelMa/command $EVTPART1
setStateList on off toggle
tolerance 2.2
update_intervall 120
userReadings relay_0_energy_total:relay_0_energy:.* monotonic {ReadingsNum("$name","relay_0_energy",0)}
userattr update_intervall tolerance
webCmd :
Ich habe nur "ältere" shelly1-PM, keine plus.
Wie bekomme ich wieder brauchbare Werte?
Das damalige Template bot noch shelly1_w_energy_measurement an.
Habe heute ein update der Templates durchgeführt, welches für neue Objekte greift, da erscheint in der Auswahl als einzig sinnvolles nur shelly1 und shellyPlus_1pm aber nichts für shelly1pm.
Die shellies sind auf dem neusten fw-Stand.
Current version: 20211109-130756/v1.11.7-g682a0db
You have latest version on your device!
Wie komme ich da weiter?
Gruß
Alex
Man kann ein shelly mit mqtt auch komplett ohne template einrichten.
Dann weiß man wenigstens, was man tut und warum etwas funktioniert (oder auch nicht funktioniert)
Zitat von: Homalix99 am 01 August 2023, 14:44:52Wie komme ich da weiter?
Es gab hier mal eine merkwürdige Heilungsvariante: https://forum.fhem.de/index.php?topic=133701.msg1276937#msg1276937
Ob das wirklich hilft kann ich nicht sagen, konnte mich nur daran erinnern ;)
Problem behoben.