diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index f5c0080aa..8a417a6bb 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -25,6 +25,8 @@ par:IODEVNAME;Name of the IO-Device; { AttrVal("DEVICE","IODev",undef) } par:DEVTYPE;TYPE of the device; { InternalVal("DEVICE","TYPE",undef)} par:DEVCID;CID of the device as written in the DEF; { InternalVal(AttrVal("DEVICE","IODev",""),"clientId","mosquitto") eq InternalVal("DEVICE","DEF","mosquitto") ? "MQTT2_GeneralBridge" : InternalVal("DEVICE","DEF","mosquitto")} par:NEWDEVROOM;Room of the calling device; {AttrVal("DEVCID","room","MQTT2_\DEVICE" )} +par:ICON;ICON as set, defaults to mqtt;{ AttrVal("DEVICE","icon","mqtt") } +attr DEVICE icon ICON defmod DEVCID MQTT2_\DEVICE DEVCID attr DEVCID bridgeRegexp \ (tele|cmnd)[/]([^/]+)[/].*:.* "$2"\ @@ -269,6 +271,8 @@ attr DEVICE model zigbee2mqtt_smokeDetector name:zigbee2mqtt_hueMotionSensor filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_04 +par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } +attr DEVICE icon ICON attr DEVICE stateFormat T: temperature_weather B: illuminance L: linkquality attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } attr DEVICE userReadings temperature_weather { sprintf("%.1f",ReadingsVal($name,"temperature","")+2.5) } @@ -280,6 +284,8 @@ desc: Should work e.g. with Osram smart+plug
Untested updated version order:L_05 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ 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 readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } attr DEVICE setList \ @@ -294,6 +300,8 @@ desc: Preliminary version reserved for plugs with energy measuring features like order:L_05a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to message_socket;{ AttrVal("DEVICE","icon","message_socket") } +attr DEVICE icon ICON set DEVICE attrTemplate zigbee2mqtt_smart+plug #missing readingList with sth. comparable to shellies/shellyplug-s-123456/relay/0/power:.* { my $limit = 100;; my $compare = $EVTPART0<$limit ? "off":"on";; ReadingsVal($NAME,"loadState","on") eq $compare ? undef: {loadState => $compare} } #and additional devStateIcon @@ -348,6 +356,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_08 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } +attr DEVICE icon ICON attr DEVICE stateFormat Motion: occupancy Luminance: illuminance attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -361,6 +371,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_08a par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } +attr DEVICE icon ICON attr DEVICE stateFormat Motion: occupancy T: temperature attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -373,6 +385,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_09 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to people_sensor;{ AttrVal("DEVICE","icon","people_sensor") } +attr DEVICE icon ICON attr DEVICE stateFormat Motion: action X: angle_x Y: angle_y Z: angle_z attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -397,6 +411,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_11 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } +attr DEVICE icon ICON attr DEVICE stateFormat click attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -409,6 +425,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_12 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } +attr DEVICE icon ICON attr DEVICE stateFormat Click: click Action: action attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -420,6 +438,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_13 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to control_home;{ AttrVal("DEVICE","icon","control_home") } +attr DEVICE icon ICON attr DEVICE stateFormat Click: click attr DEVICE readingList BASE_TOPIC/DEV_ID:.* { json2nameValue($EVENT) } deletereading -q DEVICE (?!associatedWith).* @@ -443,6 +463,8 @@ filter:TYPE=MQTT2_DEVICE:FILTER=CID=zigbee.* order:L_15 par:BASE_TOPIC;base topic set in configuration.yaml of the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].*:, ? $1 : undef } par:DEV_ID;name of the device in the zigbee2mqtt bridge;{ AttrVal("DEVICE","readingList","") =~ m,[^/]+[/]([^/]+).*:, ? $1 : undef } +par:ICON;ICON as set, defaults to secur_alarm;{ AttrVal("DEVICE","icon","secur_alarm") } +attr DEVICE icon ICON attr DEVICE setList \ sensitivity:low,medium,high BASE_TOPIC/DEV_ID/set {"sensitivity":"$EVTPART1"} attr DEVICE stateFormat Action: action X: angle_x Y: angle_y Z: angle_z @@ -463,6 +485,8 @@ order:A_01a par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}cmnd$3" : undef } par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}tele$3" : undef } par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/LWT:, ? "${1}stat$3" : undef } +par:ICON;ICON as set, defaults to hue_filled_outlet;{ AttrVal("DEVICE","icon","hue_filled_outlet") } +attr DEVICE icon ICON attr DEVICE stateFormat POWER1 set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 attr DEVICE setList \