Any way to access historical data in template?

Hi guys - I’m wondering if it’s possible to access historical sensor values from a template without setting up a new history_stats sensor. For example, pull in the value of a sensor N hours ago and compare it to current value.

Thanks
Dave

If you can compose a SQL query to get the desired value, it can be used in a SQL Sensor:

1 Like

Thanks for the suggestion. I’m looking for a way to reference multiple historical values in a single template sensor. My hope is to avoid creating a bunch of intermediate history_stats or sqlsensors.

This is a vague requirement and requires elaboration. A SQL query can incorporate “multiple historical values” but I suspect you already know that so your requirement must be more complex. If you provide more details, we may be able to offer suggestions.