diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 9961688f9..5f5971ad1 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -28,6 +28,7 @@ attr DEVICE readingList\ BASE_TOPIC/bridge/config/log_level:.* log_level\ BASE_TOPIC/bridge/config/permit_join:.* permit_join\ BASE_TOPIC/bridge/config/rename:.* { json2nameValue($EVENT, 'rename_') }\ + BASE_TOPIC/bridge/log:.*\"type\".\"devices\".\"message\".* devices\ BASE_TOPIC/bridge/log:.* log\ BASE_TOPIC/bridge/networkmap:.* {}\ BASE_TOPIC/bridge/networkmap/graphviz:.* graphviz\ @@ -138,7 +139,7 @@ filter:TYPE=MQTT2_DEVICE desc:Applies to Sonoff Basic, S20 using POWER1-topic for relay state
Use this in case "SetOption26 1" was used as described in tasmota documentation
NOTE: This template is intended to configure also channel one of multi-channel tasmota devices par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef } par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef } -attr DEVICE stateFormat {lc ReadingsVal("$name","POWER1","") } +attr DEVICE stateFormat POWER1 attr DEVICE eventMap { dev=>{'^(.*)POWER(.?): OFF$'=>'$1POWER$2: off', '^(.*)POWER(.?): ON$'=>'$1POWER$2: on'} } attr DEVICE setList \ off:noArg COMMAND/POWER1 0\ @@ -155,17 +156,17 @@ attr DEVICE readingList \ deletereading DEVICE .* attr DEVICE autocreate 0 attr DEVICE model A_01a_tasmota_basic_state_power1 -attr DEVICE setList \ - off:noArg COMMAND/POWER 0\ - on:noArg COMMAND/POWER 1\ - toggle:noArg COMMAND/POWER 2 - # sonoff 1 channel device flashed with Tasmota. +# sonoff 1 channel device flashed with Tasmota. name:A_01_tasmota_basic filter:TYPE=MQTT2_DEVICE desc:Applies to Sonoff 1 Channel devices using POWER-topic for relay state
Use this in case "SetOption26 1" was used as described in tasmota documentation set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 -attr DEVICE stateFormat {lc ReadingsVal("$name","POWER","") } +attr DEVICE stateFormat POWER +attr DEVICE setList \ + off:noArg COMMAND/POWER 0\ + on:noArg COMMAND/POWER 1\ + toggle:noArg COMMAND/POWER 2 attr DEVICE model A_01_tasmota_basic name:A_01x_tasmota_sensors_only @@ -221,18 +222,14 @@ attr DEVICE model A_01b_tasmota_1ch+motion+SI7021 # tasmota 2ch as one FHEM device. name:A_02a_tasmota_2ch_unified filter:TYPE=MQTT2_DEVICE -desc:Configures a single device including all readings
NOTE: untested! +desc:Configures a single device including all readings set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef } attr DEVICE setList \ - POWER1:on,off cmnd/DEVNAME/POWER1 $EVTPART1\ - POWER2:on,off cmnd/DEVNAME/POWER2 $EVTPART1 + POWER1:on,off,toggle cmnd/DEVNAME/POWER1 $EVTPART1\ + POWER2:on,off,toggle cmnd/DEVNAME/POWER2 $EVTPART1 attr DEVICE webCmd POWER1 on:POWER1 off:POWER2 on:POWER2 off -attr DEVICE stateFormat {\ - "
P1:" . FW_makeImage(lc ReadingsVal($name, "POWER1", "off"))\ - . " P2:" . FW_makeImage(lc ReadingsVal($name, "POWER2", "off"))\ - . "
"\ - } +attr DEVICE stateFormat P1: POWER1 P2: POWER2 attr DEVICE model A_02a_tasmota_2ch_unified # sonoff 2 channel device flashed with Tasmota. @@ -243,7 +240,7 @@ set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 par:COMMAND;Command topic prefix, without trailing /;{ AttrVal("DEVICE","readingList","") =~ m,([^:]*)\btele(/.*)?/LWT:, ? "${1}cmnd$2" : undef } attr DEVICE comment Channel 1 for DEVICE, see also DEVICE_CH2 copy DEVICE DEVICE_CH2 -attr DEVICE_CH2 stateFormat {lc ReadingsVal("$name","POWER2","")} +attr DEVICE_CH2 stateFormat POWER2 attr DEVICE_CH2 comment Channel 2 for DEVICE setreading DEVICE_CH2 associatedWith DEVICE attr DEVICE_CH2 setList \ @@ -254,7 +251,7 @@ attr DEVICE model A_02_tasmota_2channel_split # tasmota 4ch as one FHEM device. -name:A_04a_tasmota_4ch_unified +name:A_04b_tasmota_4ch_unified_icon filter:TYPE=MQTT2_DEVICE desc:Configures a single device including all readings set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 @@ -272,11 +269,11 @@ attr DEVICE stateFormat {\ . " P4:" . FW_makeImage(lc ReadingsVal($name, "POWER4", "off"))\ . ""\ } -attr DEVICE model A_04a_tasmota_4ch_unified +attr DEVICE model A_04b_tasmota_4ch_unified_icon # tasmota 4ch as one FHEM device. -name:A_04b_tasmota_4ch_unified_test -desc:Configures a single device including all readings
uses multiline for webCmd
NOTE: untested! +name:A_04a_tasmota_4ch_unified_basic_text +desc:Configures a single device filter:TYPE=MQTT2_DEVICE set DEVICE attrTemplate A_01a_tasmota_basic_state_power1 par:DEVNAME;ESP's name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,tele/([^/]*)/, ? $1 : undef } @@ -293,7 +290,7 @@ attr DEVICE setList POWER1:on,off,toggle cmnd/DEVNAME/POWER1 $EVTPART1\ attr DEVICE setStateList on off toggle attr DEVICE stateFormat P1: POWER1 P2: POWER2 P3: POWER3 P4: POWER4 attr DEVICE webCmd POWER1 toggle:POWER2 toggle:POWER3 toggle:POWER4 toggle -attr DEVICE model A_04b_tasmota_4ch_unified_test +attr DEVICE model A_04a_tasmota_4ch_unified_basic_text ###########################################