When my alarm clock goes off in the morning, the lamp on my bedside table also turns on, to help me wake up, and its color indicates outside temperature: from red for warm through yellow and green to blue and violet for “it’s freezing outside”
I built this mostly from off-the-shelf components, with a bit of custom script glue, based on an existing home automation infrastructure:
- my alarm clock is a Squeezebox Radio, formerly sold by Logitech, connected to the Logitech Media Server (LMS) running on a Linux VM on my home server
- a custom “daemon” script called
lms2mqttrunning on the same server connects to the LMS via Telnet, listens to notifications about status changes, such as “alarm went off”, and publishes those notifications as MQTT messages. This script is available on Github.
- the openHAB home automation controller subscribes to those MQTT messages, and when it detects the “alarm has gone off” message, it triggers execution of a rule, i.e. a piece of code in the openHAB domain-specific language.
- that rule retrieves the current local temperature from OpenWeatherMap via the openHAB Weather binding, converts it to a color between red (warm) and violet (cold), and turns on the bedside lamp and sets it to that color.
- my bedside lamp is a custom build based on an Ikea Fado table lamp, where I replaced the dumb light bulb with a few RGB LED light strips controlled by a Wemos D1-Mini ESP8266 board, flashed with the open source Tasmota firmware. I could also have used an off-the-shelf “smart” light bulb, or just a “smart” table lamp.
Details of the things, items and rules definitions are available here