Hi,
I am wondering if there is possibility to read sensor history value using dynamic query like ‘now-24h’. I have PV and my inverter exposes entity for daily total production up to this moment: sensor.inverter_daily_yield. What I want to achieve is to see underneath it daily yield from same time yesterday. Is something like this even possible?
Doesn’t have to be real time, it can be done by some automation for example every 1 minute.
I use this automation and input _number helpers to store the data I want, the automation triggers every evening at midnight and ‘cascades’ the day’s sensor value to the next inline which allows me to display the previous n days of data as separate cards.
i.e.
Today -4 days is stored in today -5
Today -3 days is stored in today -4
Today -2 days is stored in today -3
Today -1 days is stored in today -2
Today is stored in today -1
You can achieve what you have done with a single trigger-based template sensor: see here.
The OP’s question is for fine-grained tracking though — unless you’re going to create 1440 helpers / data elements in an attribute structure, the SQL solution will be better.