From 773ef4dca1defc34bef49f5c08f56d5729ded921 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Fri, 7 Aug 2020 09:32:47 +0000 Subject: [PATCH] mqtt2.template: additions in tasmota2zigbee section git-svn-id: https://svn.fhem.de/fhem/trunk@22552 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 49 +++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index c240f7794..ec0637144 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -1642,7 +1642,9 @@ set IO_DEV publish CMNDTOPIC/Backlog StateText1 off; StateText2 on; StateText3 t par:ICON;ICON as set, defaults to MQTT;{ AttrVal("DEVICE","icon","mqtt") } attr DEVICE icon ICON attr DEVICE setList permit_join:0,1,99 CMNDTOPIC/ZbPermitJoin $EVTPART1\ - x_ZbSend:textField CMNDTOPIC/zbsend {"device":"0x$EVTPART1","send":{"$EVTPART2":"$EVTPART3"}} + x_ZbSend:textField CMNDTOPIC/ZbSend {"device":"0x$EVTPART1","send":{"$EVTPART2":"$EVTPART3"}}\ + z_ZbBind_single:textField CMNDTOPIC/ZbBind {"Device":"$EVTPART1","ToDevice":"0x$EVTPART2","Endpoint":$EVTPART3,"ToEndpoint":$EVTPART4,"Cluster":$EVTPART5}\ + z_ZbBind_group:textField CMNDTOPIC/ZbBind {"Device":"$EVTPART1","ToGroup":"0x$EVTPART2","Endpoint":$EVTPART3,"Cluster":$EVTPART4} attr DEVICE bridgeRegexp \ TELETOPIC/([^/]+)/SENSOR:.* "z2t_$1" attr DEVICE readingList \ @@ -1653,7 +1655,7 @@ attr DEVICE readingList \ set IO_DEV publish CMNDTOPIC/restart 1 attr DEVICE model tasmota_zigbee2tasmota_bridge deletereading -q DEVICE (?!associatedWith).* -setreading DEVICE attrTemplateVersion 20200804_1 +setreading DEVICE attrTemplateVersion 20200807 { AttrTemplate_Initialize() } @@ -1724,11 +1726,36 @@ attr DEVICE model tasmota_zigbee2tasmota_light_cct_hue setreading DEVICE attrTemplateVersion 20200805 +name:tasmota_zigbee2tasmota_single_switch +prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*tele.*/..../SENSOR:.* +desc:This template is meant to configure a simple on/off relay switch device like Osram Müller Licht Tint smart switch (on/off).
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! +order:A_01u03 +par:CMNDTOPIC;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*)?/[^/]+/SENSOR:, ? "${1}cmnd$3" : undef } +par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : undef } +par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR?:, ? "$3" : undef } +par:ICON;ICON as set, defaults to light_control;{ AttrVal("DEVICE","icon","light_control") } +par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } +attr DEVICE icon ICON +attr DEVICE readingList \ + TELETOPIC:.* { $EVENT =~ s/"Power":1/"Power":"on"/g; $EVENT =~ s/"Power":0/"Power":"off"/g; $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } +attr DEVICE setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"On"}}\ + off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","send":{"Power":"Off"}} +attr DEVICE setStateList on off +attr DEVICE setExtensionsEvent 1 +attr DEVICE jsonMap Power:state Device:0 +deletereading -q DEVICE (?!associatedWith).* +option:{ CALLSPEECHRECOGN } +set DEVICE attrTemplate speechcontrol_type_switch +attr DEVICE model tasmota_zigbee2tasmota_single_switch +setreading DEVICE attrTemplateVersion 20200806 + + name:tasmota_zigbee2tasmota_generic_battery_sensor prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*tele.*/..../SENSOR:.* desc:This template is meant to configure an arbitrary battery powered ZigBee sensor.
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! -order:A_01u03 +order:A_01u04 par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : undef } par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR?:, ? "$3" : undef } par:ICON;ICON as set, defaults to temperature_humidity;{ AttrVal("DEVICE","icon","temperature_humidity") } @@ -1743,6 +1770,22 @@ attr DEVICE model tasmota_zigbee2tasmota_generic_battery_sensor setreading DEVICE attrTemplateVersion 20200805_1 +name:tasmota_zigbee2tasmota_remote_control +prereq:{my @devices=devspec2array("model=tasmota_zigbee2tasmota_bridge");;return 1 if $devices[0];;return 0} +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*tele.*/..../SENSOR:.* +desc:This template is meant to configure an arbitrary zigbee remote control unit.
NOTE: Early testing version, not yet tested, just build according to https://forum.fhem.de/index.php/topic,112253.0.html
Might still need some changes! +order:A_01u04a +par:TELETOPIC;info topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)(/.*/[^/]+/SENSOR)?:, ? "${1}tele$3" : undef } +par:DEV_ID;ZigBee short ID, hex value without leading 0x;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\b(tele|cmnd|stat)/.*/([^/]+)/SENSOR?:, ? "$3" : undef } +par:ICON;ICON as set, defaults to tradfri_remote;{ AttrVal("DEVICE","icon","tradfri_remote") } +attr DEVICE icon ICON +attr DEVICE readingList \ + TELETOPIC:.* { $EVENT =~ m,([0-9]{4}![0-9]{2}), ? { 'state'=>$1 } ? : $EVENT =~ m,^.*(..Device.+)..$, ? json2nameValue($1,'',$JSONMAP) : $EVENT =~ m,0xDEV_ID.:(.*).., ? json2nameValue($1,'',$JSONMAP) : undef } +attr DEVICE jsonMap Battery:batteryPercent Device:0 BatteryPercentage:0 +deletereading -q DEVICE (?!associatedWith).* +attr DEVICE model tasmota_zigbee2tasmota_remote_control +setreading DEVICE attrTemplateVersion 20200807 + ########################################### # SHELLY