How the setup works:
- A Home Assistant template sensor is used to generate the text and icons to be displayed.
- Thanks to the Home Assistant REST API, this data can be accessed through a single HTTP GET request from http://homeassistant.local:8123/api/states/sensor.galactic_home
- The Micropython scripts installed on the Galactic Unicorn take this data and display information about your house, the weather, etc.
Tip: This requires some experience with Home Assistant. I've tried to put links to the Home Assistant documentation where I deemed it necessary
This folder contains 2 files:
configuration.yaml
which contains the lines to be added to the main Home Assistant configuration.template.yaml
which contains the display logic to show text and icons on the Galactic Unicorn.
In order to change the configuration of the Galactic Unicorn display without the need for a USB cable, the contents of the display are configured in a YAML file in Home Assistant as a template sensor
This configuration file creates 2 sensors:
sensor.galactic_icons
, which is a list of 11x9 icons displayed in the middle part of the screensensor.galactic_home
, which has an attribute nameddisplay
which provides all data used by the galactic unicorn
This configuration allows the Galactic Unicorn to retrieve all data in a single HTTP request.
The configuration provided is an example that displays:
- The week of the day, using the
now()
function - A custom message, created via a Text Input Helper
- The title of the media played on a Media Player
- The next garbage collection day, using the Afvalwijzer HACS integration
- Data from a local HA calendar
- Data from temperature sensors
- Data from Air Quality sensors, with different colours based on different thresholds
- Three forecasts from OpenWeatherMap
In order to use the doorbell function, you can add it to an automation or script, and trigger the RESTful command defined in configuration.yaml
main.py
is the file that is loaded when the Galactic Unicorn launches. It does nothing except call the next Python file.galactichome.py
contains the main application logic.gh_visual_assets.py
contains additional assets, such as the font used for the clock digits and the HTML code that shows when querying the Galactic Unicorn over the web.gh_config.py
where you configure your WiFi network details and the hostname for Home Assistant, among others. You need to generate an API key a.k.a. long-lived access token in Home Assistant to put in this file.wave_player.py
a wrapper to play wave files on the Unicorn. Relies on the files inside thelib
folder.
Additional files (batteries not included, sorry!) are needed to make it work:
- Wave files for different times of the day (must be mono, 16-bit, 22050 Hz). Be careful of the limited space on the Pico W. At 43KB/second and less than a megabyte of free space on the controller, you need to keep the total duration under 20 seconds.
- A wave file for when someone rings the door
icon-maker.html
: A tool to create icon codes for thegalactichome.yaml
display-simulator.html
: A tool to try out how the display would look like and export it as SVG.
- Use it as an alarm (similar to the door bell, but using Pimoroni's synthesizer functions)