From d59233481029e5eabc6f52154242dc2db68b1b5b Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Thu, 23 Jun 2022 16:54:27 +0000 Subject: [PATCH] mqtt2.template: change zigbee2mqtt state to lowercase, #128115 ; add shelly2plus pm shutter git-svn-id: https://svn.fhem.de/fhem/trunk@26167 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/lib/AttrTemplate/mqtt2.template | 201 ++++++++++++---------- 2 files changed, 113 insertions(+), 89 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 18c436934..9ce634e69 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - change: mqtt2.template: zigbee2mqtt now uses lowercase state - bugfix: 79_Klafs: minor bugfix for date format - bugfix: 38_netatmo: fixed csrf error on home notification settings - bugfix: 10_SOMFY: Correct match for long commands according to #msg1224029 diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 753895ee8..da6f55aca 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -209,14 +209,14 @@ name:zigbee2mqtt_light_dimmer desc: A dimmable light connected via zigbee2mqtt
Tested with: Tradfri LED1650R5 + LED1649C5, Osram Lightify W32 filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02a -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -224,20 +224,20 @@ attr DEVICE setList \ attr DEVICE setStateList on off set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_dimmer -setreading DEVICE attrTemplateVersion 20200904 +setreading DEVICE attrTemplateVersion 20220622 # A dimmable color light connected via zigbee2mqtt name:zigbee2mqtt_light_cct filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable light with color temperature via zigbee2mqtt
Tested with: tradfri FLOALT panel WS 30x90 order:L_02b -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON attr DEVICE webCmd toggle:on:off:brightness:ct attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -247,45 +247,43 @@ attr DEVICE setList \ attr DEVICE jsonMap color_temp:ct color_temp_startup:ct_startup set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_cct -setreading DEVICE attrTemplateVersion 20211019 +setreading DEVICE attrTemplateVersion 20220622 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgb_hex filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable rgb light connected via zigbee2mqtt
rgb value is encoded as HEX value
Experimental, still untested order:L_02c -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} -attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,"color_x",0),ReadingsVal($name,"color_y",0),ReadingsVal($name,"brightness",254))} +attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,'color_x',0),ReadingsVal($name,'color_y',0),ReadingsVal($name,'brightness',254))} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_hex -setreading DEVICE attrTemplateVersion 20200904 +setreading DEVICE attrTemplateVersion 20220622 name:zigbee2mqtt_light_rgb_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable rgb light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Experimental, still untested order:L_02c -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:color attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -293,22 +291,21 @@ attr DEVICE setList \ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgb_rgb -setreading DEVICE attrTemplateVersion 20200904 +setreading DEVICE attrTemplateVersion 20220622 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgbw_hex filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: A dimmable rgbw light connected via zigbee2mqtt
rgb value is encoded as HEX value
tested with Mueller Light tint RGBW bulb order:L_02d -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:warm:white:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -317,26 +314,25 @@ attr DEVICE setList \ ct:colorpicker,CT,250,1,454 $\DEVICETOPIC/set {"color_temp":"$EVTPART1"}\ brightness:colorpicker,BRI,0,5,255 $\DEVICETOPIC/set {"state":"on","$EVTPART0":"$EVTPART1"}\ hex:colorpicker,HEX,0,15,255 $\DEVICETOPIC/set {"color":{"$EVTPART0":"#$EVTPART1"}} -attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,"color_x",0),ReadingsVal($name,"color_y",0),ReadingsVal($name,"brightness",254))} +attr DEVICE userReadings hex:color_y.* {Color::xyY2hex(ReadingsVal($name,'color_x',0),ReadingsVal($name,'color_y',0),ReadingsVal($name,'brightness',254))} attr DEVICE jsonMap color_temp:ct set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_hex -setreading DEVICE attrTemplateVersion 20211018 +setreading DEVICE attrTemplateVersion 20220622 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgbw_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02d1 desc: A dimmable rgbw light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Experimental, still untested -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:color:white attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -345,22 +341,21 @@ attr DEVICE setList \ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbw_rgb -setreading DEVICE attrTemplateVersion 20200904 +setreading DEVICE attrTemplateVersion 20220622 #source post: https://forum.fhem.de/index.php/topic,96985.msg902627.html#msg902627 name:zigbee2mqtt_light_rgbcct_hex desc: A dimmable rgb light connected via zigbee2mqtt
rgb value is encoded as HEX value
Experimental, still untested filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02e -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:hex attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -370,22 +365,21 @@ attr DEVICE setList \ set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE jsonMap color_temp:ct attr DEVICE model zigbee2mqtt_light_rgbcct_hex -setreading DEVICE attrTemplateVersion 20211018 +setreading DEVICE attrTemplateVersion 20220622 #source post: https://forum.fhem.de/index.php/topic,97303.msg905935.html#msg905935 name:zigbee2mqtt_light_rgbcct_rgb filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_02e1 desc: A dimmable rgb-cct light connected via zigbee2mqtt
rgb values will be sent as individual values r,g and b
Tested with: RGB-CCT GL-C-008 -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal("DEVICE","icon","hue_filled_white_and_color_e27_b22") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to hue_filled_white_and_color_e27_b22;{ AttrVal('DEVICE','icon','hue_filled_white_and_color_e27_b22') } attr DEVICE icon ICON -attr DEVICE stateFormat {lc ReadingsVal($name,"state",0)} attr DEVICE devStateIcon {zigbee2mqtt_devStateIcon255($name)} attr DEVICE webCmd toggle:on:off:brightness:ct:color attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -394,7 +388,7 @@ attr DEVICE setList \ color:colorpicker,RGB {"$\DEVICETOPIC/set ".zigbee2mqtt_RGB2JSON($EVTPART1)} set DEVICE attrTemplate speechcontrol_type_light_255 attr DEVICE model zigbee2mqtt_light_rgbcct_rgb -setreading DEVICE attrTemplateVersion 20211018 +setreading DEVICE attrTemplateVersion 20220622 # zigbee2mqtt 2 channel dimmer device name:zigbee2mqtt_2channel_dimmer_split @@ -405,9 +399,8 @@ par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to light_control;{ AttrVal('DEVICE','icon','light_control') } attr DEVICE icon ICON -attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 brightness_l1:brightness brightness_l2:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/l1/set {"state":"ON"}\ @@ -428,7 +421,7 @@ deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* attr DEVICE_CH2 jsonMap state_l1:0 state_l2:state state:0 consumption:0 linkquality:0 power:0 temperature:0 brightness_l1:0 brightness_l2:brightness set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_light_255 attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_dimmer_split -setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20211207 +setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220622 # zigbee2mqtt air purifier name:zigbee2mqtt_air_purifier @@ -439,9 +432,8 @@ par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } par:ICON;ICON as set, defaults to Ventilator_wind;{ AttrVal('DEVICE','icon','Ventilator_wind') } attr DEVICE icon ICON -attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE getList state:noArg state $\DEVICETOPIC/get {"fan_state": ""}\ fan_speed:noArg fan_speed $\DEVICETOPIC/get {"fan_speed": ""}\ pm25:noArg pm25 $\DEVICETOPIC/get {"pm25": ""}\ @@ -458,7 +450,7 @@ attr DEVICE setStateList on off toggle attr DEVICE webCmd fan_mode deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_air_purifier -setreading DEVICE attrTemplateVersion 20211207 +setreading DEVICE attrTemplateVersion 20220622 # zigbee2mqtt air quality sensor name:zigbee2mqtt_air_quality @@ -471,12 +463,12 @@ par:ICON;ICON as set, defaults to feinstaub_pm25;{ AttrVal('DEVICE','icon','fein attr DEVICE icon ICON attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC/availability:.* availability\ - $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } + $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE jsonMap battery:batteryPercent voltage:batterymV attr DEVICE stateFormat air quality: air_quality, VOC: voc, Hum: humidity deletereading -q DEVICE (?!associatedWith|IODev).* attr DEVICE model zigbee2mqtt_air_quality -setreading DEVICE attrTemplateVersion 20211207 +setreading DEVICE attrTemplateVersion 20220622 name:zigbee2mqtt_smokeDetector filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* @@ -512,13 +504,12 @@ name:zigbee2mqtt_plug filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: Should work e.g. with Osram smart+plug order:L_05 -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to message_socket;{ AttrVal('DEVICE','icon','message_socket') } attr DEVICE icon ICON -attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE setList \ on:noArg $\DEVICETOPIC/set {"state":"ON"}\ off:noArg $\DEVICETOPIC/set {"state":"OFF"}\ @@ -526,29 +517,28 @@ attr DEVICE setList \ attr DEVICE setStateList on off toggle set DEVICE attrTemplate speechcontrol_type_switch attr DEVICE model zigbee2mqtt_plug -setreading DEVICE attrTemplateVersion 20200904 +setreading DEVICE attrTemplateVersion 20220622 name:zigbee2mqtt_plug_w_energy_measuring filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc: For plugs with energy measuring features like innr SP 120 or Blitzwolf Powerplug BW-SHP13 order:L_05a set DEVICE attrTemplate zigbee2mqtt_plug -attr DEVICE devStateIcon {my $light = FW_makeImage(ReadingsVal($name,"state","off")); my $current = ReadingsVal($name,"current",0); my $pwr = ReadingsVal($name,"power",0); my $energy = ReadingsVal($name,"energy",0); qq(
$light Aktuell: $current A Leistung.: $pwr W)} +attr DEVICE devStateIcon {my $light = FW_makeImage(ReadingsVal($name,'state','off')); my $current = ReadingsVal($name,'current',0); my $pwr = ReadingsVal($name,'power',0); my $energy = ReadingsVal($name,'energy',0); qq(
$light Aktuell: $current A Leistung.: $pwr W)} attr DEVICE model zigbee2mqtt_plug_w_energy_measuring -setreading DEVICE attrTemplateVersion 20200903 +setreading DEVICE attrTemplateVersion 20220622 # zigbee2mqtt 2 channel device name:zigbee2mqtt_2channel_split filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 2 channel device.
NOTE: a second device will be created for the second channel
NOTE: Untested updated version, should work with LLKZMK11LM, Ubisys S2 (-R), order:L_05c -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to message_socket;{ AttrVal('DEVICE','icon','message_socket') } attr DEVICE icon ICON -attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/l1/set {"state":"ON"}\ @@ -566,16 +556,15 @@ deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* attr DEVICE_CH2 jsonMap state_l1:0 state_l2:state state:0 consumption:0 linkquality:0 power:0 temperature:0 set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_split -setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200929 +setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220622 # zigbee2mqtt 2 channel device with buttons, forum #102866 name:zigbee2mqtt_2channel_split_w_buttons filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 2 channel device with 2 buttons.
NOTE: a second device will be created for the second channel
NOTE: Untested version, should work with Xiaomi QBKG12LM -order:Steckerleiste »Zigbee Smart Home«L_05d -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } +order:L_05d +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } set DEVICE attrTemplate zigbee2mqtt_2channel_split attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE setList \ @@ -589,20 +578,19 @@ attr DEVICE_CH2 setList \ toggle:noArg $\DEVICETOPIC/right/set {"state":"TOGGLE"} attr DEVICE_CH2 jsonMap state_left:0 state_right:state state:0 consumption:0 linkquality:0 power:0 temperature:0 attr DEVICE,DEVICE_CH2 model zigbee2mqtt_2channel_split_w_buttons -setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200904 +setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20220622 # zigbee2mqtt 3 channel device name:zigbee2mqtt_3channel_split filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* desc:For zigbee2mqtt 3 channel device like Silvercrest Steckerleiste »Zigbee Smart Home«.
NOTE: Two additional devices will be created for further channels.
NOTE: Untested updated version order:L_05e -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +par:ICON;ICON as set, defaults to message_socket;{ AttrVal('DEVICE','icon','message_socket') } attr DEVICE icon ICON -attr DEVICE eventMap { dev=>{ON=>'on',OFF=>'off'} } attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=lc($ret->{state}); return $ret } attr DEVICE jsonMap state:availability state_l1:state state_l2:0 state_l3:0 attr DEVICE setList \ on:noArg $\DEVICETOPIC/1/set {"state_l1":"ON"}\ @@ -623,7 +611,7 @@ attr DEVICE_CH3 setList \ attr DEVICE_CH2 jsonMap state_l3:state state_l1:0 state_l2:0 state:0 consumption:0 linkquality:0 power:0 temperature:0 set DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2,DEVICE_CH3 model zigbee2mqtt_3channel_split -setreading DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplateVersion 20211030 +setreading DEVICE,DEVICE_CH2,DEVICE_CH3 attrTemplateVersion 20220622 # A blind drive motor TS0601_cover connected via zigbee2mqtt #contributed by barneybaer, https://forum.fhem.de/index.php/topic,94495.msg1134215.html#msg1134215 @@ -656,17 +644,16 @@ name:zigbee2mqtt_ContactSensor desc: Contact sensor via zigbee2mqtt
Tested with: Xiaomi models Aqara and Mijia filter:TYPE=MQTT2_DEVICE:FILTER=CID~zigbee.* order:L_06 -par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } -par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","devicetopic",AttrVal("DEVICE","readingList","")) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } -attr DEVICE devStateIcon open:fts_window_1w_open@red close:fts_window_1w@green -attr DEVICE eventMap true:close false:open +par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef } +par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m,[^/]+[/]([^/:]+).*, ? $1 : undef } +attr DEVICE devStateIcon open:fts_window_1w_open@red closed:fts_window_1w@green attr DEVICE devicetopic BASE_TOPIC/DEV_ID -attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } +attr DEVICE readingList $\DEVICETOPIC:.* { my $ret=json2nameValue($EVENT,'',$JSONMAP); $ret->{state}=$ret->{state} eq 'true' ? 'closed' : 'open'; return $ret } attr DEVICE jsonMap contact:state deletereading -q DEVICE (?!associatedWith|IODev).* -set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=ContactSensor HOMEBRIDGEMAPPING=ContactSensorState=state,values=true:CONTACT_DETECTED;false:CONTACT_NOT_DETECTED +set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=ContactSensor HOMEBRIDGEMAPPING=ContactSensorState=state,values=closed:CONTACT_DETECTED;open:CONTACT_NOT_DETECTED attr DEVICE model zigbee2mqtt_ContactSensor -setreading DEVICE attrTemplateVersion 20210301 +setreading DEVICE attrTemplateVersion 20220622 name:zigbee2mqtt_TempHumHpaSensor desc: Temp/hum/hpa sensor via zigbee2mqtt
Tested with: Xiaomi Aqara WSDCGQ11LM Temperature Humidity Sensor @@ -3231,7 +3218,6 @@ attr DEVICE model shellyflood setreading DEVICE attrTemplateVersion 20211019 - # shellygas using original firmware name:shellygas filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*shellies.* @@ -3492,6 +3478,43 @@ setreading DEVICE attrTemplateVersion 20220303 option:{ CALLSPEECHRECOGN } set DEVICE attrTemplate speechcontrol_type_switch +# Shelly Plus 2 PM using original firmware in roller mode. +# based on tomleitner sample, https://forum.fhem.de/index.php/topic,128138.msg1225786.html#msg1225786 +name:shellyPlus_2pm_roller_invert_0 +filter:TYPE=MQTT2_DEVICE +desc:Early version of the template - for second generation shelly devices (names with "plus", with power measurement). NOTE: requires to activate generic status update in firmware settings (if not available: reset device to factory defaults) and activation of the roller mode.
NOTE: Please wait some seconds to allow Shelly device to complete reboot. +order:A_20c1a +par:DEV_TPC;Shelly name in the topic;{ AttrVal('DEVICE','devicetopic',AttrVal('DEVICE','readingList','')) =~ m<(shellies/[^/]+|shellyp(lus|ro4pm)[^/:_]{4,}+)> ? $1 : undef } +par:ICON;ICON as set, defaults to fts_shutter;{ AttrVal('DEVICE','icon','fts_shutter') } +attr DEVICE icon ICON +attr DEVICE devicetopic DEV_TPC +attr DEVICE comment Shelly Plus 2 PM in Roller-Mode. 100=opened / 0=closed +attr DEVICE readingList $\DEVICETOPIC/online:.* online\ + $\DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\ + $\DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\ + $\DEVICETOPIC/status/cover_0:.* { json2nameValue($EVENT, 'status_', $JSONMAP) }\ + fhem2shelly/rpc:.* {} + +attr DEVICE setList open:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Cover.Open","params": {"id":0}}\ + close:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Cover.Close","params": {"id":0}}\ + half:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Cover.GoToPosition","params": {"id":0,"pos":50}}\ + stop:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Cover.Stop","params": {"id":0}}\ + pct:slider,0,1,100 $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Cover.GoToPosition","params": {"id":0,"pos":$EVTPART1}}\ + x_update:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Update","params": {"stage":"stable"}}\ + x_reboot:noArg $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Shelly.Reboot"}\ + x_eco:true,false $\DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Sys.SetConfig","params": {"config": {"device": {"eco_mode": $EVTPART1}}}} +attr DEVICE jsonMap status_state:state status_current_pos:pct status_temperature_tC:temperature +attr DEVICE devStateIcon opening:fts_shutter_up@red closing:fts_shutter_down@red true:10px-kreis-gruen false:10px-kreis-rot 0:fts_shutter_100 100:fts_shutter_10 9\d:fts_shutter_10 8\d:fts_shutter_20 7\d:fts_shutter_30 6\d:fts_shutter_40 5\d:fts_shutter_50 4\d:fts_shutter_60 3\d:fts_shutter_70 2\d:fts_shutter_80 1\d:fts_shutter_90 0\d:fts_shutter_100 set_.*:fts_shutter_updown +attr DEVICE stateFormat online\ +pct +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 +deletereading -q DEVICE (?!associatedWith|IODev).* +attr DEVICE setStateList open close half stop pct +set DEVICE attrTemplate speechcontrol_type_blind +attr DEVICE model shellyPlus_2pm_roller_invert_0 +setreading DEVICE attrTemplateVersion 20220623 + name:shellypro4pm filter:TYPE=MQTT2_DEVICE