mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 16:56:04 +00:00
121 lines
7.0 KiB
Plaintext
121 lines
7.0 KiB
Plaintext
###########################################
|
|
# $Id: speechrecogn.template first version 2020-02-28 Beta-User $
|
|
#
|
|
# This file provides add-on templates for use with speech recognistion modules
|
|
# Originally developped for mqtt2-device, see forum thread here: https://forum.fhem.de/index.php/topic,99195.0.html
|
|
#
|
|
# NOTE: one of the following modules must be installed as a prerequisite for this set of templates to work: siri, alexa, gassistant
|
|
#
|
|
# Comments start with #. Empty lines are ignored.
|
|
# Syntax of one entry: name: line, one optional filter: line, zero or more par: lines, FHEM-Commands
|
|
# filter:INTERNAL=VALUE (optional)
|
|
# par: name of the parameter; comment; perl_code (optional)
|
|
# perl_code returns a value for the parameter, or undef.
|
|
# If undef, the user has to specify them (the comment is shown to the user)
|
|
|
|
name:speech_recognition_type_switch
|
|
filter:NAME=speechrecognTesting
|
|
order:100001
|
|
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:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
option:TYPE=gassistant
|
|
|
|
name:speech_recognition_type_light
|
|
filter:NAME=speechrecognTesting
|
|
order:100002
|
|
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:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
option:TYPE=gassistant
|
|
|
|
name:speech_recognition_type_light_255
|
|
filter:NAME=speechrecognTesting
|
|
order:100003
|
|
desc:template to set speech recognition attributes for genericDeviceType light - brightness in 255 steps
|
|
option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0}
|
|
set DEVICE attrTemplate speech_recognition_type_light
|
|
#par:NEWUSERREADINGS;NEWUSERREADINGS as set if sr_brightness is included, otherwise it will be added;{ my $old = AttrVal("DEVICE","userReadings",undef);; !defined $old ? 'sr_brightness:brightness.* {sprintf("%.0f", ReadingsNum("$name","brightness",0)/255*100)}' : $old =~ m,sr_brightness:brightness.*, ? $old : $old.', sr_brightness:brightness.* {sprintf("%.0f", ReadingsNum("$name","brightness",0)/255*100)}' }
|
|
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:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
option:TYPE=gassistant
|
|
|
|
name:speech_recognition_type_blind
|
|
filter:NAME=speechrecognTesting
|
|
order:100004
|
|
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:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
option:TYPE=gassistant
|
|
|
|
name:speech_recognition_type_thermostate
|
|
filter:NAME=speechrecognTesting
|
|
order:100005
|
|
desc:template to set speech recognition attributes for genericDeviceType thermostat
|
|
option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0}
|
|
attr DEVICE genericDeviceType thermostat
|
|
option:TYPE=siri
|
|
option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
option:TYPE=gassistant
|
|
|
|
name:speech_recognition_gdt_only
|
|
filter:NAME=speechrecognTesting
|
|
order:100006
|
|
desc:template to set speech recognition attributes for to any genericDeviceType; call e.g. with set <xy> attrTemplate speech_recognition_gdt_only GENERICDEVTYPE=Security
|
|
option:{my @devices=devspec2array("TYPE=(siri|alexa|gassistant)");;return 1 if $devices[0];;return 0}
|
|
par:GENERICDEVTYPE;GENERICDEVTYPE <genericDeviceType>, defaults to contact;{ "contact" }
|
|
attr DEVICE genericDeviceType GENERICDEVTYPE
|
|
option:TYPE=siri
|
|
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=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 <genericDeviceType>, 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:{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:{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
|
|
|
|
name:speech_recognition_alaxaName_secondrun
|
|
filter:NAME=speechrecognTesting
|
|
order:1000020b
|
|
desc:generic template to doublecheck alexaName attribute setting to avoid doubletes. Only intented for internal use by speech_recognition_alaxaName_firstrun and -ask_different_name, called e.g. with set xy attrTemplate speech_recognition_alaxaName_secondrun ALEXAISNAME=myAlexaName
|
|
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}
|
|
deleteattr DEVICE alexaName
|
|
set DEVICE attrTemplate speech_recognition_alaxaName_ask_different_name
|
|
|
|
name:speech_recognition_alaxaName_ask_different_name
|
|
filter:NAME=speechrecognTesting
|
|
order:1000020c
|
|
desc:generic template to set speech recognition attribute alexaName; only intented for internal use by speech_recognition_alaxaName_secondrun, called e.g. with set xy attrTemplate speech_recognition_alaxaName_ask_different_name ALEXANAME=myAlexaName
|
|
option:{my @devices=devspec2array("TYPE=(alexa)");; $devices[0] ? return 1 : return 0}
|
|
par:ALEXANAME;Please enter alexaName (the one provided last time seem to exist already);{undef) }
|
|
attr DEVICE alexaName ALEXANAME
|
|
set DEVICE attrTemplate speech_recognition_alaxaName_secondrun ALEXAISNAME=ALEXANAME
|