From e19c72cc5937b6b47aafc578e368870a36f030df Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Sun, 28 Nov 2021 05:10:05 +0000 Subject: [PATCH] mqtt2.template: bugfixes in first versions for shelly plus git-svn-id: https://svn.fhem.de/fhem/trunk@25268 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 25 +++++++++++++++++------ fhem/MAINTAINER.txt | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 07ab0c04c..00e2aa2df 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -3238,9 +3238,9 @@ setreading DEVICE attrTemplateVersion 20200831 # # 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 +name:shellyPlus_1 filter:TYPE=MQTT2_DEVICE -desc:First experimental version of a base template for second generation shelly devices (names with "plus") +desc:First experimental version of a base template for second generation shelly devices (names with "plus", without power measurement) 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 @@ -3252,7 +3252,7 @@ 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}}\ + on-for-timer $\DEVICETOPIC/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\ @@ -3260,13 +3260,26 @@ attr DEVICE readingList $\DEVICETOPIC/online:.* online\ $\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(${onl}${light}
Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C
)} +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,'switch_0_output','false') =~ m{false|off}?'off':'on';; $light = FW_makeImage($light);; my $ip = ReadingsVal($name,'ip','none');; qq(${onl}${light})} 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 20211123 +attr DEVICE model shellyPlus_1 +setreading DEVICE attrTemplateVersion 20211128 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch +# Shelly Plus 1PM using original firmware. +name:shellyPlus_1pm +filter:TYPE=MQTT2_DEVICE +desc:First experimental version of a base template for second generation shelly devices (names with "plus", with power measurement) +par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } +order:A_20a +set DEVICE attrTemplate shellyPlus_1 CALLSPEECHRECOGN=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'; $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(${onl}${light}
Verbrauch: $cons W / Total: $total kwh / Temp: $temp °C
)} +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 20211128 +option:{ CALLSPEECHRECOGN } +set DEVICE attrTemplate speechcontrol_type_switch ########################################### # ESPurna diff --git a/fhem/MAINTAINER.txt b/fhem/MAINTAINER.txt index cab346285..6862a0f18 100644 --- a/fhem/MAINTAINER.txt +++ b/fhem/MAINTAINER.txt @@ -646,6 +646,7 @@ contrib/META.json.full.txt loredo FHEM Development contrib/META.json.txt loredo FHEM Development contrib/PRESENCE markusbloch Unterstützende Dienste contrib/PRESENCE/lepresenced PatrickR Unterstützende Dienste +contrib/RHASSPY/* drhirn/Beta-User Frontends/Sprachsteuerung contrib/SIP/* Wzut Sonstiges contrib/WebViewControl/* Dirk Mobile Devices contrib/Widgets/DateTimePicker* Matscher Frontends