From e19a9a189f341d76b281980d54e6bff20e39e4a8 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Wed, 17 Jun 2020 06:06:56 +0000 Subject: [PATCH] mqtt2.template: bugfixes in shelly2/2.5; other small changes git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@22187 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/lib/AttrTemplate/general_use.template | 3 +++ FHEM/lib/AttrTemplate/mqtt2.template | 21 ++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/FHEM/lib/AttrTemplate/general_use.template b/FHEM/lib/AttrTemplate/general_use.template index 8337baacb..232e7d239 100644 --- a/FHEM/lib/AttrTemplate/general_use.template +++ b/FHEM/lib/AttrTemplate/general_use.template @@ -124,3 +124,6 @@ setreading DEVICE_CH5 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEV setreading DEVICE_CH6 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH7,DEVICE_CH8 setreading DEVICE_CH7 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH8 setreading DEVICE_CH8 associatedWith DEVICE,DEVICE_CH1,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7 + +option:{1} +show DEVICE.* diff --git a/FHEM/lib/AttrTemplate/mqtt2.template b/FHEM/lib/AttrTemplate/mqtt2.template index bd3f0fb2d..bf8684be6 100644 --- a/FHEM/lib/AttrTemplate/mqtt2.template +++ b/FHEM/lib/AttrTemplate/mqtt2.template @@ -1784,7 +1784,10 @@ attr DEVICE readingList \ shellies/DEVNAME/relay/power:.* power\ shellies/DEVNAME/relay/energy:.* energy\ shellies/DEVNAME/temperature:.* temperature\ - shellies/DEVNAME/overtemperature:.* overtemperature + shellies/DEVNAME/overtemperature:.* overtemperature\ + shellies/DEVNAME/roller/0/power:.* roller_0_power\ + shellies/DEVNAME/roller/0/energy:.* roller_0_energy\ + shellies/DEVNAME/temperature_f:.* temperature_f attr DEVICE devStateIcon { my $amp = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $con = ReadingsVal($name,"state","unknown");; $con = 100 - $con if $con =~ /\d+/;; my $pic = $con eq "opening" ? 'fts_shutter_up@red' : $con eq "closing" ? 'fts_shutter_down@red' : $con eq "100" ? 'fts_shutter_100' : $con =~ /(\d)\d/ ? 'fts_shutter_'.$1.'0' : $con =~ /\b\d\b/ ? 'fts_shutter_10' : 'fts_shutter_updown';; my $show = "$amp" eq "gelb" ? "".FW_makeImage("10px-kreis-".$amp)."" : "".FW_makeImage("10px-kreis-".$amp)."";; "
$show ".FW_makeImage($pic)."
"} attr DEVICE cmdIcon open:fts_shutter_up close:fts_shutter_down stop:fts_shutter_manual half:fts_shutter_50 attr DEVICE webCmd :open:close:half:stop:pct @@ -1793,7 +1796,7 @@ attr DEVICE setStateList open close half stop pct set DEVICE x_mqttcom announce set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model shelly25_roller_invert_0 -setreading DEVICE attrTemplateVersion 20200522 or prior +setreading DEVICE attrTemplateVersion 20200617 name:shelly25_roller_invert_1 filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* @@ -1825,7 +1828,10 @@ attr DEVICE readingList \ shellies/DEVNAME/relay/power:.* power\ shellies/DEVNAME/relay/energy:.* energy\ shellies/DEVNAME/temperature:.* temperature\ - shellies/DEVNAME/overtemperature:.* overtemperature + shellies/DEVNAME/overtemperature:.* overtemperature\ + shellies/DEVNAME/roller/0/power:.* roller_0_power\ + shellies/DEVNAME/roller/0/energy:.* roller_0_energy\ + shellies/DEVNAME/temperature_f:.* temperature_f attr DEVICE devStateIcon { my $amp = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen";; my $con = ReadingsVal($name,"state","unknown");; my $pic = $con eq "opening" ? 'fts_shutter_up@red' : $con eq "closing" ? 'fts_shutter_down@red' : $con eq "100" ? 'fts_shutter_100' : $con =~ /(\d)\d/ ? 'fts_shutter_'.$1.'0' : $con =~ /\b\d\b/ ? 'fts_shutter_10' : 'fts_shutter_updown';; my $show = "$amp" eq "gelb" ? "".FW_makeImage("10px-kreis-".$amp)."" : "".FW_makeImage("10px-kreis-".$amp)."";; "
$show ".FW_makeImage($pic)."
"} attr DEVICE cmdIcon open:fts_shutter_up close:fts_shutter_down stop:fts_shutter_manual half:fts_shutter_50 attr DEVICE webCmd :open:close:half:stop:pct @@ -1834,7 +1840,7 @@ attr DEVICE setStateList open close half stop pct set DEVICE x_mqttcom announce #set DEVICE attrTemplate speechcontrol_type_blind attr DEVICE model shelly25_roller_invert_1 -setreading DEVICE attrTemplateVersion 20200522 or prior +setreading DEVICE attrTemplateVersion 20200617 # shelly2 using original firmware. # NOTE: a second device will be created for the second channel @@ -1844,7 +1850,7 @@ desc:shelly2 using original firmware.
NOTE: a second device will be created order:A_11a set DEVICE attrTemplate shellyplug par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } -set DEVICE attrTemplate set_associatedWith \CHANNELS=2 +set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state attr DEVICE_CH2 setList \ off:noArg shellies/DEVNAME/relay/1/command off\ @@ -1862,7 +1868,7 @@ order:A_11a1 par:DEVNAME;Shelly2 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } set DEVICE attrTemplate shelly1_w_energy_meassuring \CALLSPEECHRECOGN=0 -set DEVICE attrTemplate set_associatedWith \CHANNELS=2 +set DEVICE attrTemplate set_associatedWith \CHANNELS=2 \MAKECOPIES=1 attr DEVICE_CH2 readingList shellies/DEVNAME/relay/1:.* state\ shellies/DEVNAME/relay/1:.* relay1\ shellies/DEVNAME/input/1:.* input1\ @@ -3239,7 +3245,8 @@ attr DEVICE setList mowerRainDelay:slider,0,30,1440 BASE_TOPIC/DEV_ID/commandIn mowerTimeCorrection:slider,-100,1,100 BASE_TOPIC/DEV_ID/commandIn {"sc":{"p":$EVTPART1}}\ startMower:noArg BASE_TOPIC/DEV_ID/commandIn {"cmd":1}\ pauseMower:noArg BASE_TOPIC/DEV_ID/commandIn {"cmd":2}\ - stopMower:noArg BASE_TOPIC/DEV_ID/commandIn {"cmd":3} + stopMower:noArg BASE_TOPIC/DEV_ID/commandIn {"cmd":3}\ + x_raw_payload:textField { my $payload = $EVENT;$payload =~ s/$EVTPART0 //g; qq(BASE_TOPIC/DEV_ID/commandIn $payload)} attr DEVICE userReadings mowerActive:mowerActiveIndex.* {ReadingsVal($name,"mowerActiveIndex","0") ? "true" : "false"},\ mowerStatusTxt:mowerStatusIndex.* {my %stateCodes = (\ 0 => "Idle",\