The Ultimate Smart Home Automation Cookbook

Hub Modes are different states your home can be in. These modes can dictate when and how automations run. We will be using them a lot in our automations, so we need to understand how to set them up. Modes are one of the most powerful tools in the smart home.

Automation Details

Required Devices

  • Presence Sensors

Triggers:

  • Sunrise
  • 8am
  • Everyone Leaves
  • Someone Arrives Home

Actions:

  • Change Hub Mode

We will create 4 modes Home, Morning, Night and Away, but you can add as many as you like.

Night is set manually and is part of our Goodnight Routine.

Hobbyist
Hobbyist

Hubitat

Mode Manager

The Official Documentation for Mode Manager

Setting Up the Automation

  1. First we need to define our modes. Go to Settings/Modes.

    Hub Modes Create Modes Hubitat
  2. Next we need to add the Mode Manager app. Go to Apps then click the Add Built-in App at the top of the screen.

    Hub Modes App Screen Hubitat
  3. Scroll down and Select Mode Manager.

    Hub Modes Add Mode Manager Hubitat
  4. From the Select Modes to set by time dropdown and select Home and Morning.

    Hub Modes Select Modes by Time Hubitat
  5. For Some reason the table is not populated with the modes we selected. Click the + to add them and set the times. Morning = Sunrise and Home = 8am

    Hub Modes Set Mode Times Hubitat
  6. Now select Away from the Select Modes to be set by Presence dropdown.

    Hub Modes By Presence Hubitat
  7. Finally, from the Set Mode with Presence Sensors table click Select Sensors for both Away and returning from away and select your sensors.

    Hub Modes Select Presence Sensors Hubitat
  8. Success: The finished automation should look like this. Scroll down to the bottom and select done.

    Hub Modes Finished Modes Hubitat

Home Assistant

Home Assistant does not have a built in way to manage hub modes, but we can accomplish this with the use of groups and helpers.

Setting Up the Automation

  1. First we need to create a group of all your presence sensors, this will be the easiest way to detect if someone is home or not. In your configuration files create a new file called groups.yaml and add the code, Be sure to use your sensors entity names.

    Hub Modes Create Groups Yaml Home Assistant
  2. Then we need to add the groups.yaml to your configuration.yaml.

    Hub Modes Add Groups to Configuration Yaml Home Assistant
  3. First, we need to create a group, so go to Settings/Devices & Services/Helpers/Create Helper in the popup window, click Dropdown and here under options we can add our modes.

    Hub Modes Create Group Home Assistant
  4. Next go back to Settings/Automations & Scenes and click Create Automation. Choose Start with an empty automation.

  5. Now we’ll set our Morning mode. The trigger will be sunrise and we’ll set our Mode Helper to Morning.

    Hub Modes Set Moring Automation Home Assistant
  6. Next we’ll set our Home mode. The trigger will be 8am and we’ll set our Mode Helper to Home

    Hub Modes Set Home Automation Home Assistant
  7. Next we’ll set our Away mode. The trigger will be When our group Somebody is home, changes from home to not_home and we’ll set our mode to away.

    Hub Modes Set Away Automation Home Assistant
  8. Finally, we need to handle returning from Away. The trigger will be When our group Somebody is home, changes from not_home to home.

    Hub Modes Returning From Away Automation Triggers Home Assistant
  9. For the Action we’ll check to see if it’s after 8am, but before 6am.

    Hub Modes Returning From Away Automation If Home Assistant
  10. Then we will set our Mode to Home.

    Hub Modes Returning From Away Automation Then Home Assistant
  11. Else we set Mode to Morning.