diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 0680f455e..ccc424459 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -537,7 +537,7 @@ attr DEVICE_CH3 setList \ off:noArg $\DEVICETOPIC/3/set {"state_l3":"OFF"}\ toggle:noArg $\DEVICETOPIC/3/set {"state_l3":"TOGGLE"} 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 attrTemplate speechcontrol_type_switch +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 @@ -1077,8 +1077,7 @@ attr DEVICE_CH2 icon ICON attr DEVICE_CH2 comment Channel 2 (USB outlets) for DEVICE attr DEVICE_CH2 devStateIcon on:usb:off off:usb@red:on attr DEVICE_CH2 setStateList on off toggle -set DEVICE attrTemplate speechcontrol_type_switch -set DEVICE_CH2 attrTemplate speechcontrol_type_switch \NOTDELAYED=0 +set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model tasmota_POW_USB_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210903 @@ -1120,8 +1119,7 @@ attr DEVICE_CH2 webCmdLabel Helligkeit\ attr DEVICE_CH2 devStateIcon {Color::devStateIcon($name,"rgb","Color","pct","state")} attr DEVICE_CH2 setStateList on off toggle deletereading -q DEVICE_CH2 (?!associatedWith|IODev).* -set DEVICE attrTemplate speechcontrol_type_switch -set DEVICE_CH2 attrTemplate speechcontrol_type_light_255 \NOTDELAYED=0 +set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2 model tasmota_plug_with_rgbw_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210903 @@ -1270,6 +1268,7 @@ par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attribu par:SETCHANNELINFO;Set this to 0 to not set channelinfo;{ 1 } set DEVICE attrTemplate tasmota_basic_state_power1 \CALLSPEECHRECOGN=0 copy DEVICE DEVICE_CH2 +defmod DEVICE_CH2 DEVICE_CH2 deleteattr DEVICE_CH2 alias attr DEVICE_CH2 readingList \ STATTOPIC/POWER2:.* state @@ -1280,12 +1279,11 @@ attr DEVICE_CH2 setList \ toggle:noArg CMNDTOPIC/POWER2 2 attr DEVICE_CH2 setStateList on off toggle attr DEVICE,DEVICE_CH2 model tasmota_2channel_split -setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20200529 +setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20211030 option:{SETCHANNELINFO} set DEVICE attrTemplate set_associatedWith \CHANNELS=2 option:{ CALLSPEECHRECOGN } -set DEVICE attrTemplate speechcontrol_type_switch -set DEVICE_CH2 attrTemplate speechcontrol_type_switch \NOTDELAYED=0 +set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch # sonoff 2 channel device flashed with Tasmota with dual energy meassuring. Source: https://forum.fhem.de/index.php/topic,122231.0.html @@ -1324,8 +1322,7 @@ setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210728 option:{SETCHANNELINFO} set DEVICE attrTemplate set_associatedWith \CHANNELS=2 option:{ CALLSPEECHRECOGN } -set DEVICE attrTemplate speechcontrol_type_switch -set DEVICE_CH2 attrTemplate speechcontrol_type_switch \NOTDELAYED=0 +set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch #contributed by 87insane @@ -1570,7 +1567,6 @@ deletereading -q DEVICE (?!associatedWith|IODev).* # prime Tasmota device set DEVICE attrTemplate tasmota_set_lowercase_texts_and_state1 # additional settings to aid speech recognition to detect capabilities properly -set DEVICE attrTemplate speechcontrol_type_switch # add some attributes to make your new device looking great attr DEVICE icon ICON attr DEVICE comment Admin Info and Channel 1 for DEVICE, see also DEVICE_CH2, DEVICE_CH3, and DEVICE_USB @@ -1612,10 +1608,22 @@ attr DEVICE userReadings formatedUptime:state_UptimeSec.* { my $m = ReadingsVal( setreading DEVICE associatedWith DEVICE_CH2,DEVICE_CH3,DEVICE_USB # # create devices for 2nd, 3rd and 4th channel -copy DEVICE DEVICE_CH2 -attr DEVICE_CH2 setStateList on off toggle -copy DEVICE_CH2 DEVICE_CH3 -copy DEVICE_CH2 DEVICE_USB +loop:#:2:3:4 +copy DEVICE DEVICE_CH# +defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH# +attr DEVICE_CH# setStateList on off toggle +attr DEVICE_CH# setList \ + off:noArg CMNDTOPIC/POWER# 0\ + on:noArg CMNDTOPIC/POWER# 1\ + toggle:noArg CMNDTOPIC/POWER# 2 +attr DEVICE_CH# readingList \ + TELETOPIC/LWT:.* LWT\ + TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ + TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ + STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + STATTOPIC/POWER#:.* state +loop:END +rename DEVICE_CH4 DEVICE_USB # setreading DEVICE_CH2 associatedWith DEVICE,DEVICE_CH3,DEVICE_USB setreading DEVICE_CH3 associatedWith DEVICE,DEVICE_CH2,DEVICE_USB @@ -1625,38 +1633,6 @@ attr DEVICE_CH2 comment Channel 2 for DEVICE, see also DEVICE_CH3 and DEVICE_USB attr DEVICE_CH3 comment Channel 3 for DEVICE, see also DEVICE_CH2 and DEVICE_USB attr DEVICE_USB comment Channel 4 (USB) for DEVICE, see also DEVICE_CH2 and DEVICE_CH3 # -attr DEVICE_CH2 setList \ - off:noArg CMNDTOPIC/POWER2 0\ - on:noArg CMNDTOPIC/POWER2 1\ - toggle:noArg CMNDTOPIC/POWER2 2 -attr DEVICE_CH3 setList \ - off:noArg CMNDTOPIC/POWER3 0\ - on:noArg CMNDTOPIC/POWER3 1\ - toggle:noArg CMNDTOPIC/POWER3 2 -attr DEVICE_USB setList \ - off:noArg CMNDTOPIC/POWER4 0\ - on:noArg CMNDTOPIC/POWER4 1\ - toggle:noArg CMNDTOPIC/POWER4 2 -# -attr DEVICE_CH2 readingList \ - TELETOPIC/LWT:.* LWT\ - TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ - TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ - STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ - STATTOPIC/POWER2:.* state -attr DEVICE_CH3 readingList \ - TELETOPIC/LWT:.* LWT\ - TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ - TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ - STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ - STATTOPIC/POWER3:.* state -attr DEVICE_USB readingList \ - TELETOPIC/LWT:.* LWT\ - TELETOPIC/INFO.:.* { $EVENT =~ m,^..Info[1-3]..(.+).$, ? json2nameValue($1,'',$JSONMAP) : json2nameValue($EVENT,'',$JSONMAP) }\ - TELETOPIC/STATE:.* { json2nameValue($EVENT,'state_',$JSONMAP) }\ - STATTOPIC/STATUS:.* { json2nameValue($EVENT,'',$JSONMAP) }\ - STATTOPIC/POWER4:.* state -# # we want state to represent 2nd channel. # keep all POWERx readings to allow period tele/STATE messages to update relay state reading # Suppress all other readings on split device. These readings are visible on first device only. @@ -1674,8 +1650,9 @@ attr DEVICE_USB icon rc_USB set IO_DEV publish CMNDTOPIC/status set IO_DEV publish CMNDTOPIC/restart 1 farewell:Template has been applied successfully. Wait some seconds for reboot to complete and watch readings get populated. +set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB attrTemplate speechcontrol_type_switch attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB model tasmota_3socketUSB_channel_split -setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB attrTemplateVersion 20210607 +setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_USB attrTemplateVersion 20211030 # tasmota 4ch as one FHEM device. @@ -1798,50 +1775,18 @@ par:STATTOPIC;ack topic prefix, without trailing /;{ AttrVal("DEVICE","readingLi set DEVICE attrTemplate tasmota_2channel_split CALLSPEECHRECOGN=0 SETCHANNELINFO=0 attr DEVICE jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 POWER5:0 POWER6:0 POWER7:0 POWER8:0 attr DEVICE_CH2 jsonMap POWER1:0 POWER2:0 POWER3:0 POWER4:0 POWER5:0 POWER6:0 POWER7:0 POWER8:0 Dimmer:pct Channel_4:white Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 POWER1:0 Heap:0 LedTable:0 LoadAvg:0 MqttCount:0 SaveData:0 Scheme:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 SetOption26:0 Sleep:0 SleepMode:0 Speed:0 StateText1:0 StateText2:0 StateText3:0 StateText4:0 Time:0 Uptime:0 UptimeSec:0 Wifi_SSId:0 Wifi_RSSI:0 Wifi_LinkCount:0 Wifi_Downtime:0 Wifi_Channel:0 Wifi_BSSId:0 Wifi_AP:0 ANALOG_A0:0 -copy DEVICE_CH2 DEVICE_CH3 -attr DEVICE_CH3 setList \ - off:noArg CMNDTOPIC/POWER3 0\ - on:noArg CMNDTOPIC/POWER3 1\ - toggle:noArg CMNDTOPIC/POWER3 2 -attr DEVICE_CH3 readingList \ - STATTOPIC/POWER3:.* state -copy DEVICE_CH2 DEVICE_CH4 -attr DEVICE_CH4 setList \ - off:noArg CMNDTOPIC/POWER4 0\ - on:noArg CMNDTOPIC/POWER4 1\ - toggle:noArg CMNDTOPIC/POWER4 2 -attr DEVICE_CH4 readingList \ - STATTOPIC/POWER4:.* state -copy DEVICE_CH2 DEVICE_CH5 -attr DEVICE_CH5 setList \ - off:noArg CMNDTOPIC/POWER5 0\ - on:noArg CMNDTOPIC/POWER5 1\ - toggle:noArg CMNDTOPIC/POWER5 2 -attr DEVICE_CH5 readingList \ - STATTOPIC/POWER5:.* state -copy DEVICE_CH2 DEVICE_CH6 -attr DEVICE_CH6 setList \ - off:noArg CMNDTOPIC/POWER6 0\ - on:noArg CMNDTOPIC/POWER6 1\ - toggle:noArg CMNDTOPIC/POWER6 2 -attr DEVICE_CH6 readingList \ - STATTOPIC/POWER6:.* state -copy DEVICE_CH2 DEVICE_CH7 -attr DEVICE_CH7 setList \ - off:noArg CMNDTOPIC/POWER7 0\ - on:noArg CMNDTOPIC/POWER7 1\ - toggle:noArg CMNDTOPIC/POWER7 2 -attr DEVICE_CH7 readingList \ - STATTOPIC/POWER7:.* state -copy DEVICE_CH2 DEVICE_CH8 -attr DEVICE_CH8 setList \ - off:noArg CMNDTOPIC/POWER8 0\ - on:noArg CMNDTOPIC/POWER8 1\ - toggle:noArg CMNDTOPIC/POWER8 2 -attr DEVICE_CH8 readingList \ - STATTOPIC/POWER8:.* state +loop:#:3:4:5:6:7:8 +copy DEVICE_CH2 DEVICE_CH# +defmod DEVICE_CH# MQTT2_\DEVICE DEVICE_CH# +attr DEVICE_CH# setList \ + off:noArg CMNDTOPIC/POWER# 0\ + on:noArg CMNDTOPIC/POWER# 1\ + toggle:noArg CMNDTOPIC/POWER# 2 +attr DEVICE_CH# readingList \ + STATTOPIC/POWER#:.* state +loop:END attr DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 model tasmota_8channel_split -setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20200830 +setreading DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplateVersion 20211030 set DEVICE attrTemplate set_associatedWith \CHANNELS=8 set DEVICE,DEVICE_CH2,DEVICE_CH3,DEVICE_CH4,DEVICE_CH5,DEVICE_CH6,DEVICE_CH7,DEVICE_CH8 attrTemplate speechcontrol_type_switch @@ -2251,7 +2196,7 @@ attr DEVICE_CH2 readingList \ attr DEVICE_CH2 setList on CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":2,"send":{"Power":"On"}}\ off CMNDTOPIC/ZbSend {"device":"0xDEV_ID","Endpoint":2,"send":{"Power":"Off"}} option:{ CALLSPEECHRECOGN } -set DEVICE attrTemplate speechcontrol_type_switch +set DEVICE,DEVICE_CH2 attrTemplate speechcontrol_type_switch option:global attr DEVICE,DEVICE_CH2 model tasmota_zigbee2tasmota_2channel_split setreading DEVICE,DEVICE_CH2 attrTemplateVersion 20210811 @@ -2414,6 +2359,7 @@ setreading DEVICE attrTemplateVersion 20211006 name:shelly1 filter:TYPE=MQTT2_DEVICE par:DEVNAME;Shelly1 name in the topic;{ AttrVal("DEVICE","readingList","") =~ m,shellies/([^/]*)/, ? $1 : undef } +par:CALLSPEECHRECOGN;Set this to 0 to not set any speech recogn. related attributes;{ 1 } order:A_10 attr DEVICE setList\ off:noArg shellies/DEVNAME/relay/0/command off\ @@ -2430,9 +2376,11 @@ attr DEVICE readingList \ attr DEVICE devStateIcon {my $onl = ReadingsVal($name,"online","false") eq "false" ? "rot" : ReadingsVal($name,"new_fw","false") eq "true" ? "gelb" : "gruen"; my $light = ReadingsVal($name,"state","off"); my $show = '" : "http://".ReadingsVal($name,"ip","none").' "target="_blank">'; $show .= FW_makeImage("10px-kreis-".$onl).""; "