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(