diff --git a/FHEM/lib/AttrTemplate/mqtt2.template b/FHEM/lib/AttrTemplate/mqtt2.template index f80574b18..12ab7e50d 100644 --- a/FHEM/lib/AttrTemplate/mqtt2.template +++ b/FHEM/lib/AttrTemplate/mqtt2.template @@ -783,7 +783,8 @@ attr DEVICE readingList \ shellies/DEVNAME/relay/0:.* relay0\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ - shellies/DEVNAME/announce:.* { json2nameValue($EVENT) } + shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef } deletereading -q DEVICE (?!associatedWith).* attr DEVICE model A_10_shelly1 @@ -812,6 +813,7 @@ attr DEVICE readingList \ shellies/DEVNAME/relay/0:.* relay0\ shellies/DEVNAME/input/0:.* input0\ shellies/DEVNAME/online:.* online\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ shellies/DEVNAME/relay/0/power:.* relay_0_power\ shellies/DEVNAME/temperature:.* temperature\ @@ -842,6 +844,7 @@ attr DEVICE readingList \ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/roller/0:.* state\ shellies/DEVNAME/input/1:.* input1\ shellies/DEVNAME/input/0:.* input0 @@ -872,6 +875,7 @@ attr DEVICE readingList \ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/roller/0:.* current\ shellies/DEVNAME/roller/0:open {{'state' => 'opening'}}\ shellies/DEVNAME/roller/0:close {{'state' => 'closing'}}\ @@ -912,6 +916,7 @@ attr DEVICE readingList \ shellies/DEVNAME/status/0/rollers:.* power\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/roller/0:.* current\ shellies/DEVNAME/roller/0:open {{'state' => 'opening'}}\ shellies/DEVNAME/roller/0:close {{'state' => 'closing'}}\ @@ -1022,6 +1027,7 @@ attr DEVICE readingList \ shellies/DEVNAME/input/3:.* input3\ shellies/DEVNAME/online:.* online\ shellies/DEVNAME/announce:.* { json2nameValue($EVENT) }\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef }\ shellies/DEVNAME/relay/0/power:.* power0\ shellies/DEVNAME/relay/1/power:.* power1\ shellies/DEVNAME/relay/2/power:.* power2\ @@ -1049,9 +1055,12 @@ par:DEVNAME;name of this shelly;{ AttrVal("DEVICE","readingList","") =~ m,shelli attr DEVICE setList\ off:noArg shellies/DEVNAME/color/0/command off\ on:noArg shellies/DEVNAME/color/0/command on\ - pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"turn":"on","gain":"$EVTPART1","brightness":"$EVTPART1"}\ - ct:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if ($EVTPART1<3000);"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"temp\":\"$EVTPART1\"}"}\ - rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3){"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"shellies/shellybulb-3CC533/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"brightness\":".int(hex($1)/2.55)."}"}}\ + pct:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"gain":"$EVTPART1","brightness":"$EVTPART1"}\ + pct_on:colorpicker,BRI,0,1,100 shellies/DEVNAME/color/0/set {"turn":"on","gain":"$EVTPART1","brightness":"$EVTPART1"}\ + ct:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if ($EVTPART1<3000);"shellies/DEVNAME/color/0/set {\"mode\":\"white\",\"temp\":\"$EVTPART1\"}"}\ + ct_on:colorpicker,CT,3000,10,6500 {$EVTPART1=3000 if ($EVTPART1<3000);"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"temp\":\"$EVTPART1\"}"}\ + rgb:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3){"shellies/DEVNAME/color/0/set {\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"brightness\":".int(hex($1)/2.55)."}"}}\ + rgb_on:colorpicker,RGB {$EVTPART1=~/(..)(..)(..)/;if($1 ne $2 || $2 ne $3){"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"color\",\"gain\":\"100\",\"red\":".hex($1).",\"green\":".hex($2).",\"blue\":".hex($3)."}"}else{"shellies/DEVNAME/color/0/set {\"turn\":\"on\",\"mode\":\"white\",\"brightness\":".int(hex($1)/2.55)."}"}}\ x_update:noArg shellies/DEVNAME/command update_fw\ x_mqttcom shellies/DEVNAME/command $EVTPART1 deletereading -q DEVICE status_.* @@ -1094,12 +1103,13 @@ attr DEVICE setList\ deletereading -q DEVICE status_.* attr DEVICE readingList \ shellies/DEVNAME/color/0/status:.* {json2nameValue($EVENT)}\ - shellies/DEVNAME/color/0:.* state + shellies/DEVNAME/color/0:.* state\ + shellies/announce:.* { $EVENT =~ m,..id...DEVNAME...mac.*, ? json2nameValue($EVENT) : undef } attr DEVICE userReadings rgb:red.* {if(ReadingsVal($name,"mode","") eq "color"){sprintf("%02X%02X%02X", ReadingsVal($name,"red",99), ReadingsVal($name,"green",99), ReadingsVal($name,"blue",99))}else{my $a=sprintf("%02X",ReadingsVal($name,"brightness",0)*2.555);"$a$a$a"}} attr DEVICE webCmd on:off:white:gain:rgb:effect attr DEVICE setStateList on off attr DEVICE icon light_control -attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "true"?"10px-kreis-gruen":"10px-kreis-rot";; my $light = ReadingsVal($name,"state","off");; "".FW_makeImage($onl)." ".FW_makeImage($light).""} +attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "true"?"10px-kreis-gruen":"10px-kreis-rot";; my $light = ReadingsVal($name,"state","off");; my $cons = ReadingsVal($name,"power","unknown");; "".FW_makeImage($onl)." ".FW_makeImage($light)."