Irgendwie gibt es jetzt an verschiedenen Stellen diverse "Häppchen", aber das sinnstiftend zusammenzubasteln, ist irgendwie schwierig.
Hier mal ein erster Wurf zum Thema als Diskussionsgrundlage, mit "ein bißchen von hier und ein bißchen von da".
Irgendwie werde ich den Verdacht nicht los, dass man da manches noch streamlinen kann und sollte, v.a. wg. dieses "true"=>"on"-Themas, aber dazu fehlt irgendwie auch etwas "Futter" (also der vollst. MQTT-Verkehr für diverse Fälle)...
###########################################
# SHELLY plus section
#
# shelly devices using the V2 MQTT API https://shelly-api-docs.shelly.cloud/gen2/Overview/RPCChannels#mqtt
# Shelly Plus 1PM using original firmware.
name:shellyPlus_1pm
filter:TYPE=MQTT2_DEVICE
par:DEV_TOPIC;Shelly name in the topic;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m<(shellies/[^/]+/|shellyplus[^/:_]{4,}+)> ? $1 : undef }
par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 }
order:A_20
par:ICON;ICON as set, defaults to message_socket;{ AttrVal('DEVICE','icon','message_socket') }
deletereading -q DEVICE (?!associatedWith|IODev).*
attr DEVICE icon ICON
attr DEVICE devicetopic DEV_TOPIC
attr DEVICE setList\
toggle:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Toggle","params": {"id":0}}\
off:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":false}}\
on:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true}}\
on-for-timer shellies/light_bath_cabinet/rpc {"id":0,"src":"fhem","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
x_update:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Update","params": {"stage":"stable"}}\
x_reboot:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem","method":"Shelly.Reboot"}
attr DEVICE readingList $\DEVICETOPIC/online:.* online\
$\DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT,'',$JSONMAP) }\
$\DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$\DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$\DEVICETOPIC/status/switch_0:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }
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'; $onl = FW_makeImage($onl); my $light = ReadingsVal($name,'output','false') =~ m{false|off}?'off':'on'; $light = FW_makeImage($light); my $cons = ReadingsNum($name,'apower',0); my $total = round(ReadingsNum($name,'aenergy_total',0)/1000,1); my $temp = ReadingsVal($name,'temperature','-100'); my $ip = ReadingsVal($name,'ip','none'); qq(<a href="http://$ip"target="_blank">${onl}</a><a href="/fhem?cmd.dummy=set $name toggle&XHR=1">${light}</a><div>Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C</div>)}
attr DEVICE jsonMap params_switch_0_aenergy_total:aenergy_total params_switch_0_apower:apower temperature_tC:temperature temperature_tF:0 params_wifi_sta_ip:ip
attr DEVICE model shellyPlus_1pm
setreading DEVICE attrTemplateVersion 20211122
option:{ CALLSPEECHRECOGN }
set DEVICE attrTemplate speechcontrol_type_switch
Merkzettel für mich selbst: evtl. kann auch hashKeyRename() weiterhelfen.