#Super basic sudo code I d like to figure
1 messages · Page 1 of 1 (latest)
I have somthing like this for my front porch timer as i have 2 automations that work at different times of the night if its before 10PM and motion is detected the front light is full cold white brigh and if its later than 10pm it gentle blue to not destroy night vision here is how it works
alias: Front Porch timer late
description: ""
trigger:
- type: motion
platform: device
device_id: 67b88a62a1ee141c8dda9c1f77470ede
entity_id: binary_sensor.front_portch_motion_sense_iaszone
domain: binary_sensor
condition:
- condition: time
before: "06:00:00"
after: "22:00:00"
weekday:
- sun
- mon
- tue
- wed
- thu
- fri
- sat
action:
- service: timer.start
data:
duration: "600"
target:
entity_id: timer.front_porch_late
mode: single
Motion sensor starts the timer for 600 seconds when it detects motion when that timer changes state from idle to active another automation triggers
alias: Front Porch Light Late
description: ""
trigger:
- platform: state
entity_id:
- timer.front_porch_late
from: idle
to: active
condition: []
action:
- service: scene.turn_on
target:
entity_id: scene.front_porch_late
metadata: {}
mode: single
this turning the light on for the correct scene
and finally when the timer state goes from active to idle (600 seconds has elapsed) there is the final automation to turn the light off
alias: Front Porch off
description: ""
trigger:
- platform: state
entity_id:
- timer.front_light_timer_early
from: active
to: idle
- platform: state
entity_id:
- timer.front_porch_late
from: active
to: idle
condition: []
action:
- type: turn_off
device_id: ee3493d1e17377c664b1bea4c3d1f850
entity_id: light.genio_smart_wifi_bulb_a60_rgb_cct_4
domain: light
mode: single
and to have different times of the night/day or whatever you just have an automation+timer for that condition and the automation automatically resets the timer every time you sensor redetects movement.
this is also perfectly possible to do with the Gui editor and not necessary to use the YAML
You my friend are amazing, but how does it reset the 600 second timer? Also I am looking at repurposing a few pi 3 I have doing simple jobs the my new computer can now take care of so I am going to setup room assistant.
i have these motion sensors
https://www.aliexpress.com/item/1005002419717912.html
and im not sure if its a common trait with motion sensors but these ones always stop detecting motion before they send a new detected status so it just re triggers the start the 600 second timer automation when it sends the next detected motion state