Setting up multiple / complex automation

123Taras, Yeah that makes sense …

Hey 123Taras, just wondering if you could help me out a bit.

If I wanted to change the naming convention like this (by adding the text trv_schedule_1_ before all of my helpers):

input_boolean.day_1 ====================>
input_number.workday_1 =================>
input_number.offday_1 ==================>
input_datetime.workday_1 ===============>
input_datetime.offday_1 ================>

input_boolean.trv_schedule_1_day_1
input_text.trv_schedule_1_workday_1
input_text.trv_schedule_1_offday_1
input_datetime.trv_schedule_1_workday_1
input_datetime.trv_schedule_1_offday_1

How would I modify this part of the automation to accommodate the above new naming convention:

  action:
    - variables:
        day: "{{ 'input_boolean.day_' ~ now().isoweekday() }}"
        oid: "{{ trigger.entity_id.split('.')[1] }}"
    - choose:
      - conditions: >
          {{ (is_state(day, 'on')  and 'workday' in oid) or
             (is_state(day, 'off') and 'offday'  in oid) }}
       sequence:
       - service: climate.set_temperature
         target:
           device_id: d8c34b0dce275e2c56a9b1f68f0a6d19
         data:
           temperature: "{{ states('input_number.' ~ oid) }}"

Reason being I’ve also got some areas which have heat mats and I need to make separate schedules for TRVs and Heat mats.

Thanks in advance !!

I think I’ll leave that one for you as an exercise; I’m sure you will figure it out and it will be more rewarding.

2 Likes

OK, thanks. I kind of got an idea but didn’t want to break my code as it is up and running at the moment and working flawlessly. Anyway, I’ll experiment with only changing one of the sets first.

Backup the code first then have a play