WTH, no home, away, guest modes, and no stock necessary automations and templates

For anyone active on the discord server, forums, and reddit - one thing is abundantly clear - people are recreating the wheel everyday!

People are creating home modes, away modes, guest modes, etc because these things don’t just “exist” in home assistant ready to be configured.

People are needing to learn advanced jinja templating and complicated automation formatting to do simple tasks that a majority of users would benefit from and use often. Blueprints aren’t a solution here because they are not trivial to make changes to and are frankly hard to find ones that perfectly fit with a use case. The documentation is also very developer-centric for blueprints.

With all of that being said, I am looking forward to positive communication about these topics above :slight_smile:

Probably because it is a hugely configurable option. There are an enormous combination of of modes that each person individually may want. Party? Pets inside? Guest while home? Guest while away? Power save? etc…

And because there is a simple solution that fits everyone.

Create an input select helper that lists the available modes you want.

Then use that in automation conditions, triggers and actions. No templates required.

6 Likes

Then what makes you think a built-in solution would be easier to implement that has that “perfect fit”?

As noted above there are so many use cases that it’s just easier to have each user implement it in the way they see fit.

That may be true. However, there are probably +80% of HA users that would be perfectly happy with one simple (and reliable) solution. The other 20% are welcome to tinker around.

2 Likes

96% of all statistics are made up :slight_smile:

14 Likes

the responses from tom here are exactly why i have never felt comfortable contributing to these forums. the users are very helpful and friendly, the moderators and power users not so much…

4 Likes

For home and away you have zones to track where you are and thereby using it for automations etc.
for all others I also think it’s highly individual and thereby creating an out of box solution would be very tricky.

Your post was not flagged by a moderator, the flag was acted on by a moderator. Don’t make this into a witch hunt. Your flag was marked as off topic by a community member because the bottom whole paragraph has nothing to do with the home assistant software and is largely just a complaint about the dev and mod team. You’re welcome to create a #social post to voice your frustrations there. The month of WTH is about aspects of the Home Assistant software that bother you.

1 Like

What exactly in tom_l’s post has made you uncomfortable? His post simply explains why things are the way they are.

1 Like

Bringing it back on topic…

Maybe yes it is too complicated to do the whole thing, but I do wonder if their are some portions of the structure that could be improved.
For example having the status on the individual user profiles, and then a rollup that shows the total state for the house. Thats only one example and quite small, but then it atleast locks in something that is “standard”

Can you tell us why this simple and effective solution to your problem is not acceptable?

1 Like

Why does HA not have radio-button functionality?!

An easy solution for mode functionality is a controller like radio-button. With this controller just one option can be selected and the (others are automatically deselected).
Then scripts, automations, service calls can be triggered by this controller.
The radio-button should have options for displaying the radio-button-group as buttons, checkboxes, dropdown-list or radio-buttons.

aImOzbU

With some help from the forum I have made this functionality and it works fine. But for HA not have radio-button as a built in helper is a mystery.
giphy

2 Likes

That would make a good WTH for an alternative representation of the input_select. Please make your own post if you want it.

I’ve mentioned it in another WTH

2 Likes

Yep, that’s how I do it.

At the very least a pre-installed Guest user and a corresponding Guest dashboard which is all they can see would be really useful if pre-configured in the core install.

That goes against all common sense security precautions.

Windows always came with a guest user account on install.
… ok, maybe that’s a bad example :smiley:

I’ve iterated on this for several years (I operate 3 different HA environments, including one at an AirBNB which guests can control). One problem I’ve seen is that people try to jam too much into a single mode. Conceptually there is a difference between Home/Away and what the people in a house (or area/zone) are actually doing.

  • presence detection
  • occupancy mode (Home, Away, Vacation)
  • occupant experience (Party, Gaming, Cooking, Cleaning, Sleeping) – activity or experience
  • privacy mode (None, Guest, Private)

Privacy mode is useful for guests who, for example, do not want security cameras active at all or any kind of automated tracking/automated experiences based on that data.

3 Likes

I think the general concept of a single “presence” for an entire home…or an area/zone is useful, independent of any of the modes above. I’ve found two features very useful.

  • presence hold - useful for testing especially remotely this simulates presence for 10 minutes (with input_boolean)
  • presence lock - input_boolean to force presence on until some regular reset (nightly)

The presence_lock is EXTREMELY useful in situations where there are lots of shared users of a space AirBNB, event space, etc) where you want to make sure NO automation happen that day which might turn off lights, turn on alarms, stop music, etc.

This is my standard presence config file used in all HA installations:

# The core mechanics to support presence within Home Assistant environments:
#
# REQUIRED TO BE DEFINED:
#  - binary_sensor.any_people            # PEOPLE    (known)
#  - binary_sensor.any_area_occupied     # OCCUPANCY (any area)
#  - binary_sensor.any_motion_sensors    # MOTION    (triggered)
#  - binary_sensor.any_active_use        # USAGE     (someone is actively using tv, oven, appliances, shower, etc)
#
# From Home Assistant docs:
#   occupancy : on means occupied (detected), off means not occupied (clear)
#   presence  : on means home, off means away
#   motion    : on means motion detected, off means no motion (clear)
#
# My interpretation:
#   1. occupancy is close to a motion detector, they are instananoues temporary sensors;
#   2. occupancy feeds into presence sensors, which have a longer hold period before clearing
#
# NOTES:
# - presence indicates someone is there sourced from various types of triggers:
#      motion, usage, local/area proximity, holds, occupancy
# - area_presence_hold switches for forcing presence (from auto area or magic area or self defi
ned)

input_boolean:
  home_presence_lock:
    name: Home Presence Lock
    icon: mdi:motion-sensor
    initial: off

  home_presence_hold:
    name: Home Presence Hold (10 Min)
    icon: mdi:motion-sensor
    initial: off

timer:
  considered_away:
    name: "Presence Considered Away"
    duration: "00:45:00"
    restore: true

automation:
  - alias: "Reset Home Presence Hold"
    trigger:
      - platform: state
        entity_id: input_boolean.home_presence_hold
        to: 'on'
        for:
          minutes: 10
    action:
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.home_presence_hold

  - alias: "Reset Home Presence Lock (daily 2:00am)"
    trigger:
      - platform: time
        at: 02:00:00
    action:
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.home_presence_lock

  - alias: Presence Considered Away Timer Start
    trigger:
      - platform: state
        entity_id: binary_sensor.home_presence
        to: 'off'
    action:
      - service: timer.start
        data:
          entity_id: timer.considered_away

  - alias: Presence Considered Away Timer Stop
    trigger:
      - platform: state
        entity_id: binary_sensor.home_presence
        to: 'on'
    action:
      - service: timer.cancel
        data:
          entity_id: timer.considered_away

binary_sensor:
  - platform: template
    sensors:
      home_presence_overrides:
        friendly_name: Home Presence Overrides
        device_class: presence
        value_template: >
          {{ is_state('input_boolean.home_presence_lock', 'on') or
             is_state('input_boolean.home_presence_hold', 'on') }}

  - platform: group
    name: Home Presence
    device_class: presence
    entities:
      - binary_sensor.home_presence_overrides
      - binary_sensor.any_people
      - binary_sensor.any_area_occupied
      - binary_sensor.any_motion_sensors
      - binary_sensor.any_active_use

This same exact logic basically applies to areas/zones as well…I just don’t have that because it is tedious to repeat all that for each area.

Then for home modes (Home, Away, Vacation), I have the following:

# NOTE: Make decisions around occupancy_mode using the binary_sensors and not
# checking an input_select is much easier and allows for things like ensuring
# Away automations run during Vacations.
#
#   occupancy_mode_home
#   occupancy_mode_away
#   occupancy_mode_vacation

input_select:
  occupancy_mode:
    name: Home Occupancy Mode
    options:
      - Home
      - Away
      - Vacation  # deeper Away; e.g. hot water heat @ 120
    initial: Home

binary_sensor:
  - platform: template
    sensors:
      occupancy_mode_home:
        unique_id: occupancy_mode_home
        friendly_name: Occupancy Mode Home
        value_template: >-
          {{ is_state('input_select.occupancy_mode', 'Home') }}

      # NOTE: Vacation is still "Away", hence occupancy_mode_away includes this to simplify automations
      occupancy_mode_away:
        unique_id: occupancy_mode_away
        friendly_name: Occupancy Mode Away
        value_template: >-
          {{ is_state('input_select.occupancy_mode', 'Away') or
             is_state('input_select.occupancy_mode', 'Vacation') }}

      occupancy_mode_vacation:
        unique_id: occupancy_mode_vacation
        friendly_name: Occupancy Mode Vacation
        value_template: >-
          {{ is_state('input_select.occupancy_mode', 'Vacation') }}

automation:
  - alias: Update occupancy mode -> Home
    trigger:
      - platform: state
        entity_id: binary_sensor.home_presence
        to: 'on'
    condition:
      - condition: not
        conditions:
          - "{{ is_state('input_select.occupancy_mode', 'Home') }}"
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.occupancy_mode
          option: Home

  - alias: Update occupancy mode -> Away
    trigger:
      - platform: state
        entity_id: binary_sensor.home_presence
        to: 'off'
        for:
          minutes: '20'
    condition:
      - condition: state
        entity_id: input_select.occupancy_mode
        state: Home
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.occupancy_mode
          option: Away

  - alias: Update occupancy mode -> Vacation
    trigger:
      - platform: state
        entity_id: input_select.occupancy_mode
        to: 'Away'
        for:
          hours: 60
    condition:
      - condition: state
        entity_id: input_select.occupancy_mode
        state: Away
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.occupancy_mode
          option: Vacation