Using Loop for Timer with Multiple Climate Control devices


I am using HA to control multiple air conditioners with Coolmaster net. I have setup a timer for my climate devices and am using input slider for the Timer. So when I switch ON my climate.ac1 with Timer Slider set to 30, the climate.ac1 switches off in 30 mins.

Now as I have around 12 climate devices in my system, I want to write a generalized automation command for all climate devices so whichever climate device is switched on that particular devices should be switched off after the defined Timer period. Like if I switch on climate.ac2 HA knows that climate.ac2 should be switched off after Timer Slider Value.

Please help.

Instead of using timers, you may wish to consider using a new feature in 0.96.

You can now use a template in the for option (see documentation). Here the documentation’s example:

    platform: state
    entity_id: device_tracker.paulus, device_tracker.anne_therese
    to: 'home'
      minutes: "{{ states('input_number.lock_min')|int }}"
      seconds: "{{ states('input_number.lock_sec')|int }}"
    service: lock.lock
    entity_id: lock.my_place

Therefore you can adapt the example to turn off each AC unit based on the duration set by an input_slider. It would look something like this:

    platform: state
    entity_id: climate.AC1, climate.AC2, climate.AC3
    to: 'on'
      minutes: "{{ states('input_number.AC_minutes') | int }}"
    service: climate.turn_off
      entity_id: "{{ trigger.entity_id }}"
1 Like

Thanks a lot, that did solve the issue.

Can I make some kind of sensor or template which displays the remaining minutes in the triggered automations. I was looking at using the timer platform with script. Something like:

- service: timer.start
entity_id: timer.AC_Timer
duration: ‚Äė00:{{ states.input_number.minutes.state | int }}:00‚Äô

But if this works it will be just 1 timer and I need it for all triggered automations.