I’m developing an automation to help determine the target temperature for a thermostat. My method for this follows:
Use a sensor which indicates the target temperature that was set at this time over the last 7 days. This is currently deduced by quering an influxdb database and having a sensor for target temperature for 30 minutes before and after this time for each of the last 7 days; the influx query uses ‘mode’ to find the most commonly set temperature.
This means I’ve 7 historical sensors showing me the most commonly set temperature, but now I need to coalesce those 7 sensors together. If I use mean
then the target temperature will slowly drift over time, so I’d like to use mode
, but the statistics and min_max
sensors don’t currently support this.
Would there be appetite for adding a ‘mode’ attribute to the min_max
sensor?
Alternatively is there an easy way I can combine the 7 sensors in a template sensor? The statistics module in python offers a mode()
function, but I don’t think you can import modules in Jinja.
What are peoples thoughts?