Description
Home Assistant can gather a lot of statistics from associated sensors. But this is a field I never touched on Home Assistant and I'd like to learn more about it and see how to interact with these data with Home Assistant template.
Goals
Creating automations based on some home-assistant statistics, for instance, trigger an alarm if boiler didn't consume a lot of energy during the night, despite solar router sending a lot of energy the previous day to the boiler.
Resources
https://data.home-assistant.io/
Comments
-
2 days ago by fcrozat | Reply
After a lot of digging, I found the solution: you need to use SQL integration to query Home assistant long term statistics and create related sensor.
For instance: > SELECT state FROM statistics JOIN statisticsmeta ON statistics.metadataid = statisticsmeta.id WHERE (statisticsmeta.statisticid = 'sensor.shellyemenergy' AND startts <= strftime('%s', 'now','start of day')) ORDER by start_ts DESC LIMIT 1
to access the value of the sensor at midnight the same day
Similar Projects
This project is one of its kind!