Use LTS from websocket API to fetch history for training models #511
Replies: 2 comments
-
Thanks, this would be welcome for access to long term history data without relying on a large recorder database. |
Beta Was this translation helpful? Give feedback.
-
Same reply as in the community forum, just to keep track of this ;-) LTS is not available to retrieve using the official HA API from which EMHASS is based on to fetch data. Here are the docs for the core REST API: REST API | Home Assistant Developer Docs And the supervisor API: Endpoints | Home Assistant Developer Docs If this evolve, I would gladly support LTS. We need to ask this to HA devs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Home Assistant has a websocket API that allows fetching the history of the long term statistics.
It offers data at a 5min, hour, day, week or month resolution.
Here's yesterday*, with hourly resolution for brevity (and as markdown):
*) Yesterday is also available in the regular recorder, but the retention for LTS is endless.
Is this something EMHASS could use to train ML-models?
Statistics Response:
Here's some example python code to fetch the data for a my solar panels.
There's not much documentation on the API, and it might be subject to change.
I based it on the example found here:
home-assistant/core#88757
Here's the core-code:
https://github.com/home-assistant/core/blob/6d5c000e1fce94bc4ab5dcf453bde9a646a52737/homeassistant/components/recorder/websocket_api.py#L164
Beta Was this translation helpful? Give feedback.
All reactions