Please remove

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

Hi :slight_smile:

First of all, thank you for this blurprint.

maybe you can add a sensor for humidity. so when you are in shower it knows you are in the rum an will not turn off the light :slight_smile:

It would be nice to have an option if a light or light group is triggered manually/locally, then reset the timeout timer. I understand that sometimes motion detectors can be less than perfect, so sometimes I have to hit the light. I also see it as beneficial if there are NO other sensors in the room (motion/media/presence, etc.)

Could be optional and an added feature to integrate under one blueprint.

Nvm. Still posting before I troubleshoot. Should have learned by now.

Adding a request for this.

If occupancy is on for any defined room, and the household changes to not_home and guest input boolean is off, then turn off occupancy input_boolean for that room.

I’ve covered with adding to away script triggered by automation, but would prefer this being a part of the blueprint.


This is a great idea, as a person that spends a lot of their free time on the computer, my computer being in use could be pretty useful data for room occupancy. Maybe you could work IOT link sensors into this?

1 Like

I believe this is not working on the motion side if presence sensors are additionally used. I am finding that when the bluetooth goes “off”, it overrides all of the above including motion + timer.

I will work to improve the blueprint on my side (@gdeboos) with over 1K clicks, do you intend to maintain this further?

There is indeed a bug in the motion timeout logic. You need to change the following variables in the blueprint to make it work:

motion_timeout: '{{ states(''input_number.motion_occupancy_timeout'') | float(10) }}'
motion_last_changed: '{{ states[motion_sensor].last_changed.timestamp() | float(0) }}'
motion_is_timed_out: '{{ (time_now - motion_last_changed) > (motion_timeout * 60) }}'

motion_timeout had no default value and wasn’t converted to seconds for motion_is_timed_out.


I tried fixing this myself with the suggestions you made, but after saving the automation from the blueprint, it does not appear in '‘automations’.

Stinks, I’d really like to be able to use this, even with motion disabled, and presence detection and a door sensor, its fires off every 20 seconds until it maxes out

I’m trying to use this without media players (as they are optional), and it’s consistently failing with the error “Message malformed: Missing input media_players”. (The media player toggles are also disabled and I’ve tried removing the default media player text as well.)

you need to set it to ‘media_player.none’

However, this blueprint seems to be broken, for me. Althoguht its exactly what I needed for room assistant.

1 Like

Your assist helped and I’ve now got it working on my end and was able to create an Automation. Are you seeing any errors in the logs?

Are you using room assistant? If I use room assistant it makes this automation go berserk and try to turn off on 100 times until HA kills it.

This is newer, and I agree, I am getting updates now with every distance change which is triggering the automation. I’m looking into rate limiting or something. This is crazy!

Edit: Something seems wrong in the triggering of this automation. It is only using the “state” of the entity, not the attributes, so it should NOT be firing when only the distance changes…

This should NOT trigger since the state is staying the same:

  id: '4'
  idx: '4'
  platform: state
  entity_id: sensor.xxx_pixel_3a_room_presence
    entity_id: sensor.xxx_pixel_3a_room_presence
    state: Family Room
      distance: 9.3
      last_updated_at: '2022-04-13T13:02:52.480Z'
      icon: mdi:bluetooth
      friendly_name: xxx Pixel 3a Room Presence
    last_changed: '2022-04-13T13:02:14.795064+00:00'
    last_updated: '2022-04-13T13:02:52.552215+00:00'
      id: 8b391a8e1198d60331cdcb56e8c3352f
      parent_id: null
      user_id: null
    entity_id: sensor.xxx_pixel_3a_room_presence
    state: Family Room
      distance: 8.2
      last_updated_at: '2022-04-13T13:03:12.326Z'
      icon: mdi:bluetooth
      friendly_name: xxx Pixel 3a Room Presence
    last_changed: '2022-04-13T13:02:14.795064+00:00'
    last_updated: '2022-04-13T13:03:12.395774+00:00'
      id: 4ddc685f91465499bba2c194a45b9a60
      parent_id: null
      user_id: null
  for: null
  attribute: null
  description: state of sensor.xxx_pixel_3a_room_presence

Ok so what I have discovered (in chatting on discord) is that Automation “State” triggers on attribute changes also: Automation Trigger - Home Assistant

If we don’t want the automation to trigger on an attribute change (distance) we need to, per the docs:

To trigger on all state changes, but not on changed attributes, set at least one of from or to to null .

So what I did is I modified:

  - platform: state
    entity_id: !input presence_entities


  - platform: state
    entity_id: !input presence_entities
    from: null

Will see if that works!

1 Like

I have essentially torn down my room-assistant array sans two devices, the price of Pi’s was just too much and they were needed other places. But if you do get this blueprint working with RA please do report back, as I this automation would be useful.

Hey all, I wanted to let you know that with permissions, I have taken @gdeboos 's great work and “forked” this into my own version.

I’ll create a separate post, but if you want to test it out alongside me, you can import via this link:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

1 Like

Moved to a new thread, please post any updates or questions there: