Hallo Kai,
ich hab bei mir das Device "WASCHMASCHINE_PM" selbst definiert aber ich hab auch ein vom MQTT2 definiertes gerät da welches ich mit deinem Template versehen hab:
defmod MQTT2_shelly1pm_34AB953806E9 MQTT2_DEVICE shelly1pm-34AB953806E9
attr MQTT2_shelly1pm_34AB953806E9 comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs.
attr MQTT2_shelly1pm_34AB953806E9 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>"}
attr MQTT2_shelly1pm_34AB953806E9 model shelly1_w_energy_measuring
attr MQTT2_shelly1pm_34AB953806E9 readingList shellies/shelly1pm-34AB953806E9/relay/0:.* {{ state => $EVENT, relay0 => $EVENT}}\
shellies/shelly1pm-34AB953806E9/input/0:.* input0\
shellies/shelly1pm-34AB953806E9/online:.* online\
shellies/announce:.* { $EVENT =~ m,..id...shelly1pm-34AB953806E9...mac.*, ? json2nameValue($EVENT) : return }\
shellies/shelly1pm-34AB953806E9/announce:.* { json2nameValue($EVENT) }\
shellies/shelly1pm-34AB953806E9/relay/0/power:.* relay_0_power\
shellies/shelly1pm-34AB953806E9/relay/0/power:.* { my $compare = $EVTPART0 < 100 ? 'off':'on';; ReadingsVal($NAME,'loadState','off') ne $compare ? { loadState => $compare } : return }\
shellies/shelly1pm-34AB953806E9/temperature:.* temperature\
shellies/shelly1pm-34AB953806E9/temperature_f:.* {}\
shellies/shelly1pm-34AB953806E9/input_event/0:.* { json2nameValue($EVENT) }\
shellies/shelly1pm-34AB953806E9/overtemperature:.* overtemperature\
shellies/shelly1pm-34AB953806E9/relay/0/energy:.* { relay_0_energy => $EVENT, relay_0_kWh => sprintf("%.2f",$EVENT/60/1000)}\
shellies/shelly1pm-34AB953806E9/longpush/0:.* longpush_0\
shellies/shelly1pm-34AB953806E9/command:.* command\
shellies/shelly1pm-34AB953806E9/info:.* { json2nameValue($EVENT) }\
shellies/shelly1pm-34AB953806E9/temperature_status:.* temperature_status
attr MQTT2_shelly1pm_34AB953806E9 room MQTT2_DEVICE
attr MQTT2_shelly1pm_34AB953806E9 setList relay0:on,off,toggle shellies/shelly1pm-34AB953806E9/relay/0/command $EVTPART1\
toggle:noArg shellies/shelly1pm-34AB953806E9/relay/0/command toggle\
off:noArg shellies/shelly1pm-34AB953806E9/relay/0/command off\
on:noArg shellies/shelly1pm-34AB953806E9/relay/0/command on\
x_update:noArg shellies/shelly1pm-34AB953806E9/command update_fw\
x_mqttcom shellies/shelly1pm-34AB953806E9/command $EVTPART1
attr MQTT2_shelly1pm_34AB953806E9 setStateList on off toggle
attr MQTT2_shelly1pm_34AB953806E9 userReadings total_temp:loadState:.on { ReadingsNum($name,'relay_0_kWh',0) },wash:loadState:.off { ReadingsNum($name,'total',0) - ReadingsNum($name,'total_temp',0) },price:loadState:.off {sprintf("%.2f",ReadingsNum($name,'wash',1)*ReadingsNum('kWh_Price','state',0.30))},time:loadState:.off {strftime("%H:%M", localtime(ReadingsAge($name,'total_temp',0)-3600))}, relay_0_energy_total:relay_0_energy:.* monotonic {ReadingsNum($name,'relay_0_energy',0)}
attr MQTT2_shelly1pm_34AB953806E9 webCmd :
Alles anzeigen
was genau brauche ich daraus? Das user reading "loadState" scheint ja schon mal zu passen aber "wash" zeigt bei mir einen negativen Wert der mir auch noch etwas hoch erscheint.