Please remove

My apologies, due to ill health this cannot be maintained.

Admins, please delete.


Cool blueprint! Minor typo correction:

Yeah, I really enjoy my media payers too. Whenever I walk into a room, they pay some people to play lots of music, and Home Assistant detects the deduction from my bank account.

On a more serious note, you forgot an L:


Thanks for the heads up, all sorted.

I was trying to overly complicate the triggering so this has been re-done.
Gone is the nasty time repeated work around.

Next on the list is to add door sensors
Handy for rooms that are always occupied when door is shut EG bathrooms.

Also to allow motion logic for if there is movement in a room since the door was shut.

The automation is working. but when there is no more occupancy my boolean is not going back to False

All characteristics of a room occupied by a person who is either asleep or sitting still, like when reading.

Completely reliable, passive occupancy detection is a challenging goal. You may want to consider employing the Bayesian Binary Sensor to add some infererence into the equation. However, configuring it involves a fair bit of experimentation.

1 Like

Yes agreed.

I use room-assistant to try and combat this. Its not 100% accurate but I have it pretty dam close for my use case.

In this case when I’m reading (and my phone is next to me) it reports that I’m in the room through Bluetooth.

I’ll look at the Bayesian sensor, thank you!
Do you think that could just replace this blueprint entirely or compliment it?

1 Like

Can you show me your automation config and I’ll take a look?

Thanks for the nice blueprint. Very helpful!

I spotted a small bug in your media player timeout logic:

{% set t = (time_now - media_timeout) * 60 %}

I’m pretty sure that your intention was to subtract the media_timeout value as minutes. The correct code would therefore be:

{% set t = time_now - (media_timeout * 60) %}

The parentheses are redundant in this case but they make it easier to read IMO :slightly_smiling_face:

That sounds like a proper solution for my very first smart home scenario problem (sitting in the office room on the desk, want to have lights and heating on where a motion sensor is not sufficient because of lack of movement). I think a motion sensor + door sensor + this blueprint are a powerful solution. Not sure if room assistant could add something to that.

Thanks for sharing and actively working on / improving it!

You can also leave out the parentheses because operator precedence will perform multiplication before subtraction.

{% set t = time_now - media_timeout * 60 %}

You can easily demonstrate it by pasting this into the Template Editor:

{{ 10 - 2 * 3 }}

The result will be 4 (not 24).

I have an idea: would you take into considerations that there might be a used device (Laptop for e.g. or printer) that is used in one room to mark it as occupied? It would be cool if that could be used.

Hi, I am trying to use your blueprint. It “creates” it, I can see in automations.yaml (multiple times) but it dos not show up in the UI… do you know why?


There is nothing to screen shot because it is not created in the UI (automations), it is in yaml in automations.yaml:

- id: '1617804849577'
  alias: '[Occupancy] Auto Room Occupancy'
  description: ''
    path: gdeboos/automatic-room-occupancy.yaml
      presence_states: none
      motion_sensor: binary_sensor.motion_sonoff_01
      occupancy_switch: input_boolean.occupancy_01
      media_players: none

(it is a test with 1 motion sensor now)

Reboot HA + clear cache?

Hi. Just installed this and I’m having the same issue. I created a few automations with this blueprint but they don’t show up in the UI.

I really like this blueprint. Thanks!
For me it would be usefull to add device_trackers. For example when I’m working from home, I don’t move so much and my office turns to off. Cheers!

Thank you for this blueprint. I am fairly new to HA. installed this weekend and migrated all my devices over. I am now venturing into the automation phase.

You had mention you can add helpers to change motion timeouts. Can I do this per room or its a global helper?

Any tips on how I can do room by room motion occupancy timeout?

I, in general, like Bayesian approaches, but it seems to be implemented strangely in home assistant. It would seen to me that some how it should age the data. Turning on a TV is almost certainly a sign that someone is in the room, but an hour later with no motion in the room would seem to me that the person has moved on. I would think that we would need to calculate the probability for each room. Maybe each minute or so and then compare with the number of people in the house and a number of rooms we’re willing to allow to be occupied (say we have three people in the house we might have a rule that says the that a room need to have a probability of greater than 35%-50% but that only the four highest probability rooms are occupied.
This is a quickly written, and I would enjoy working through some thoughts.

1 Like