Hello 123;
I am trying to use your automation to send a series of increase/decrease commands to reduce the temperature of a vaporizer from an input_number slider. It should send the command and update a sensor showing the temperature. I canāt seem to get it to loop, though it will send the command to the device once and doesnāt affect the same sensor. The same code attached to a button works flawlessly to do both, but as the vaporizer requires a series of events to decrease or increase temperature beyond a few presets, I was hoping to automate for fine tuning.
Here is the code I elaborated from your example:
- alias: temp_decrease_loop
# initial_state: false
trigger:
platform: state
entity_id: input_number.vape_target_temp
condition: "{{ (states.sensor.arizer_vape_temp.state | int) > (states.input_number.vape_target_temp.state | int ) }}"
action:
repeat:
while:
- condition: template
value_template: '{{ (states.sensor.arizer_vape_temp.state | int) > (states.input_number.vape_target_temp.state | int ) }}'
sequence:
- service: shell_command.arizer_temp_decrease
- service: input_number.set_state
data_template:
entity_id: input_number.vape_actual_temp
value: '{{ states.input_number.vape_actual_temp.state | float - 1 }}'
- delay: '00:00:02'
The woking button code is this:
- id: 'Momentary Temp Decrease'
alias: 'Momentary Button Temp Decrease'
trigger:
platform: state
entity_id: switch.momentary_decrease_temperature
from: 'off'
to: 'on'
condition:
condition: state
entity_id: switch.arizer_power_toggle
state: 'on'
action:
- service: shell_command.arizer_temp_decrease
- service: input_number.set_value
data_template:
entity_id: input_number.vape_actual_temp
value: '{{ states.input_number.vape_actual_temp.state | float - 1 }}'
Any idea why this wonāt work?