homeassistant¶
Data source reading entity states from the Home Assistant REST API.
Attributes¶
Classes¶
Reads the configured entities, one REST request each. |
Functions¶
|
Catalog entries from the rendered template, sorted by name. |
|
Convert a Home Assistant state string to int, float, str or None. |
Module Contents¶
- homeassistant.CATALOG_DOMAINS = ('sensor', 'binary_sensor', 'weather', 'climate', 'cover', 'lock', 'person', 'device_tracker',...¶
- homeassistant.parse_catalog(text)¶
Catalog entries from the rendered template, sorted by name.
- homeassistant.parse_state(state)¶
Convert a Home Assistant state string to int, float, str or None.
- class homeassistant.HomeAssistantSource(http_get, base_url, token, entities, http_post=None)¶
Reads the configured entities, one REST request each.
http_get(url, headers)returns (status, parsed JSON or None) and raises OSError when the server cannot be reached;http_post(url, headers, payload)sends JSON and returns (status, text or None).entitiesmaps reading keys to entity IDs, e.g. {“office_temperature”: “sensor.arbeitszimmer_temperatur”}.- read()¶
Read all configured entities.
With
http_postthis is one template request (much faster on the board), otherwise one GET per entity.- Returns:
A reading per configured key, in the format of
datasource.- Raises:
OSError – If Home Assistant cannot be reached.
- catalog()¶
List what can be shown on a tile.
- Returns:
[{"id", "name", "unit", "style"}], seedatasource.- Raises:
OSError – If Home Assistant cannot be reached.