Hallo Beta_User,
vielen Dank für deine Hilfe. Einen fhem update habe ich gerade gemacht, hat nicht geholfen.
Anbei die Infos ..
###########################################
# $Id: mqtt2.template 25920 2022-04-05 05:38:54Z Beta-User $
#
# Comments start with #. Empty lines are ignored.
# Syntax of one entry: name: line, one optional filter: line, zero or more par: lines, FHEM-Commands
# filter:INTERNAL=VALUE (optional)
# par: name of the parameter; comment; perl_code (optional)
# perl_code returns a value for the parameter, or undef.
# If undef, the user has to specify them (the comment is shown to the user)
Applies to single relay Shelly devices offering energy measuring like Shelly 1PM or Shelly Plug S
attr DEVICE setList\
relay0:on,off,toggle shellies/DEVNAME/relay/0/command $EVTPART1\
toggle:noArg shellies/DEVNAME/relay/0/command toggle\
off:noArg shellies/DEVNAME/relay/0/command off\
on:noArg shellies/DEVNAME/relay/0/command on\
x_update:noArg shellies/DEVNAME/command update_fw\
x_mqttcom shellies/DEVNAME/command $EVTPART1
attr DEVICE readingList \
shellies/DEVNAME/relay/0:.* {{ state => $EVENT, relay0 => $EVENT}}\
shellies/DEVNAME/input/0:.* input0\
shellies/DEVNAME/online:.* online\
shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : return }\
shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\
shellies/DEVNAME/relay/0/power:.* relay_0_power\
shellies/DEVNAME/relay/0/power:.* { my $compare = $EVTPART0 < 100 ? 'off':'on'; ReadingsVal($NAME,'loadState','off') ne $compare ? { loadState => $compare } : return }\
shellies/DEVNAME/temperature:.* temperature\
shellies/DEVNAME/temperature_f:.* {}\
shellies/DEVNAME/input_event/0:.* { json2nameValue($EVENT) }\
shellies/DEVNAME/overtemperature:.* overtemperature\
shellies/DEVNAME/relay/0/energy:.* { relay_0_energy => $EVENT, relay_0_kWh => sprintf("%.2f",$EVENT/60/1000)}\
shellies/DEVNAME/longpush/0:.* longpush_0
attr DEVICE 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'); "".FW_makeImage($onl)." ".FW_makeImage($light)."
Verbrauch: $cons / Total: $total/ Temp: $temp °C
"}
attr DEVICE comment To get appropriate loadState values: Change the default limit "100" in readingList to your needs.
attr DEVICE webCmd :
attr DEVICE setStateList on off toggle
deletereading -q DEVICE (?!associatedWith|IODev).*
set DEVICE x_mqttcom announce
attr DEVICE model shelly1_w_energy_measuring
setreading DEVICE attrTemplateVersion 20220404
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_switch
option:{ RADIO_SETUSERREADING }
attr DEVICE userReadings NEWUSERREADINGS