This layout was designed mobile-first.
- Home Assistant setup
Home Assistant Core installation on Raspberry Pi 4, with MySQL.
More details here.
Milky White | Kinda Dark | Pure Black |
---|---|---|
This repository can be added to HACS as a custom repository. A guide can be found here.
These are some of my custom implementations using Home Assistant:
With custom component Alexa Media Player
, Home Assistant is able to control any thing that you're able to speak to Alexa.
Expand
This requires the use of input_boolean
helpers to control the state of the entity.
E.g. to control a smart plug...
# configuration.yaml
switch:
platform: template
switches:
6a_plug:
value_template: "{{ is_state('input_boolean.6a_plug_state', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.16a_plug_state
- service: media_player.play_media
entity_id: media_player.new_room_echo
# Preferably set an Echo device that is rarely used
# as the Echo device actually carries out the command
# in the foreground
data:
media_content_id: 'turn on 6a plug'
media_content_type: custom
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.6a_plug_state
- service: media_player.play_media
entity_id: media_player.new_room_echo
data:
media_content_id: 'turn off 6a plug'
media_content_type: custom
Using custom firmware and bash scripts, router stats like internet usage can be integrated into Home Assistant.
Expand
Requires Voxel's firmware and entware
to be installed.
vnstat
is required to get usage stats:
ssh [email protected]
cd /opt/bin
./opkg install vnstat
./vnstat --create -i eth0
reboot
Get live WAN in/out
# configuration.yaml
sensor:
- platform: command_line
name: Orbi Router WAN In
command: !secret orbi_wan
scan_interval: 5
unit_of_measurement: 'Mb/s'
value_template: "{{ (value_json.rx.bytespersecond|float/125000)|round(1) }}"
json_attributes:
- tx
# secrets.yaml
orbi_wan: sshpass -p <password> ssh -o StrictHostKeyChecking=no [email protected] /opt/bin/vnstat --json -tr 2
Get daily total WAN usage
# configuration.yaml
sensor:
- platform: command_line
name: Orbi Router vnstat
command: "/bin/bash /home/homeassistant/.homeassistant/multiple_actions.sh orbi_vnstat"
# Script in ./bash_scripts/multiple_actions.sh
scan_interval: 120
value_template: "{{ (value_json.id) }}"
json_attributes:
- rx
- tx
- platform: template
sensors:
orbi_router_wan_in_total:
friendly_name: Orbi Router WAN In (total)
unit_of_measurement: 'MB'
value_template: "{{ (state_attr('sensor.orbi_router_vnstat','rx')|float/1000)|round }}"
icon_template: mdi:arrow-down
orbi_router_wan_out_total:
friendly_name: Orbi Router WAN Out (total)
unit_of_measurement: 'MB'
value_template: "{{ (state_attr('sensor.orbi_router_vnstat','tx')|float/1000)|round }}"
icon_template: mdi:arrow-up
Controls the volume of ALSA - 3.5mm port on the Raspberry Pi.
This involves a input_number
helper, an automation and a series of shell commands.
Requires alsamixer
to be installed.
Expand
# configuration.yaml
input_number:
pi_volume:
min: 0
max: 100
step: 5
automation:
- alias: Set soundbar volume
trigger:
- platform: state
entity_id: input_number.pi_volume
action:
- service_template: shell_command.pi_volume_{{ trigger.to_state.state | int }}
shell_command:
pi_volume_0: echo amixer_0 | netcat localhost 7900
pi_volume_5: echo amixer_5 | netcat localhost 7900
# Truncated. Full in ./config
Similar to above, the script calls the command amixer
to increase or decrease the volume...
hass_socket_script.sh
:
#!/bin/bash
if [[ $MESSAGE == 'amixer_0' ]]; then amixer -q cset numid=1 -- -10239; fi
if [[ $MESSAGE == 'amixer_5' ]]; then amixer -q cset numid=1 -- -7399; fi
# Truncated. Full in ./bash_scripts/hass_socket_script.sh
Plays Lo-fi beats live stream from YouTube.
Requires screen
, mpv
and youtube-dl
/youtube-dlc
to be installed.
Expand
# configuration.yaml
switch:
platform: command_line
switches:
lofi_beats:
command_on: echo "lofi_on" | netcat localhost 7900
command_off: echo "lofi_off" | netcat localhost 7900
socat
runs in the background (systemd unit file) and listens for commands.
Once a switch is turned on, this script is called that starts the playback...
hass_socket_script.sh
:
#!/bin/bash
read MESSAGE
if [[ $MESSAGE == 'lofi_on' ]]; then
screen -S lofi -dm /usr/bin/mpv --no-video $(/path/to/youtube-dlc -g -f 95 5qap5aO4i9A); fi
if [[ $MESSAGE == 'lofi_off' ]]; then screen -S lofi -X quit; fi
# Truncated. Full in ./bash_scripts/hass_socket_script.sh
- People presence
- Router WAN in/out
- HACS updates
This is the only view that contain badges.
/drive
mount- ASUS laptop
always-on
server- Front gate camera
- Mesh router satellite/reboot⬇️
- Desk light
- ... Color temp card
- TV lamp
- ... RGB card
- Soundbar volume
Custom implementation that controls alsa volume, using input_boolean
, shell_command
and an automation.
- Night mode
- Adaptive Lighting
- Lofi beats
- Lofi beats 2
- Jazz radio
- AdGuard Home
- Bedroom AC
- Refresh Plex
- qBittorrent alt. speed mode⬇️
- 16A plug
- Bedroom temperature
- Bedroom humidity
- Automatically lists all active media players
- Front gate camera
- Bedroom AC HVAC
- Controls
- Automations
Tracks states of specific TVs.
- Internet health
- Download speed (Speedtest.net)
- Upload speed (Speedtest.net)
Custom-made sensor that uses the official Speedtest.net CLI instead of the rather inaccurate speedtest-cli
.
Custom implementation that polls data from router via SSH.
- Current server network in/out
- Total server traffic in/out (today)
A combined card that graphs server network usage within the last hour.
Custom-made sensor that gets network traffic from vnstat
.
- qBittorrent active torrents⬇️
- qBittorrent upload/download speed
- SSD free %
/knox
free %- Orbi router info
- ISP node state
- Radarr/Radarr4K queue
- Sonarr queue⬇️/upcoming
- Sonarr shows/wanted episodes
- LAN clients
Using the Netgear integration, this card shows all network-connected devices. Dynamically sorted such that the last-updated device is always on top.
- Spotify media player
- Playlist shortcuts
- Soundbar source
- Bedroom Echo source
- Household Echo media players
- ... switches
- Do Not Disturb
- Repeat
- Shuffle
- Alexa Everywhere media player
- Plex currently watching
- Tautulli current bandwidth
- Network in/out
The four graph cards provide an overview of Plex/network activity in one place and indicates potential network issues.
- Conditional cards...
- Header cards
- TV player cards
- Plex media players
auto-entities
by thomaslovenbutton-card
by RomRidercard-mod
by thomaslovenconfig-template-card
by iantrichcustom-header
by maykarlovelace-swipe-navigation
by maykarmini-graph-card
by kalkihmini-media-player
by kalkihrgb-light-card
by bokubsimple-thermostat
by nervetattooslider-entity-row
by thomaslovenuptime-card
by dylandoamaralvertical-stack-in-card
by ofekashery
radarr_queue: curl -s 'http://127.0.0.1:9100/api/v3/queue?apiKey=<API_KEY>&pageSize=100&includeUnknownMovieItems=false'
radarr4k_queue: curl -s 'http://127.0.0.1:9200/api/v3/queue?apiKey=<API_KEY>&pageSize=100&includeUnknownMovieItems=false'
qbt_alt_limit_state: curl -s http://10.0.0.11:8100/api/v2/transfer/speedLimitsMode
qbt_active_torrents: curl -s http://10.0.0.11:8100/api/v2/torrents/info?filter=active | grep -o -i f_l_piece_prio | wc -l
int_qbt_alt_limit: curl -s http://10.0.0.11:8100/api/v2/transfer/toggleSpeedLimitsMode
reboot_orbi_satellite: sshpass -p <PASSWORD> ssh -o StrictHostKeyChecking=no [email protected] /sbin/reboot
int
are "internal" entities that are used inside templates.- The header that is used for separating cards is from soft-ui.
- to all authors above,
- and all the very helpful folks over at the Discord.