diff --git a/FHEM/lib/AttrTemplate/mqtt2.template b/FHEM/lib/AttrTemplate/mqtt2.template index 56c60823c..9ee6044a5 100644 --- a/FHEM/lib/AttrTemplate/mqtt2.template +++ b/FHEM/lib/AttrTemplate/mqtt2.template @@ -2696,16 +2696,28 @@ attr DEVICE setList\ off:noArg BASE_ID/DEVNAME status off\ toggle:noArg BASE_ID/DEVNAME status t\ rgb:colorpicker,RGB BASE_ID/DEVNAME/col #$EVTPART1\ - brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME + brightness:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME\ + speed:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api http://DEVNAME/win&SX=$EVTPART1\ + intensity:colorpicker,BRI,0,1,255 BASE_ID/DEVNAME/api http://DEVNAME/win&IX=$EVTPART1\ + palette:selectnumbers,0,1,46,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&FP=$EVTPART1\ + effect:selectnumbers,0,1,101,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&FX=$EVTPART1\ + loadPreset:selectnumbers,0,1,3,0,lin BASE_ID/DEVNAME/api http://DEVNAME/win&PL=$EVTPART1 attr DEVICE readingList \ BASE_ID/DEVNAME/g:.* brightness\ BASE_ID/DEVNAME/c:.* {{"rgb"=>substr("$EVENT",1,6)}}\ - BASE_ID/DEVNAME/v:.* api + BASE_ID/DEVNAME/v:.* api\ + BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/sx>), ? $1 eq ReadingsVal($NAME,"speed","unknown") ? undef : {"speed"=>$1} : undef }\ + BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/ix>), ? $1 eq ReadingsVal($NAME,"intensity","unknown") ? undef : {"intensity"=>$1} : undef }\ + BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/fp>), ? $1 eq ReadingsVal($NAME,"palette","unknown") ? undef : {"palette"=>$1} : undef }\ + BASE_ID/DEVNAME/v:.* {$EVENT =~ m,(?<=)([\d]+)(?=<\/fx>), ? $1 eq ReadingsVal($NAME,"effect","unknown") ? undef :{"effect"=>"$1"} : undef } deletereading -q DEVICE (?!associatedWith).* attr DEVICE devStateIcon {Color::devStateIcon( $name, "rgb", "rgb", "brightness", "state" )} -attr DEVICE webCmd rgb:brightness +attr DEVICE eventMap /effect 0:Solid/effect 2:Breathe/effect 63:Pride/effect 48:Police/ +attr DEVICE webCmd rgb:brightness:Solid:Breathe:Pride:Police +attr DEVICE setStateList on off toggle attr DEVICE comment For questions about the use of different widgets for color selection see discussion at https://forum.fhem.de/index.php/topic,98880.msg995308.html set DEVICE attrTemplate speech_recognition_type_light_255 +farewell:template has been applied successfully.
Note: webCmd and eventMap are just examples; adopt this to your needs. attr DEVICE model wled_controller #source post: https://forum.fhem.de/index.php/topic,105457.msg993924.html#msg993924 diff --git a/FHEM/lib/AttrTemplate/speechrecogn.template b/FHEM/lib/AttrTemplate/speechrecogn.template index bed91b511..9fa3ca809 100644 --- a/FHEM/lib/AttrTemplate/speechrecogn.template +++ b/FHEM/lib/AttrTemplate/speechrecogn.template @@ -63,3 +63,42 @@ option:TYPE=siri option:TYPE=alexa option:TYPE=gassistant +name:speech_recognition_type_sensor_security +filter:NAME=speechrecognTesting +order:100006 +desc:call e.g. with set attrTemplate speech_recognition_type_sensor_security HOMEBRIDGEMAPPING_READING="state" HOMEBRIDGEMAPPING_TYPE="waterAlarm" +option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0} +par:HOMEBRIDGEMAPPING_READING;HOMEBRIDGEMAPPING_READING , defaults to state;{ "state" } +par:HOMEBRIDGEMAPPING_TYPE;HOMEBRIDGEMAPPING_TYPE , defaults to fireAlarm;{ "fireAlarm" } +attr DEVICE genericDeviceType Security +attr DEVICE homebridgeMapping Alarm=HOMEBRIDGEMAPPING_READING,type=HOMEBRIDGEMAPPING_TYPE +option:TYPE=siri +option:TYPE=alexa +set DEVICE attrTemplate speech_recognition_alexa_proactive_events_questions +option:TYPE=gassistant + +name:speech_recognition_type_sensor_contact +filter:NAME=speechrecognTesting +order:100007 +desc:call e.g. with set xy attrTemplate speech_recognition_type_sensor_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:HOMEBRIDGEMAPPING;HOMEBRIDGEMAPPING, defaults to "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED";{ "ContactSensorState=state,values=closed:CONTACT_DETECTED;;open:CONTACT_NOT_DETECTED" } +attr DEVICE genericDeviceType contact +attr DEVICE homebridgeMapping HOMEBRIDGEMAPPING +option:TYPE=siri +option:TYPE=alexa +set DEVICE attrTemplate speech_recognition_alexa_proactive_events_questions +option:TYPE=gassistant + +name:speech_recognition_alexa_proactive_events_questions +filter:NAME=speechrecognTesting +order:100015 +#the following line could be enhanced by setting the defaults to what is set in the alexa device +par:RADIO_ALEXA_GLOBAL;get global setting;{undef} +par:RADIO_ALEXA_LOCAL_YES;get local setting, defaults to no;{ AttrVal("DEVICE","alexaProactiveEvents",undef)} +par:RADIO_ALEXA_LOCAL_NO;get local setting, defaults to no;{ AttrVal("DEVICE","alexaProactiveEvents",undef)} +option:{ RADIO_ALEXA_LOCAL_YES } +attr DEVICE alexaProactiveEvents 1 +option:{ RADIO_ALEXA_LOCAL_NO } +attr DEVICE alexaProactiveEvents 0 +