My automation is below. Is there a way to automate this to allow for Fermentation Step N number of steps? Right now I hard coded 10 in, but I could see a scenario where I need more.
I would love a single automation that can handle every step, as they are all essentially the same, but with different input_datetime and input_target_temp
I’ve done something like that for my hot water scheduling. See this topic: Setting up multiple / complex automation — I start off hard-coding the entities and end up (at this post) using groups. Other people also suggest things that may help.
My current code:
- alias: Hot water - tank target manager
description: >-
This automation updates the value of the tank target based on the values in the
schedule. The action identifies which slot matches the current time, then sets
the target to that slot's target value. Slots at midnight are considered unset,
and ignored. Schedule helpers must be put into one of four groups:
group.wdhw_times - time helpers for workdays
group.wehw_times - time helpers for non-workdays
group.wdhw_tgts - target number helpers for workdays
group.wehw_tgts - target number helpers for non-workdays
id: 0ac52ecb-3e29-4474-b64b-9261ee9dce4e
trigger:
- platform: template
value_template: "{{ states('sensor.time')~':00' in expand('group.w'~{'on':'d','off':'e'}[states('binary_sensor.workday_sensor')]~'hw_times')|map(attribute='state') }}"
condition: "{{ states('sensor.time') != '00:00' }}"
action:
- service: input_number.set_value
data:
entity_id: input_number.tank_target
value: >
{% set g = 'group.'~{'on':'wdhw_','off':'wehw_'}[states('binary_sensor.workday_sensor')] %}
{{ (expand(g~'tgts')|map(attribute='state')|list)[(expand(g~'times')|map(attribute='state')|list).index(states('sensor.time')~":00")] }}