immersive-home/docs/reference/lib--globals--home_api.md

117 lines
8.3 KiB
Markdown
Raw Normal View History

2024-03-16 19:45:43 +02:00
# HomeApi
**Inherits:** [Node](https://docs.godotengine.org/de/4.x/classes/class_node.html)
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
## Description
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
Manages the connection to the home automation system and provides a unified interface to the different home automation systems.
2024-03-16 19:45:43 +02:00
## Properties
2024-03-17 01:14:31 +02:00
| Name | Type | Default |
| ---------------- | ------------------------------------------------------------------- | ------- |
| [api](#prop-api) | [Node](https://docs.godotengine.org/de/4.x/classes/class_node.html) | |
2024-03-16 19:45:43 +02:00
## Methods
| Returns | Name |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| void | [_notification](#-notification) ( what: [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) ) |
| void | [_on_connect](#-on-connect) ( ) |
| void | [_on_disconnect](#-on-disconnect) ( ) |
| void | [_ready](#-ready) ( ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [get_device](#get-device) ( id: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [get_devices](#get-devices) ( ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [get_state](#get-state) ( entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [has_connected](#has-connected) ( ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [set_state](#set-state) ( entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html), state: [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html), attributes: [Dictionary](https://docs.godotengine.org/de/4.x/classes/class_dictionary.html) ) |
| void | [start_adapter](#start-adapter) ( type: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html), url: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html), token: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) |
| [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) | [watch_state](#watch-state) ( entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html), callback: [Callable](https://docs.godotengine.org/de/4.x/classes/class_callable.html) ) |
## Signals
### on_connect ( ) {#on-connect}
2024-03-17 01:14:31 +02:00
Emitted when the connection to the home automation system is established
### on_disconnect ( ) {#on-disconnect}
2024-03-17 01:14:31 +02:00
Emitted when the connection to the home automation system is lost
2024-03-17 01:14:31 +02:00
## Constants
### Hass = `<Object>` {#const-Hass}
No description provided yet.
### HassWebSocket = `<Object>` {#const-HassWebSocket}
No description provided yet.
### apis = `{"hass": <Object>, "hass_ws": <Object>}` {#const-apis}
No description provided yet.
2024-03-17 01:14:31 +02:00
### methods = `[
"get_devices",
"get_device",
"get_state",
"set_state",
"watch_state"
]` {#const-methods}
No description provided yet.
2024-03-16 19:45:43 +02:00
## Property Descriptions
2024-03-17 01:14:31 +02:00
### api: [Node](https://docs.godotengine.org/de/4.x/classes/class_node.html) {#prop-api}
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
The current home automation system adapter
2024-03-16 19:45:43 +02:00
## Method Descriptions
2024-03-17 01:14:31 +02:00
### _notification (what: [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) ) -> void {#-notification}
2024-03-16 19:45:43 +02:00
No description provided yet.
2024-03-17 01:14:31 +02:00
### _on_connect ( ) -> void {#-on-connect}
2024-03-16 19:45:43 +02:00
No description provided yet.
2024-03-17 01:14:31 +02:00
### _on_disconnect ( ) -> void {#-on-disconnect}
2024-03-16 19:45:43 +02:00
No description provided yet.
2024-03-17 01:14:31 +02:00
### _ready ( ) -> void {#-ready}
2024-03-16 19:45:43 +02:00
No description provided yet.
2024-03-17 01:14:31 +02:00
### get_device (id: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#get-device}
2024-03-16 19:45:43 +02:00
Get a single device by id
2024-03-17 01:14:31 +02:00
### get_devices ( ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#get-devices}
2024-03-16 19:45:43 +02:00
Get a list of all devices
2024-03-17 01:14:31 +02:00
### get_state (entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#get-state}
2024-03-16 19:45:43 +02:00
Returns the current state of an entity
2024-03-17 01:14:31 +02:00
### has_connected ( ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#has-connected}
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
Returns true if the adapter is connected to the home automation system
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
### set_state (entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) , state: [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) , attributes: [Dictionary](https://docs.godotengine.org/de/4.x/classes/class_dictionary.html) ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#set-state}
2024-03-16 19:45:43 +02:00
Updates the state of the entity and returns the resulting state
2024-03-17 01:14:31 +02:00
### start_adapter (type: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) , url: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) , token: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) ) -> void {#start-adapter}
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
Starts the adapter for the given type and url
2024-03-16 19:45:43 +02:00
2024-03-17 01:14:31 +02:00
### watch_state (entity: [String](https://docs.godotengine.org/de/4.x/classes/class_string.html) , callback: [Callable](https://docs.godotengine.org/de/4.x/classes/class_callable.html) ) -> [Variant](https://docs.godotengine.org/de/4.x/classes/class_variant.html) {#watch-state}
2024-03-16 19:45:43 +02:00
Watches the state and each time it changes, calls the callback with the changed state, returns a function to stop watching the state