Speaker

This class is a representation of a Speaker in Homey.

Table of Contents

Constructor

new Homey.Speaker()

Properties:
Name Type Description
isActive boolean

If the speaker is the active speaker

isRegistered boolean

If the speaker is registered with Homey

Tutorials:

Methods

register(speakerState, callbackopt) → {Promise}

Register the speaker. This is a shorthand method for ManagerSpeaker#registerSpeaker.

Parameters:
Name Type Attributes Description
speakerState ManagerSpeaker#SpeakerState

The initial state of the speaker

callback genericCallbackFunction <optional>
Returns:
Type:
Promise

sendCommand(command, args, callbackopt) → {Promise}

Send a command to Homey, Available commands are 'updateState' and 'setInactive'

Parameters:
Name Type Attributes Description
command string

The command to send

args *

The arguments of the command

callback genericCallbackFunction <optional>
Returns:
Type:
Promise

setInactive(message, callbackopt) → {Promise}

Forces the speaker to stop being the active speaker. This can be used when Homey lost control over the speaker or an error occured. Playback will continue through the default speaker.

Parameters:
Name Type Attributes Description
message string

A message to show the user why the speaker became inactive

callback genericCallbackFunction <optional>
Returns:
Type:
Promise

unregister(callbackopt) → {Promise}

Unregister the speaker. This is a shorthand method for ManagerSpeaker#unregisterSpeaker.

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:
Type:
Promise

updateState(state, callbackopt) → {Promise}

Updates the state of the speaker

Parameters:
Name Type Attributes Description
state ManagerSpeaker#SpeakerState

The new state of the speaker

callback genericCallbackFunction <optional>
Returns:
Type:
Promise