Im close- maybe. I just dont know how to ‘query’ the history for the motion sensor. I can see it being captured- I found it by adding a historical graph to the UI and then clicked edit code:
entities:
- entity: binary_sensor.motion_sensor_motion_2
hours_to_show: 24
refresh_interval: 0
title: Hallway Motion Sensor
type: history-graph
Or maybe its better to set a variable or some kind of ‘state’ when motion detector 2 fires that lasts for n seconds, then I could just check if that condition is true AND motion detector 1 fires. Device is a smartthings motion sensor via smartthings app integration (not MQTT).
Here is my pseudo / script, can someone please advise on completing this?
#motion detector 1
device_id: 2c7
domain: binary_sensor
entity_id: binary_sensor.motion_sensor_motion_1
for:
hours: 0
minutes: 0
seconds: 3
platform: device
type: motion
# AND this motion sensor has fired in last n seconds-doesnt have to be 3 seconds of motion, any motion is ok
type: motion
platform: device
device_id: b09
entity_id: binary_sensor.motion_sensor_motion_2
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 3
# action I want to fire
device_id: c53
domain: switch
entity_id: switch.bedroom_lamp
type: turn_on