immersive-home/docs/reference/lib--globals--home_api.md
2024-03-18 13:30:37 +01:00

9.5 KiB

HomeApi

Inherits: Node

Description

Manages the connection to the home automation system and provides a unified interface to the different home automation systems.

Properties

Name Type Default
api Node

Methods

Returns Name
void _on_connect ( )
void _on_disconnect ( )
void _ready ( )
Variant get_device ( id: String )
Variant get_devices ( )
Variant get_state ( entity: String )
VoiceHandler get_voice_assistant ( )
Variant has_connected ( )
bool has_integration ( )
Variant set_state ( entity: String, state: Variant, attributes: Dictionary )
void start_adapter ( type: String, url: String, token: String )
void update_room ( room: String )
Variant watch_state ( entity: String, callback: Callable )

Signals

on_connect ( )

Emitted when the connection to the home automation system is established

on_disconnect ( )

Emitted when the connection to the home automation system is lost

Constants

Hass = <Object>

No description provided yet.

HassWebSocket = <Object>

No description provided yet.

VoiceAssistant = <Object>

No description provided yet.

apis = {"hass": <Object>, "hass_ws": <Object>}

No description provided yet.

methods = `[

"get_devices", "get_device", "get_state", "set_state", "watch_state" ]` {#const-methods}

No description provided yet.

Property Descriptions

api: Node

The current home automation system adapter

Method Descriptions

_on_connect ( ) -> void

No description provided yet.

_on_disconnect ( ) -> void

No description provided yet.

_ready ( ) -> void

No description provided yet.

get_device (id: String ) -> Variant

Get a single device by id

get_devices ( ) -> Variant

Get a list of all devices

get_state (entity: String ) -> Variant

Returns the current state of an entity

get_voice_assistant ( ) -> VoiceHandler

Returns the VoiceHandler if the adapter has a voice assistant

has_connected ( ) -> Variant

Returns true if the adapter is connected to the home automation system

has_integration ( ) -> bool

Returns true if the adapter has an integration in the home automation system allowing to send the room position of the headset.

set_state (entity: String , state: Variant , attributes: Dictionary ) -> Variant

Updates the state of the entity and returns the resulting state

start_adapter (type: String , url: String , token: String ) -> void

Starts the adapter for the given type and url

update_room (room: String ) -> void

Updates the room position of the headset in the home automation system

watch_state (entity: String , callback: Callable ) -> Variant

Watches the state and each time it changes, calls the callback with the changed state, returns a function to stop watching the state