Smart mirror with Lovelace Dashboard

Simple smart mirror project using a Raspberry Pi 4 and BalenaCloud to display a Home Assistant dashboard.

github repo

Hardware

Easy way

  1. balena deploy button

  2. Flash your RPI4 with the balenaOS image and boot it up.

  3. Set static IP for your RPI4 in your router DHCP server settings.

  4. Patch your home assistant configuration to bypass auth for smart mirror (bypass auth for any specific IP address)

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
  1. 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.

Manual way

  1. Clone this repo
git clone https://github.com/0x77dev/smart-mirror
  1. Install balena-cli

  2. Create a new application in BalenaCloud and push the code to your application

balena login
balena push <app-name>
  1. Flash your RPI4 with the balenaOS image and boot it up.

  2. Set static IP for your RPI4 in your router DHCP server settings.

  3. Patch your home assistant configuration to bypass auth for smart mirror as mentioned in the easy way.

Setting custom URL

  1. Open the balena dashboard and navigate to your device.
  2. Open Device Variables
  3. Add a new variable with the key LAUNCH_URL and value with your Home Assistant or any other URL.

Additional docs

Useful commands

Refresh the page

curl -X POST {{ SMART MIRROR IP ADDRESS }}:5011/refresh

Screenshot

{{ SMART MIRROR IP ADDRESS }}:5011/screenshot
1 Like

Here is how my setup looks like:

8 Likes

Very impressive! I was tempted - until I saw the $99 shipping fee to the UK. :astonished:

1 Like