Occupancy Blueprint

Hi, I just implemented the automation and run into the known issues.
My Hue motion sensor detects Motion and keeps that state for 10 seconds.
The door sensor acts instandly.
The first motion after opening the door should trigger the occupancy to on and keep it that way if the door is closed. Otherwise you need to move again for the occupancy to stay true.

this is the reason that i create a motion template sensor.

Now my side is working here:

  1. Open the door, trigger the door sensor, the light is on. It also trigger the motion sensor, but this Blueprint is not started, because it not set it directly, set it the template sensor.
  2. 15 sec later (it is totally true that the door is closed) the motion template is trigger the blueprint (wasp in the box) and the light is constantly on, not need other movement, because the door is closed, no way to left the room.
  3. If we are finish, open the door. The bluprint is finish. When the motion sensor is “cool down” (and the pre set delay is ower) the light turn it off.
1 Like

@alexbabel, in addition to toggling the boolean, as an option, would you consider adding the ability to allow the users to enter their own actions when the occupancy goes to on and to off?

I’m guessing a good number is using your blueprint for triggering a set of lights. From the standpoint of usability, the above feature could be useful in not having to chain together two automations to trigger one set of lights.

In either case, as I mentioned before, thanks for your work!

Maybe I’m missing something. Let me check if I understand it.

The idea is when the door is openend for the first time and there is motion detected inside the room, there is a person. As long as the door stays closed, the person is present and thus the light should be turned on. If the door get’s openend again and there hasn’t been a movement for a while the light can be turned off. If the door gets openend but there is still movement then the lights should continue to stay on.

Now I can turn on the lights with opening the door, or even with the boolean be turned on. But the boolean turns of pretty fast. So where do I put the light off command?

At the very basic level you can do something along these lines here:

alias: Occupancy Light - Utility Room
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.utility_room_occupancy
    to: "on"
    id: "On"
  - platform: state
    entity_id:
      - input_boolean.utility_room_occupancy
    to: "off"
    for:
      hours: 0
      minutes: 0
      seconds: 30
    id: "Off"
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: "On"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.utility_room_lights
      - conditions:
          - condition: trigger
            id: "Off"
        sequence:
          - service: light.turn_off
            target:
              entity_id: light.utility_room_lights
mode: single

1 Like

Yes, and this is exactly what i’m not getting.

This is an automation which has the choose action. It can do something when it turns on and off. The off command should be at least 30 secs to be in this state before it triggers.

Then it just turns on with the boolean turned to on, and the light off when the boolean turns to off. What i’m seeing is this is then just another motion triggered event. Where does the ‘wasp’ component / idea come into play?

I just realized that it’s not entirely clear in the directions at the top of the thread. @alexbabel, see if you agree with below.

The directions mention that you need to add the blueprint referenced above. What it assumes you’ll do, but doesn’t explicitly mention is that in order to toggle the value of the boolean you created, you need to create an automation using this imported blueprint as the basis, making sure to utilize the variables you created from the directions.

This automation will only toggle the boolean (nothing else) which you can monitor with whatever you’d like. After this is where my example comes in. You create a second automation to monitor the value of the boolean to turn your lights on and off.

Hopefully this makes sense.

2 Likes

Yes it does, and I did have figured this out. One automation to alter the boolean. A different automation to do an action based on the sate of this boolean. I guess I just have to experiment a bit more.

1 Like

Hey @lensherm,

thanks for the suggestion. But this automation should only handle the occupancy. I did that on purpose. This offers a separation of concerns and you can use the input_boolean for all kind of different automations. In my case I use it for light and music automations.

1 Like

Thank you @alexbabel for this blueprint. I’m using it for my bathroom but I am having a problem with the light turning off while on the toilet (no movement) with the door closed.
turn_off_delay is set to 180 seconds.
I have an automation listening for input_boolean.occupancy_helper but the lights are going off after the 180 seconds while still inside the bathroom with the door closed. I thought the room is to be occupied while the door is closed after the first movement?

you could put a vibration sensor on your toilet then add that to a sensor group that includes your motion sensor. So when you sit down it will tell the automation you are in the bathroom. Kind of a stupid idea but it would technically work.

I went with a door sensor on the seat. Thanks for the idea though, works great.

I don’t have a good sense of how to use this in an automation. Can someone give an example? Thank you very much.

Annders

Create a new automation, click on add trigger, select state trigger, and then enter the name of the Occupancy Helper that you referenced in the blueprint…now add any actions you want to the new automation!

@alexbabel can the blueprint be updated to allow an input number helper to be used for the motion sensor turn off delay? The use case is for a room where the occupancy concept (and the frequency of motion) may vary during the day and so other automations can be used to vary the input number based on time of day, etc.
Thank you for the great blueprint, it’s exactly what is needed!

Sorry I am new here. Can someone explain to me how to proceed with this Blueprint.

I’m having trouble getting this to work as expected. I have an Aqara motion sensor and contact sensor installed in my bathroom. I setup the blueprint with those devices. When I go into the room the occupancy helper changes to ‘on’ and my light automation is triggered. I close the door and the contact state changes to ‘off’ as expected. Five seconds after motion stops being detected the occupancy helper changes to ‘off’ even though the door contact state hasn’t changed. Any ideas what I might have missed in my setup or if it’s an issue with the blueprint?

1 Like

OI have the same issue. I’m looking for a solution to.

I also seem to be having this same issue. The fact that the door is closed doesn’t seem to keep the occupancy state to ‘on’.
My suspecion is that the motion sensor has a long cool down period, after which there isn’t sufficient motion to trigger the sensor so the blueprint concludes the room is empty.

Hey everyone,

first of all, I am sorry that I cannot provide you much help from my side. I have not enough time to check the community regularly and not enough devices to test other scenarios (e.g. with Aqara motion sensors).

I want to mention again, that the timeout of the motion sensor is pretty important. If the motion was not detected after the door was closed, the occupation is cleared after the motion sensor is in the cleared state. Therefore, you need a sensor that supports low motion timeouts (e.g. a Philips hue motion sensor).

Additionally, @freshruss you can create helpers in:

Settings->Devices&Services->Helpers->Create Helper

Select as a type Toggle (input_boolean) and name it (e.g. Bathroom Occupancy). Submit the form.

Secondly, create a Helper of the type Date and/or time (datetime) and name it (e.g. Bathroom Last Motion)
Select date and time on the bottom of the pop up and submit the form.