Hi, I would really appreciate some help trying to set up an automation in HA using the Aqara FP2 Sensor.
I have not long set up my instance of HA, am a complete beginner and do not come from a tech background. Smart home devices has become a bit of a hobby hence expanding out into HA.
In the aqara app i had an automation set up where
If the room is un-occupied + Someone enters the room + if lux is below 25 then turn on Living room lights.
This worked perfectly on the lights only came on for the first person entering the room, but also if that said person then told Alexa to turn off living room lights they would turn off. if someone then entered they would not turn on.
But now i have managed to get the presense sensor into HA, I dont seem to have all of the different options in HA, its either occupied or unoccupied.
If I choose occupied, if i try turning the lights off they all come straight back on because i am still in the room. Is it possible to set up the automation as i did in the Aqara app or is it simply not possible ?
Really would appreciate some assistance on this, please also bear in mind i am a complete newcomer to HA and so i will literally need step by step instructions if your kind enough to help.
Not sure if I get it properly, but to me it seems to be very basic automation:
set trigger to your FP2 changing state from off to on
set condition to FP2 lux sensor being below 25
action to turn the light on.
Nothing more required. If the first person enters the room, state change triggers the automation. Then it can be switched off via Alexa, no problem. Since FP2 detects continuous presence, if second person enters room it will not re-trigger automation, as state of sensor will remain on.
Sample code I use for my hall lights:
automation:
# Turn on hall lights when dark from motion sensor
- id: 'hall_on_when_dark'
alias: hall sensor on
initial_state: true
trigger:
entity_id: binary_sensor.hall_fp2_presence_sensor_1
from: 'off'
platform: state
to: 'on'
condition:
condition: numeric_state
entity_id: sensor.hall_fp2_light_sensor_light_level
below: 15
action:
- service: light.turn_on
entity_id: light.shelly_hall_lights
- id: 'hall_off'
alias: hall sensor off
initial_state: true
trigger:
entity_id: binary_sensor.hall_fp2_presence_sensor_1
from: 'on'
platform: state
to: 'off'
action:
- service: light.turn_off
entity_id: light.shelly_hall_lights
Hi, Thank you so much for your help it is much appreciated.
I haven’t yet tried the above code but if i walk in the room the lights will come on, if i tell Alex to turn the lights off they will go off, but then the sensor will detect my presence and turn them back on ?