datasource¶
Source-neutral readings and the data source interface.
A data source is any object with a read() method that returns a dict mapping reading keys to readings:
{“outside_temperature”: {“value”: 21.5, “unit”: “°C”}, …}
Keys are English identifiers chosen by the configuration, not by the backend (Home Assistant entity IDs, SignalK paths, …). A value of None means the source knows the key but currently has no value for it. Layout and display code only ever see this format, so sources can be swapped in the entry point without touching them. A reading may carry “temperature” and “temperature_unit” as well, e.g. the outside temperature of a weather forecast, shown next to the weather icon.
Sources may also offer catalog(): the values the web interface lets the
user choose from, as [{“id”: key, “name”: readable name, “unit”: unit or
“”, “style”: “number” | “text” | “weather”}] (style is a suggestion for
the tile, see tiles).
Classes¶
Data source with fixed values, for tests and display development. |
Functions¶
|
A single reading in the source-neutral format. |
Module Contents¶
- datasource.reading(value, unit=None)¶
A single reading in the source-neutral format.