I have a switch that I want to turn off after a given number of minutes. The number of minutes is set by an input slider. However it’s not switching off after the selected time.
Any ideas as to what I’m doing wrong?
automations.yaml
- alias: Niu Manual Charge
initial_state: true
trigger:
platform: state
entity_id: switch.41034600cc50e3d1cbd7
to: 'on'
for:
minutes: "{{ states('input_number.niu_battery_manual') }}"
condition:
- condition: state
entity_id: input_select.niu_charge_type
state: 'Manual'
action:
service: switch.turn_off
data:
entity_id: switch.41034600cc50e3d1cbd7
configuration.yaml:
input_number:
niu_battery_manual:
name: Battery Manual Time
min: 1
max: 7
step: 1
icon: 'mdi:battery-unknown'
input_select:
niu_charge_type:
name: Niu Charging
icon: 'mdi:ev-station'
options:
- Manual
- Bike