diff --git a/FHEM/lib/AttrTemplate/mqtt2.template b/FHEM/lib/AttrTemplate/mqtt2.template index ffe607e20..5988b8546 100644 --- a/FHEM/lib/AttrTemplate/mqtt2.template +++ b/FHEM/lib/AttrTemplate/mqtt2.template @@ -424,6 +424,7 @@ attr DEVICE devicetopic BASE_TOPIC/DEV_ID attr DEVICE readingList $\DEVICETOPIC:.* { json2nameValue($EVENT,'',$JSONMAP) } attr DEVICE jsonMap contact:state deletereading -q DEVICE (?!associatedWith).* +set DEVICE attrTemplate speech_recognition_gdt_and_mapping GENERICDEVTYPE=contact HOMEBRIDGEMAPPING= "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" attr DEVICE model zigbee2mqtt_ContactSensor name:zigbee2mqtt_TempHumHpaSensor @@ -1207,6 +1208,40 @@ attr DEVICE webCmdLabel Helligkeit\ set DEVICE attrTemplate speech_recognition_type_light attr DEVICE model tasmota_rgbwct_led +name:tasmota_cct_led +filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* +desc:Tasmota CCT bulb or CCT LED controller +order:A_05a3 +set DEVICE attrTemplate tasmota_basic_state_power1 +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 light_control;{ AttrVal("DEVICE","icon","light_control") } +attr DEVICE icon ICON +deletereading -q DEVICE (?!associatedWith).* +attr DEVICE setList\ + off:noArg CMNDTOPIC/POWER1 0\ + on:noArg CMNDTOPIC/POWER1 1\ + toggle:noArg CMNDTOPIC/POWER1 2\ + CT:colorpicker,CT,153,5,500 CMNDTOPIC/CT\ + pct:colorpicker,BRI,0,5,100 CMNDTOPIC/DIMMER +attr DEVICE readingList \ + TELETOPIC/LWT:.* LWT\ + TELETOPIC/STATE:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + TELETOPIC/SENSOR:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + TELETOPIC/INFO.:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + TELETOPIC/UPTIME:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + STATTOPIC/RESULT:.* { json2nameValue($EVENT,'',$JSONMAP) }\ + STATTOPIC/RESULT:.* { $EVENT =~ m,HSBColor...(\d+)\,(\d+)\,(\d+), ? $2 eq ReadingsVal($NAME,"saturation","unknown") ? undef :{"saturation"=>$2} : undef }\ + STATTOPIC/POWER1:.* state +attr DEVICE jsonMap POWER1:0 Dimmer:pct Channel_4:0 Channel_1:0 Channel_2:0 Channel_3:0 HSBColor:0 +attr DEVICE webCmd pct:CT + +attr DEVICE devStateIcon {Color::devStateIcon($name,"dimmer",undef,"pct","state")} +attr DEVICE setStateList on off toggle +set DEVICE attrTemplate speech_recognition_type_light +attr DEVICE model tasmota_cct_led + #source post: https://forum.fhem.de/index.php/topic,105364.0.html name:tasmota_TuyaMCU_dimmer filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*(tele|cmnd|stat).* diff --git a/FHEM/lib/AttrTemplate/mysensors.template b/FHEM/lib/AttrTemplate/mysensors.template index 60a3f055a..d1eeb4fc6 100644 --- a/FHEM/lib/AttrTemplate/mysensors.template +++ b/FHEM/lib/AttrTemplate/mysensors.template @@ -70,6 +70,7 @@ desc:Applies to standard relay actuator sketch attr DEVICE setCommands on:status1:on off:status1:off attr DEVICE setExtensionsEvent 1 attr DEVICE devStateIcon .*on:on .*off:off on.(for.timer|till.*):on-for-timer:off off.(for.timer|till.*):off-for-timer:on blink.*:light_toggle:off +set DEVICE attrTemplate speech_recognition_type_switch attr DEVICE model A_24a_Relay_Actuator diff --git a/FHEM/lib/AttrTemplate/speechrecogn.template b/FHEM/lib/AttrTemplate/speechrecogn.template index 077d38672..304fc2300 100644 --- a/FHEM/lib/AttrTemplate/speechrecogn.template +++ b/FHEM/lib/AttrTemplate/speechrecogn.template @@ -20,7 +20,7 @@ desc:template to set speech recognition attributes for genericDeviceType switch option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} attr DEVICE genericDeviceType switch option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_type_light @@ -30,7 +30,7 @@ desc:template to set speech recognition attributes for genericDeviceType light option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} attr DEVICE genericDeviceType light option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_type_light_255 @@ -44,7 +44,7 @@ attr DEVICE genericDeviceType light attr DEVICE homebridgeMapping Brightness=brightness::brightness,maxValue=100,factor=0.39216,delay=true #attr DEVICE userReadings NEWUSERREADINGS option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_type_blind @@ -54,7 +54,7 @@ desc:template to set speech recognition attributes for genericDeviceType blind option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} attr DEVICE genericDeviceType blind option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_type_thermostate @@ -64,7 +64,7 @@ desc:template to set speech recognition attributes for genericDeviceType thermos option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} attr DEVICE genericDeviceType thermostate option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_gdt_only @@ -75,27 +75,27 @@ option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $ par:GENERICDEVTYPE;GENERICDEVTYPE , defaults to contact;{ "contact" } attr DEVICE genericDeviceType GENERICDEVTYPE option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_gdt_and_mapping filter:NAME=speechrecognTesting order:100007 -desc:generic template to set speech recognition attributes for to any genericDeviceType including full mapping, call e.g. with set xy attrTemplate speech_recognition_gdt_and_mapping GENERICDEVTYPE=Security HOMEBRIDGEMAPPING= "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" +desc:generic template to set speech recognition attributes for to any genericDeviceType including full mapping, call e.g. with set xy attrTemplate speech_recognition_gdt_and_mapping GENERICDEVTYPE=contact HOMEBRIDGEMAPPING= "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} par:GENERICDEVTYPE;GENERICDEVTYPE , defaults to contact;{ "contact" } par:HOMEBRIDGEMAPPING;HOMEBRIDGEMAPPING, defaults to "some split-by-semicolon-compatible represantation or the expression to the right";{ 'ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED' } attr DEVICE genericDeviceType GENERICDEVTYPE attr DEVICE homebridgeMapping HOMEBRIDGEMAPPING option:TYPE=siri -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} option:TYPE=gassistant name:speech_recognition_alaxaName_firstrun filter:NAME=speechrecognTesting order:1000020a desc:generic template to set speech recognition attribute alexaName, call e.g. with set xy attrTemplate speech_recognition_alaxaName_firstrun ALEXANAME=myAlexaName -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} par:ALEXANAME;Please enter alexaName;{ AttrVal("DEVICE","alexaName",undef) } attr DEVICE alexaName ALEXANAME set DEVICE attrTemplate speech_recognition_alaxaName_secondrun ALEXAISNAME=ALEXANAME @@ -104,12 +104,12 @@ name:speech_recognition_alaxaName_secondrun filter:NAME=speechrecognTesting order:1000020b desc:generic template to doublecheck alexaName attribute setting to avoid doubletes , call e.g. with set xy attrTemplate speech_recognition_alaxaName_secondrun ALEXAISNAME=myAlexaName -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} par:ALEXAISNAME;Please enter alexaName;{ AttrVal("DEVICE","alexaName",undef) } option:{my @devices=devspec2array("alexaName=ALEXAISNAME");; $devices[1] ? return 1 : return 0} par:ALEXANAME;Please enter alexaName (you may be asked multiple times to avoid already existing names);{undef) } attr DEVICE alexaName ALEXANAME -option:TYPE=alexa +option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0} #set DEVICE attrTemplate speech_recognition_alaxaName_firstrun