Skip to content

corbanmailloux/home-assistant-configuration

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.

Corban Mailloux's Home Assistant Configuration

This is the configuration I use for Home Assistant. I have Home Assistant running on the official Home Assistant Blue bundle (basically an ODROID-N2+ plus eMMC and a pretty case).

Explanation of Packages/Automations

I use packages for the vast majority of my YAML configuration to help segregate and clarify my system. I've tried to document most of the packages I use in the wiki. These inevitably get a bit out of date, but I try to be thorough in documenting what they do and why.

Services and Devices

Here are (some of) the services/platforms/other devices that I use with Home Assistant:

Name Product Link How It's Used in HASS
TCL Roku TV (Model: 65S405) TCL Roku media player component
Roku Streaming Stick Amazon Roku media player component
ESP8266 (in many ways) Generic ESP8266-01, NodeMCU, D1 Mini ESPHome is the best for my purposes (see the esphome directory). I've also used ESPEasy and some of my own firmware: ESP MQTT RGB LED, ESP MQTT DHT
Sonoff ITEAD Sonoff-Tasmota and MQTT
Google Home Mini Google Store Google Assistant component
IKEA Trådfri (Lights, Outlets, and Control Devices) IKEA: Light, Outlet, Remote Zigbee2MQTT as a Hass.io add-on
OctoPrint with a Monoprice MP Select Mini 3D Printer V2 OctoPrint, Monoprice OctoPrint component
Roborock S5 Vacuum Amazon Xiaomi Mi Robot Vacuum
Aqara (Zigbee) Buttons, Contact Sensors, Temperature Sensors Aliexpress: Button, Door Sensor Zigbee2MQTT as a Hass.io add-on
Windows 10 (Gaming PC) IOT Link through MQTT for power/state management
Synology DS1019+ (NAS, Plex Media Server) Amazon Plex integration for the media server, NZBGet integration for download controls

Things that Might be Helpful Again

These are just some helpful things that I used at some point and wanted to keep around as a reference for later.

List all entity_ids

During the update to v0.85 of Home Assistant, slugify changed. I was nervous this would cause subtle changes in my entity_id values and I wouldn't notice, so I exported them all before and after the update. I could have also grabbed this from the "States" page in HASS, but I wanted it as a template.

{% for state in states -%}
  {{ state.entity_id }}
{% endfor %}

"Flicker" a traditional light

scary_mode_flicker_lights:
  sequence:
    # Delay for 0 to 6 seconds
    - delay: 00:00:{{ (range(0, 7) | random | string).rjust(2, '0') }}
    - service: homeassistant.turn_on
      entity_id: light.entry_lamp
    - delay:
        milliseconds: 100
    - service: homeassistant.turn_off
      entity_id: light.entry_lamp
    - service: script.turn_on
      entity_id: script.scary_mode_flicker_lights_loop

scary_mode_flicker_lights_loop:
  sequence:
    - delay: 00:00:01
    - service: script.turn_on
      entity_id: script.scary_mode_flicker_lights

Extract the battery level from a Google Maps tracker and build a battery icon

corban_phone_battery:
  friendly_name: "Corban's Phone Battery"
  device_class: battery
  unit_of_measurement: "%"
  entity_id: "device_tracker.google_maps_110168280884137709870"
  icon_template: >-
    {%- set tracker_name = 'device_tracker.google_maps_110168280884137709870' -%}

    {%- set battery_level = state_attr(tracker_name, 'battery_level') -%}
    {%- set battery_charging = state_attr(tracker_name, 'battery_charging') -%}

    {%- if battery_level is none -%}
      mdi:battery-unknown
    {%- else -%}
      {%- set icon_suffix = ['-outline', '-10', '-20', '-30', '-40', '-50', '-60', '-70', '-80', '-90', ''] -%}
      {%- set charge = (battery_level | float / 10) | round -%}
      mdi:battery{%- if battery_charging -%}-charging{%- endif -%}{{ icon_suffix[charge] }}
    {%- endif -%}
  value_template: >-
    {{ state_attr('device_tracker.google_maps_110168280884137709870', 'battery_level') }}