Hello, I want to automate a Lamp that turn on when the Ultrasonic Sensor is measuring a distance for 25 seconds under 30cm.
automation 1:
alias: Kaffe Licht einschalten wenn Tasse zu lange steht.
trigger:
platform: numeric_state
entity_id: sensor.ultrasonic_sensor_2
below: 0.30
for:
seconds: 25
action:
service: switch.turn_on
entity_id: light.kaffee_licht
automation 2:
alias: Kaffe Licht aus.
trigger:
platform: numeric_state
entity_id: sensor.ultrasonic_sensor_2
above: 1.2
action:
service: switch.turn_off
entity_id: light.kaffee_licht