ManagerSpeechInput

You can access this manager through the Homey instance as this.homey.speechInput

Methods

ask

ask(text, opts): Promise.<string>

Let Homey ask a question. There is a limit of 255 characters.

Requires the homey:manager:speech-input and/or homey:manager:speech-output permissions. For more information about permissions read the Permissions tutorial.

Parameters

Name Type Description
text
string

The sentence to say

opts
object
session
object <optional>

The session of the speech. Leave empty to use Homey's built-in speaker

timeout
number <optional>

Amount of seconds until the response has timed-out

}

Returns

  • The text of the answer
Promise.<string>

confirm

confirm(text, opts): Promise.<boolean>

Let Homey ask a Yes/No question. There is a limit of 255 characters.

Requires the homey:manager:speech-input and/or homey:manager:speech-output permissions. For more information about permissions read the Permissions tutorial.

Parameters

Name Type Description
text
string

The sentence to say

opts
object
session
object <optional>

The session of the speech. Leave empty to use Homey's built-in speaker

timeout
number <optional>

Amount of seconds until the response has timed-out

}

Returns

  • Indicating whether the user answered with yes (true) or no (false)
Promise.<boolean>

Type Definitions

Chunk

Chunk

Type

  • object

Properties

Name Type Description
transcript
string

The chunk text

startWord
number

The index of the words array where the chunk starts

endWord
number

The index of the words array where the chunk ends

type
string

The chunk type - either NP (Noun Phrase) or VP (Verb Phrase)

Location

Location

Type

  • object

Properties

Name Type Description
transcript
string

The location name

startWord
number

The index of the words array where the location starts

endWord
number

The index of the words array where the location ends

Time

Time

Type

  • object

Properties

Name Type Description
transcript
string

The time text

startWord
number

The index of the words array where the time mention starts

endWord
number

The index of the words array where the time mention ends

time
object

The chunk type - either NP (Noun Phrase) or VP (Verb Phrase)

time[].second
number

Seconds. False if no reference to a specific second was made

time[].minute
number

Minutes. False if no reference to a specific minute was made

time[].hour
number

Hour of the day. False if no reference to a specific hour was made

time[].fuzzyHour
boolean

Indicates whether there is uncertainty about a time being am or pm. True if there is uncertainty, false if the part of day was indicated

time[].day
number

Day of the month. False if no reference to a specific day was made

time[].month
number

Month number. 0 is january. False if no reference to a specific month was made

time[].year
number

Year. False if no reference to a specific year was made

Word

Word

Type

  • object

Properties

Name Type Description
word
string

The word

posTag
string

The part-of-speech tag assigned to the word, using universal dependencies tagset

chunks
Array.<ManagerSpeechInput.Chunk>

lists any chunks starting at this word. Stuctured the same as the Object in speech.chunks[]

locations
Array.<ManagerSpeechInput.Location>

lists any locations starting at this word. Stuctured the same as the Object in speech.locations[]

times
Array.<ManagerSpeechInput.Time>

lists any times starting at this word. Stuctured the same as the Object in speech.times[]

devices
object

lists any device mentions starting at this word. Stuctured the same as the Object in speech.devices[]

Events

speechEval

.on('speechEval')

This event is fired when a speech query has been received, and needs feedback.

Parameters

Name Type Description
speech
object

Information about what the user said

session
string

The session where the speech command originated from

transcript
string

The detected user thrase

matches
object

a dynamically generated tree containing all the matched Groups and Elements

words
Array.<ManagerSpeechInput.Word>

An array of Objects, where each Object contains the word's properties

chunks
Array.<ManagerSpeechInput.Chunk>

An array of detected noun phrases and verb phrases

locations
Array.<ManagerSpeechInput.Location>

An array of detected references to a location

times
Array.<ManagerSpeechInput.Time>

An array of detected time references

devices
Array.<Device>

An array of Device instances which match the device parameters specified in app.json

allZones
string

A structured phrase which can be used to provide user feedback about the detected Zone names. Format: "in the {zone_name}(, {zone_name})*( and the {zone_name})?"

}
callback
function

A truthy response is used to indicate that your App can process this transcript. The returned value will be passed on to the onSpeechMatch event

speechMatch

.on('speechMatch')

This event is fired when a speech match has been detected.

Parameters

Name Type Description
speech
object

Information about what the user said

session
string

The session where the speech command originated from

transcript
string

The detected user thrase

matches
object

a dynamically generated tree containing all the matched Groups and Elements

words
Array.<ManagerSpeechInput.Word>

An array of Objects, where each Object contains the word's properties

chunks
Array.<ManagerSpeechInput.Chunk>

An array of detected noun phrases and verb phrases

locations
Array.<ManagerSpeechInput.Location>

An array of detected references to a location

times
Array.<ManagerSpeechInput.Time>

An array of detected time references

devices
Array.<Device>

An array of Device instances which match the device parameters specified in app.json

allZones
string

A structured phrase which can be used to provide user feedback about the detected Zone names. Format: "in the {zone_name}(, {zone_name})*( and the {zone_name})?"

}
onSpeechData
any

The result from speechEval