Single Automation with multiple helpers and steps?

I have an automation that controls a temp controller by pulling in a date/time and temperature from an outside source, stores it in a datetime helper and a number helper for the temp, then triggers at the specific datetime. I can have up to 10 steps in this process, and would like to consolidate into a single automation, but am drawing a blank as to how.

Here’s an example of a single automation. I have 10 of these currently. The conditions are because when there is no temperature set, the data comes across as 33 degrees.

How would I consolidate this into one automation? I know I could manually set trigger IDs for each datetime and triggered by for the actions, but I’m drawing a blank at the condition. I suspect it needs some sort of templating, which I’m not good at.

The helpers are all named with the following convention where X is the step 1 through 10.
Datetime: “input_datetime.fermenter_1_fermentation_step_1”
Temperature: “input_number.fermenter_1_fermentation_step_X_temp”

Thanks in advance!

alias: Fermenter 1 Fermentation Step 1
description: ""
trigger:
  - platform: time
    at: input_datetime.fermenter_1_fermentation_step_1
condition:
  - condition: numeric_state
    entity_id: input_number.fermenter_1_fermentation_step_1_temp
    above: 33
action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.fermenter_1_target_temperature
      value: "{{ states('input_number.fermenter_1_fermentation_step_1_temp') }}"
mode: single

Could you create a number helper to hold the step and the put each step inside a choose? You would then use “number helper changed” as a trigger and ensure that each step ends with the helper being updated to the next step.

The steps are already triggered sequentially by the nature of the datetime helpers.

So I have the ability to choose my action based off of the step.

I suppose I could include the condition in the action instead of the overall automation. Then I could check if that step’s temp is 33 degrees and not change anything if so.

Hmmm

Solved! Thanks @reef-actor you helped me think about it in a different way… This was far easier than expected, I just needed to move the specific step’s condition to the action area.

alias: Fermenter 1 Fermentation Steps
description: ""
trigger:
  - platform: time
    at: input_datetime.fermenter_1_fermentation_step_1
    id: step_1
  - platform: time
    at: input_datetime.fermenter_1_fermentation_step_2
    id: step_2
...etc
condition:
  - condition: state
    entity_id: input_boolean.fermenter_1_auto_temperature_control
    state: "on"
action:
  - choose:
      - conditions:
          - condition: trigger
            id: step_1
          - condition: numeric_state
            entity_id: input_number.fermenter_1_fermentation_step_1_temp
            above: 33
        sequence:
          - service: input_number.set_value
            data_template:
              entity_id: input_number.fermenter_1_target_temperature
              value: >-
                {{ states('input_number.fermenter_1_fermentation_step_1_temp') }}
      - conditions:
          - condition: trigger
            id: step_2
          - condition: numeric_state
            entity_id: input_number.fermenter_1_fermentation_step_2_temp
            above: 33
        sequence:
          - service: input_number.set_value
            data_template:
              entity_id: input_number.fermenter_1_target_temperature
              value: >-
                {{ states('input_number.fermenter_1_fermentation_step_2_temp') }}
...etc

mode: single

1 Like