Hello,
already searched the forums and also found some input, but still have issues to get it running.
Running latest Hass.io and lovelayce (yaml mode).
What i want to do: my water irrigation starts by either a) a switch turned to on or b) if in automation mode, at a specific time. Works so far.
What i want to achieve is to set the switch to off again after a specified time using a slider.
Seems to be a problem in the automation, if i uncomment it the code check runs.
Definition of slider and time (from within a package):
input_datetime:
bewaesserung_on:
name: Startzeit
has_date: false
has_time: true
input_boolean:
auto_bewaesserung:
name: Automatik (täglich)
icon: mdi:auto-fix
input_number:
bewaesserung_dauer:
name: Slider
min: 10
max: 60
step: 10
The automation:
automation:
### Gartenbewaesserung starten
- alias: bewaesserung_start
trigger:
- platform: template
value_template: '{{ states.sensor.time.state == (states.input_datetime.bewaesserung_on.attributes.timestamp | int | timestamp_custom("%H:%M", False)) }}'
condition:
condition: state
entity_id: input_boolean.auto_bewaesserung
state: 'on'
action:
service: homeassistant.turn_on
entity_id:
- switch.switch_wasser
### Bewaesserung stoppen
- alias: bewaesserung_stoppen
trigger:
platform: state
entity_id: switch.switch_wasser
to: 'on'
action:
- delay: '00:{{ states.input_number.bewaesserung_dauer.state | int }}:00'
- service: homeassistant.turn_off
- entity_id: switch.switch_wasser
Thanks for pointing me into the right direction.
/ Ralf