Using Kerui PIR sensor 433Mhz, Sonoff RF bridge 433 MHz (flashed with Tasmota) and Sonoff T1 (flashed with Tasmota)
I want it to turn on the light when movement is detected and turned it off after X minutes.
I could turn it on and also reset the PIR sensor but i have no clue how to send the off signal to switch afterwards.
automations.yaml
- alias: Turn off hall motion
hide_entity: true
trigger:
platform: state
entity_id: binary_sensor.hall_motion
to: 'on'
for:
seconds: 60
action:
service: mqtt.publish
data:
topic: "tele/sonoffbr/RESULT"
payload: "161F0Aoff"
retain: "true"
- alias: Turn on
hide_entity: true
trigger:
platform: state
entity_id: binary_sensor.hall_motion
to: 'on'
action:
service: switch.turn_on
entity_id: switch.spalnica
configuration.yaml
- platform: mqtt
name: "Spalnica"
state_topic: "stat/bed_room/POWER"
command_topic: "cmnd/bed_room/POWER"
availability_topic: "tele/bed_room/LWT"
qos: 1
payload_on: "ON"
payload_off: "OFF"
payload_available: "Online"
payload_not_available: "Offline"
retain: false
binary_sensor:
- platform: mqtt
name: Hall Motion
payload_on: "161F0A"
payload_off: "161F0Aoff"
sensor_class: motion
state_topic: "tele/sonoffbr/RESULT"
value_template: '{{ value_json.RfReceived.Data }}'