How to automate all lights in a very intelligent way with Aqara FP2 and Home Assistant?

I recently presented to you the Aqara FP2 presence detector. A very smart sensor that I’ve had at home since its launch but for which it took me a while to offer you content, because there are so many things to say about it, but also because I wanted to try various installations/combinations/programming to give you the best advice on how to use your home automation home assistant.

Last week I explained to you, in addition to testing and discovering the product, how to integrate it into Domestic Assistant. In fact, this is not necessarily obvious at first glance because this device Aqara It is Wireless unlike the others who are generally in Zigbee. When a sensor operates in Zigbee, support is native and there are no real questions to ask. As FP2 from Aqara, it is a little more complex, but it is still possible to use it natively in Home Assistant home automation via HomeKit, as I explain in the first guide that you can find below in case you missed it.


Today I suggest you get down to business and see how to put this fabulous new type of detector to work to automate your lights in the smartest way possible. Once you’ve completed the programming below, you’ll just have to wander from zone to zone to see the lights turn on and off as you move, all without latency or delay, the dream!

However, what until now was a dream with the good old motion detectors called “PIR” has become reality with presence detectors and more particularly with this Aqara FP2 which has the particularity of detecting several people and in different areas, with a single sensor. But to get Home Assistant home automation to manage light in all zones, automation will be necessary. It’s not very complicated, but there are still some subtleties. Let’s see without further ado how to make automatic lighting really smart in your home too.

Necessary time: 20 minutes

Creating a Home Assistant automation to manage the intelligent lighting of several areas in the same scenario is not that complicated, but it still requires several creation steps and, above all, some tips to know. That’s why I’ve broken down each step as much as possible to achieve this and give you a complete understanding of what you’re going to accomplish.

  1. Accurately create detection zones in the Aqara app

    Mandatory starting point that must be made if you have followed and applied the first guide to the end, it is a matter of clearly defining the zones. Don’t hesitate to check back to touch up the zones and modify them by viewing your movements on the map and make sure you are entering a physical zone that perfectly matches the virtual zone on the map.

  2. Group area lights in Home Assistant

    The purpose of the automation will be to turn the lights on and off by zone when entering or leaving the boundaries. It is therefore necessary to ensure that the lights covering the different areas are well grouped. Otherwise, just create a new light group in Settings/Devices and services/Inputs Then create a new light group where you place the area lights.

    If the lights are already attached to the HA parts, this works too.

  3. Identify zone resources in Home Assistant

    Now you need to identify the names of the entities that correspond to your zones to know which zone number corresponds to which zone to illuminate. To do this, go to Settings/Devices and Services/Entities then search for the term FP2, you should find all FP2 detection zones imported via HomeKit.
    entities-zones-aqara-fp2-homekit-domotique-home-assistant-zones-presence
    Example, for me this translates like this:
    Presence Sensor-FP2-E48E Presence Sensor 1 = Global
    Presence Sensor-FP2-E48E Presence Sensor 2 = Kitchen
    Presence-Sensor-FP2-E48E Presence sensor 3 = Living room
    Presence Sensor-FP2-E48E Presence Sensor 4 = Room
    Presence-Sensor-FP2-E48E Presence sensor 5 = Small room
    Presence Sensor-FP2-E48E Presence Sensor 6 = Passage

    Note that Zone 1 corresponds to a presence detected in at least one zone, regardless of which one it is. This zone could be used in a security-oriented scenario, for example.

  4. Creating multi-zone lighting automation

    Now let’s get down to business with the creation of a unique automation, which will manage the turning on and off of lights by zone depending on the presence status of the FP2.
    To do this, we will create a new automation and immediately go to the settings (the 3 dots), Change mode and choose the mode Row.
    modify-run-mode-automation-home-assistant

  5. Create presence status triggers by zone

    Now add a first state trigger and point it to the entity corresponding to your first presence zone and set the A field to Detected.
    creation-trigger-state-entity-zone-presence-fp2

  6. Add a trigger to the trigger

    Open the Trigger ID field and provide a name for the trigger ID. Here, for the kitchen zone trigger, I indicate an ID “kitchen_detection”.

    add-id-trigger-triggering-automation-ha

  7. Create all zone triggers

    Similarly, you create one trigger per zone, making sure to always create a trigger ID in the same “detection_zone” template.
    create-triggers-zone-automation-home-assistant

  8. Create end-of-presence triggers by zone

    Similarly, now create an end-of-presence trigger for each zone. This is the same procedure with the A field set to “Not Detected” for each zone. Always making sure to display the trigger field and name it according to the “findetection_zone” template.
    creation-trigger-absence-presence-home-automation-ha-fp2

  9. Create a choice action

    Now let’s move on to the action part. The one that will turn the lights on or off in the area when you enter or leave it.
    To do this, we create a choice action. The one with the roundabout icon.
    action-choose-aqara-fp2-ignition-zone automation

  10. Add condition in option 1 of the action

    To do this, unfold the option1 block and then add a condition and choose Powered by in the list (ID icon)
    add-condition-trigger-automation-ha-fp2

  11. Set Condition Option 1 Trigger ID

    To do this, simply click on the list of triggers you just created and choose the first trigger ID created with the ‘kitchen_detection’ kitchen zone trigger.
    choose-id-trigger-automation-zone-home-assistant

  12. Create the option 1 trigger action

    You must now create the action to be carried out when this condition is met, namely turning on the kitchen when a presence is detected. To do this, still in the option 1 block, do Add an actionthen choose Call a service.
    action-automation-fp2-ha-option1

  13. Set the light to come on in zone 1

    Finally, choose the Light service: Turn on and indicate the light to control according to its type, entity, device or environment, depending on your configuration. Here, for zone 1 (kitchen), I define the entity that corresponds to the kitchen light group.
    choice-service-light-action-automation-ha

  14. Perform the same operation for all options

    You will then have to follow the same procedure, repeat points 9 to 13 for all actions to be carried out, namely 2 actions per zone, one to turn on and one to turn off.

    action-trigger-fp2-automation-ha

If you have carefully followed all the steps and advice given throughout these 14 steps, you now have automation that, with a single smart sensor, the Aqara FP2 presence detector and its multi-zone management, now has the lights in your house that turn on and off automatically. , without latency and with precision, as you roam the space. Not bad, huh?

Even simpler, download the automation code to import into your HA and support domo-blog.

It’s up to you friends, you have all the information you need to achieve this easily.

Domo-blog chose not to pollute your reading with advertising. However, you will find affiliate links to recommended products in the content. This in no way hinders your reading experience and helps fund the blog. You can also support the blog by buying me a coffee on Ko-Fi.


discord

Leave a Comment