Skip to content

Packages

Corban Mailloux edited this page Sep 30, 2021 · 7 revisions

In most cases, I've organized my configuration to use packages. This allows me to put all of the relevant devices, automations, scripts, etc. in one file for a given project. It also simplifies sharing the configuration because a reader doesn't have to copy parts from multiple files.

Packages

bedroom_fairy_lights

In my bedroom, I have fairy lights mounted on the headboard. These lights are integrated with a custom ESPHome board using an ESP32 chip to provide a light entity to HASS.

This simple package just provides an auto-off automation for these lights. See also bedroom_light_alarm below.

bedroom_light_alarm

(See also bedroom_fairy_lights.)

Every weekday morning, this package slowly raises the brightness of our headboard lights in the bedroom over a configurable time window.

Screenshot of the Sunrise Alarm UI.

Depends on:

bedroom_tv

This package exposes a universal media player to give one main media_player entity for the Bedroom Roku. Combining the normal Roku media_player with the specific Plex player gives the most correct status and controls.

Screenshot of Bedroom Roku Remote

Depends on:

bedside_button_1_maggie and bedside_button_2_corban

On each side of the bed, we have Zigbee remotes customized for each of us.

Maggie's remote is a 5-button IKEA Trådfri remote with these button mappings:

  • Power: Toggle the bedroom light
  • Up click: Brighten bedroom light
  • Up hold: Set bedroom light to full brightness
  • Down click: Dim bedroom light
  • Down hold: Set bedroom light to minimum brightness (but still on)
  • Left click: Toggle the bedroom fan
  • Right click: 3-state toggle for the headboard fairy lights

Corban's button is a single-button Xiaomi Aqara wireless switch with these button mappings:

  • Click: 3-state toggle for the headboard fairy lights
  • Double-click: Toggle the bedroom fan
  • Hold: Turn everything off

Depends on:

donut_delivery

A silly project I made to test out notification frameworks a long time ago. I'm not sure it even still works.

Screenshot of the Donut Delivery UI

google_home

With 5 Google Home Minis in the apartment, this package contains some easier ways to work with them.

  • A universal media player combines them to one media_player entity that I can show in Lovelace. The main media_player will function as whichever Google Home is currently playing or paused. Screenshot of Lovelace media player

  • Some fun scripts to make it easier to sent TTS data to a specific Google Home. Screenshot of "Make the Homes Speak" card

  • A script to set each Google Home Mini to a preset volume level. This is useful before attempting to play music or podcasts on all devices. Because we may have set the volume manually on any of them, this sets everything back to a known-good volume balance. Screenshot of volume control card

Depends on:

home_away_mode

We wanted a simple, boolean indication of if anyone is actually home. In most cases, we realized it didn't matter who was in the house; if someone is there, we have a basic set of actions that should be taken. This also exposes input_boolean.home_occupied and binary_sensor.home_occupied to use in many automations.

The home can be set to occupied by:

  • Opening an entry door
  • Having either of the members of the household be home for at least 5 minutes
  • Pressing the "on" button on the IKEA Trådfri switch at the front door

The home can be set as unoccupied by:

  • Pressing the "off" button on the IKEA Trådfri switch at the front door
  • Having no one be home for at least 60 minutes

This package also contains automations that run when the occupancy changes at home. For example, when someone gets home, turn on a light and play a pleasant "welcome home" message (but only if it wouldn't interrupt something playing). When leaving, turn everything off, set the thermostat accordingly, and optionally run the vacuum.

Depends on:

litter_box_reminder

We have cats (Sasha and Maya). The litter box needs to be cleaned each day, and either human member of the household might get around to it. To remind us and to avoid duplicate efforts, both of our phones are notified at 7PM. If either notification is acknowledged and dismissed, remove the notification from both phones.

Screenshot of Android notification

Depends on:

  • Home Assistant Companion, the official app - Android, iOS

living_room_tv

This is my largest package in my HASS configuration, and it should likely be split into a couple smaller packages. This package covers all of the living room media center automations, scripts, etc.

Soundbar Control / IR Receiver

(TODO: This might be worth breaking out into its own project page.)

In the living room media center, we use a Roku TV and a non-smart soundbar. In order to add control for the soundbar to HASS, I built an IR interceptor/repeater called soundbar_controller with ESPHome. Wiring diagram for the soundbar controller

The device serves two purposes:

  1. It allows power and volume control of the soundbar from within Home Assistant.
  2. It functions as an IR receiver. The universal remote we use has a few extra, unused buttons. These buttons are picked up by the receiver and sent to HASS as events, ultimately controlling the lighting in the room. This is an excellent and cheap way to get the feeling of fancier remote controls like the Logitech Harmony remotes.

TV and Media Center

The rest of this package is useful helpers to make watching TV more fun. These scripts change often, but here are some example automations:

  • "Game Mode" and "Movie Mode" to set the lighting, turn on the TV and soundbar, and (optionally) switch the TV to the correct source.
    • These are also exposed through Google Assistant, so we regularly say, "Hey Google, turn on movie mode" as we enter the room.
  • When someone starts casting to the Chromecast Ultra connected to the TV, automatically turn on the TV and soundbar and switch to the correct input.
    • Note this is not done automatically with CEC; HASS sees when the Chromecast goes into a "playing" state and responds accordingly.
  • When something is casting to the Chromecast, intercept the play/pause button on the Roku remote to send play/pause to the Chromecast.
    • This uses the soundbar_controller to catch the otherwise-ignored button press. It makes it easy to just grab the remote and not question which source is currently playing.

As with the bedroom_tv, this package also exposes a universal media player to give one main media_player entity. It combines the normal Roku media_player with the specific Plex and Chromecast players.

Screenshot of Living Room Roku Remote

Depends on:

nas

We have a Synology DS1019+ NAS device set up as a Plex media server and auto-downloader. When this system is downloading content, it could potentially slow down other devices on the network. I could put a simple schedule in place to avoid that, but automation is more fun. Here are the download rules:

  • If no one is home, download at full speed.
  • If someone is home but it's overnight, download at full speed.
  • If someone is home and it's during the normally-awake hours, throttle the download speed.

This package also exposes an input_select to manually change the download mode (including pausing downloads), and an input_boolean to disable the automatic rules above. This is especially useful when I'm working on the NAS and want to pause all downloads for multiple days.

Screenshot of NAS control card

Depends on:

(To be continued)

Window - HVAC Interlock

With a smart thermostat and a couple door/window sensors, this package ensures that we aren't running the heat or air conditioning while a window is open. It's built using a state machine, roughly matching this flow: State Machine Diagram

This is more complicated than it could be, but I didn't want the HVAC to automatically come back on right when everything is closed. Instead, I display a dynamic card on the wall display with two options: dismiss or reset the HVAC to its previous state. Screenshot of reminder card