I have a Sonoff RF Bridge running on ESPurna firmware. The Bridge has been setup (via code learning) to detect motion for switch #0 ON
OFF portion Is left blank.
I have a walk way light that is connected to sonoff basic (Tasmato flashed)
I want to automate the following way:
- Turn my walk way light when a Motion is detected.
a. Walkway light Should Turn ON only during night. (say between 9pm and 6am) - Also Once its ON , it should automatically switch OFF after few Mins (Say 10 Minutes).
For above scenario
Part 1:
My Motion sensor configured as binary sensor in confuratour .yamal Code is as follows:
binary_sensor:
- name: “WalkWay Sensor” #0
platform: mqtt
state_topic: SBRIDGE01/relay/0
command_topic: SBRIDGE01/relay/0/set
payload_on: “30A2019A04CED2908E”
payload_off: “30A2019A04CED29OFF”
availability_topic: SBRIDGE01/status
payload_available: 1
payload_not_available: 0
device_class: Motion
optimistic: false
qos: 1
retain: false
My Motion sensor Automation.yaml code to turn OFF to Binary sensor back to off state once motion is detected- alias: WalkWay Motion State
hide_entity: true
initial_state: ‘on’
trigger:
- alias: WalkWay Motion State
- platform: state
entity_id: binary_sensor.walkway_sensor
to: ‘on’
for:
seconds: 5
action: - service: mqtt.publish
data:
topic: SBRIDGE01/relay/0
payload: 30A2019A04CED29OFF
Part 2: (Once light is ON) I have the following automation: (Below automation code works fine while switching ON light using HA UI)- id: ‘1530192351578’
alias: ON Mirror Light at Night
trigger:
- id: ‘1530192351578’
- entity_id: switch.mirror_light
for:
hours: 0
minutes: 2
from: ‘off’
platform: state
to: ‘on’
condition: - after: ‘18:00:00’
before: 06:00:00
condition: time
action: - alias: ‘’
data:
entity_id: switch.mirror_light
service: switch.turn_off
Question:
-
My Motion sensor is always ON & never goes to OFF state
-
How to Turn ON lights when Motion is detected?