mqtt: broker: 10.10.10.10 port: 1883 switch: - platform: tplink host: 10.10.10.11 name: "Water Fountain" sensor: - platform: mqtt state_topic: 'node/kit-motion-detector:0/pir/-/event-count' name: 'Counter' icon: mdi:smoke-detector - platform: mqtt state_topic: 'node/kit-motion-detector:0/battery/-/voltage' name: 'Voltage' unit_of_measurement: 'V' input_number: slider_water_fountain: name: Timeout after PIR initial: 15 min: 1 max: 60 step: 5 unit_of_measurement: min automation: - alias: Start Water Fountain by PIR trigger: platform: state entity_id: sensor.counter action: service: switch.turn_on entity_id: switch.water_fountain - alias: Vypnutí fontány po pohybu trigger: platform: state entity_id: sensor.counter condition: condition: and conditions: - condition: state entity_id: switch.water_fountain state: 'off' action: service: homeassistant.turn_on entity_id: script.timed_water_fountain script: timed_water_fountain: alias: "Set water fountain timer" sequence: # Cancel ev. old timers - service: script.turn_off data: entity_id: script.timer_off_water_fountain # Set new timer - service: script.turn_on data: entity_id: script.timer_off_water_fountain timer_off_water_fountain: alias: "Turn off water fountain" sequence: - delay: '00:{{ states.input_number.slider_water_fountain.state | int }}:00' - service: homeassistant.turn_off entity_id: switch.water_fountain group: bcpir: name: 'PIR Sensor' icon: mdi:smoke-detector entities: - sensor.voltage - sensor.counter fountain: name: 'Water fountain' entities: - switch.water_fountain - input_number.slider_water_fountain - automation.start_water_fountain_by_pir