Simple smart mirror project using a Raspberry Pi 4 and BalenaCloud to display a Home Assistant dashboard.
Home Assistant Community Topic
- Raspberry Pi 4
- SD Card (4GB+)
- I bought this pre-built smart mirror on Amazon, but you can build one or use any monitor.
-
Flash your RPI4 with the balenaOS image and boot it up.
-
Set static IP for your RPI4 in your router DHCP server settings.
-
Patch your home assistant configuration to bypass auth for the smart mirror
homeassistant:
auth_providers:
# Important to keep this top on the list to bypass login page
- type: trusted_networks
trusted_networks:
- 192.168.0.0/24
trusted_users:
# Set your smart mirror ip address and kiosk user id
# Tip: to enhance security and avoid ip changes modify your router DHCP server to assign a static ip to your smart mirror
{{ smart mirror ip address }}: {{ user uuid }}
# Disable bypass for the rest of the network
192.168.0.0/24:
allow_bypass_login: true
- type: homeassistant
- Optional: Install Kiosk mode, Blackened Theme, and Browser mod for better automation and UI experience.
I use a separate dashboard for the smart mirror with a custom theme and kiosk mode to hide the header and sidebar.
Here is an example of the dashboard configuration:
kiosk_mode:
kiosk: true
hide_refresh: true
block_overflow: true
views:
- type: sections
title: Home
icon: mdi:home
sections: []
cards: []
max_columns: 10
theme: blackened
And then to edit the dashboard use /dashboard-mirror/?disable_km&edit=1
and see Setting custom URL to set the custom URL (omit the query parameters) for your separate dashboard.
- Clone this repo
git clone https://github.com/0x77dev/smart-mirror
-
Create a new application in BalenaCloud and push the code to your application
balena login
balena push <app-name>
-
Flash your RPI4 with the balenaOS image and boot it up.
-
Set static IP for your RPI4 in your router DHCP server settings.
-
Patch your home assistant configuration to bypass auth for the smart mirror as mentioned in the easy way.
- Open the balena dashboard and navigate to your device.
- Open Device Variables
- Add a new variable with the key
LAUNCH_URL
and value with your Home Assistant or any other URL.
- Browser/ REST API and Configuration variables
- Home Assistant/ Auth providers
- Getting started with Balena
curl -X POST {{ SMART MIRROR IP ADDRESS }}:5011/refresh
{{ SMART MIRROR IP ADDRESS }}:5011/screenshot