The frontend passes a single
hass object around. This object contains the latest state and allows you to send commands back to the server.
Whenever a state changes, a new version of the objects that changed are created. So you can easily see if something has changed by doing a strict equality check:
In order to see the data available in the
hass object, visit your HomeAssistant frontend in your favorite browser and open the browser's developer tools. On the elements panel, select the
<home-assistant> element, or any other element that has the
hass property, and then run the following command in the console panel:
This method of reading the
hass object should only be used as a reference. In order to interact with
hass in your code, make sure it is passed to your code correctly.
An object containing the states of all entities in Home Assistant. The key is the entity_id, the value is the state object.
The logged in user.
All methods starting with
call are async methods. This means that they will return a
Promise that will resolve with the result of the call.
hass.callService(domain, service, data)
Call a service on the backend.
Call a WebSocket command on the backend.
hass.callApi(method, path, data)
Call an API on the Home Assistant server. For example, if you want to fetch all Hass.io snapshots by issuing a GET request to
If you need to pass in data, pass a third argument:
We're moving away from API calls and are migrating everything to