Using arrays?

I sense that what I want might be achievable with an array but have no idea how to go about it.

I want at specific times through the day set the heating to different values.

So, I imagine an automation triggering on time entity and then what?
06:00 set temp to 24
08:00 set temp to 20
etc…

have a look at this

needs appdaemo

another option is this

@juan11perez, thanks for the suggestions. They look good if I had a big place and lots of schedules to set up.
I just have a bathroom with underfloor heating to sort. I have a single house thermostat which I have sorted - it runs to an inbuilt schedule which I override with an automation when necessary.

I just think I need something that says if 6:00 then 24 elif 8:00 then 20 elif … but felt that an array had potential to simplify further.

@ianadd in that case as you point out a simple automation would suffice.

btw, there is an add-on - Simple Sheduler

if you want to do it yourself… there are many options, including arrays (I presume it’s better to call them lists as we’re using python, basically).
however, in your automation you need a) time (or, better, a time interval, i.e 2 points in time) and b) a value to return.
as you can see, it cannot be done with just a list of simple values as you need to store a complex structure rather than just a value. something like this

{% set schedule = [{'time':'06:00', 'temp': 24}, {'time':'08:00', 'temp': 20}]%}

Here’s a template you can use to set temperature value - I’m not saying it’s perfect but it’ll give you a starting point.

{% set schedule = [{'time':'06:00', 'temp': 24}, {'time':'08:00', 'temp': 20}, {'time':'09:00', 'temp': 22}] %}
{% set cur_time = states('sensor.time') %}
{% set ns = namespace(temp=schedule[0].temp) %}
{% for rec in schedule if cur_time >= rec.time %}
  {% set ns.temp = rec.temp %}
{% endfor %}
{{ ns.temp }}

That’s great, I can grasp that and learn some other stuff too !

1 Like