I have a Sonoff 433MHz PIR connected with Sonoff433MHZ RF bridge without any modifications.
I want to use it in a room to switch the light on and switch off after 10 minutes of no movement.
The light is switched on by a Sonoff Mini Switch also connected to HA.
Both Sonoff devices are using the eWelink app and the HA integration.
The automation i allready made:
alias: Badkamer lamp aan pir
description: ''
trigger:
- platform: state
entity_id: remote.sonoff_1000cdcc13
attribute: ts
condition:
- condition: state
entity_id: remote.sonoff_1000cdcc13
attribute: name
state: Movesens badkamer
action:
- service: switch.turn_on
data: {}
entity_id: switch.sonoff_1000e53157
mode: single
This works fine.
The second automation, that follows the first one is what happens after the switch is on.
But now the light goes off after 10 minutes, even when I’m in the room. I can’t figure out, how to restart the 10 minute timer, when a new state change from the PIR occurs.
As far as i know, the PIR does not have on/off. It only fires one message by movement.
Not now, but planned. This is the first one to learn it, when i get this working, more will be added.
I do have three door sensors on that same Sonoff RFbridge, they behave the same, being a remote in HA.
When i do it that way, i just cant enter the eWelink device name directly behind the PIR sensor line. It results in syntax errror in the file editor.
Putting it like this makes a new sensor, but i think, that this sensor is not associated then:
sonoff:
username: ******
password: *****
reload: always
rfbridge:
Door Sensor 1:
name: Deur Woning
device_class: door
timeout: 5
Door Sensor 2:
name: Deur Terras
device_class: door
timeout: 5
Door Sensor 3:
name: Deur Schuur
device_class: door
timeout: 5
PIR Sensor 1:
name: Movesens badkamer
device_class: motion
timeout: 1
so using your suggested code:
alias: Badkamer lamp aan pir
description: ''
trigger:
- platform: state
entity_id: remote.sonoff_1000cdcc13
attribute: ts
condition:
- condition: state
entity_id: remote.sonoff_1000cdcc13
attribute: name
state: Movesens badkamer
action:
- service: light.turn_on
data: {}
entity_id: light.badkamer_lamp
- scene: scene.badkamer_normaal_licht
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.movesens_badkamer
to: 'off'
for: '00:03:00'
continue_on_timeout: false
- service: light.turn_off
data: {}
entity_id: light.badkamer_lamp
mode: single
now results in light going on, but no more off. (Yes, i removed the switch in software to make this debugging easier, and get rid of the second automatisation)
I can’t understand, why the file editor does not accept the AlexxIT way of writing it.