Summary: Every morning my lights turn themselves on, along with my amplifier which begins playing a random song off my wake up playlist.
My home assistant dashboard looks like this:
While the pi looks like this:
This is actually my older pi model C from 2011, without the HiFiBerry DAC attached. The breadboard and chips are used to communicate with the remote control RF plug sockets. This tutorial by Tim Leland provides the starting point. WiringPi and pinout are useful to get the right pinouts.
I bought 5 pairs of 433Mhz RF Transmitter module + receivers for £4.50 from amazon, the breadboard and cables were a pound each, and 10 remote control plug sockets from ebay for £35.
After connecting up the RF module and installing Tim's
RFSniffer module, by using the remote control for the plugs we can sniff the 433Mhz codes it is sending to each plug and note them down.
Once we've got the codes for each plug, we then use the
codesend module from Tim's code to send out each individual on/off trigger.
oncmd: "/var/www/rfoutlet/codesend 29955
offcmd: "/var/www/rfoutlet/codesend 29964
So, my morning music script can be seen in this gist. After the Home Assistant automation script turns on the uplighter, fairy lights and amplifier, what it is doing is:
- Clearing the mopidy tracklist
- Adding playlist using the Spotify identifier - to find, right click on a song or playlist and select ‘copy Spotify URI’*
- Set to random
- Begin playing
I'd like to implement more scenes and automation rules, as well as setting up Owntracks for location tracking. At present we see if people's phones are connected to the network to check if they are home, which is not that effective a solution.