My day is filled with adhoc and irregular meetings times that aren’t predictable. To coordinate my work life with my wife and family, I setup a Apple Shortcut automation that runs on it’s own every morning, grabbing my Google Calendar events for the day and texting/iMessage’ing the times. To accomplish this, I
Created the shortcut:
Then Setup an ‘Personal Automation’
To run at 8am, which runs the Shortcut
The ‘Do’ is simply the ‘Run Shortcut’ action, which points to the ‘Text Meetings’ Shortcut setup before.
The only caveat I have so far is it’s the start time only, not end time or duration. This isn’t a big problem as most meetings are around an hour anyways.
Optionally for installation: long micro-usb to usb A cable, 3d printed case, Velcro to stick case to wall
Optional: Setup Apple TV to use IR
Not totally sure what interface the Apple Remote uses, but if looking to Replace Apple TV: you can map the Apple TV to listen to some arbitrary button presses from any unused remote following this doc.
Build an IR Receiver to Capture Codes
First step is to capture all the IR codes. I set up a receiver as follows:
The nice part about this layout for the IR receiver I had is I was able to just slip it into a breadboard, no wiring:
In the ESPHome section of Home Assistant:
Click the big “+” add button in bottom
Fill out the wizard
Once created, edit the module and append to the bottom of the config:
Then validate, and upload through the USB port if this is the first chunk of code being sent, after that, no need to be plugged in and Over The Air works fine. Home Assistants Notification panel should alert of a new device detected, and you can add in the device and the entity.
Once uploaded, the logs should continue to show in the modal window. Try pointing an IR remote at it and smashing some buttons. If it yells a bunch of crazy number strings at you: it’s working!
There’s some important notes while looking to record a single button:
if the “Received Raw” starts with a negative number, you pin may not be inverted and may need to be. IR signals are a positive number (length of high value), followed by a negative number (length of low value).
A single press resulted for me in 3 lines. I needed to manually merge the first two and ignore the third. Why? I have no idea. For example, here’s the power button for my TV:
I combine the first and second lines, and remove the last line. The need to remove the third comes from line 2 ending in a positive, and line 3 starting in a positive, IR patterns must be positive negative. I don’t know why that third line is there, but removing it everything still worked in the end. From the above, my IR signal for the TV power button ended up being:
With the codes captured, next step is to build a transmitter. I think it’s best to use a dedicated board for sending, instead of adding the blaster to the receiver. I originally tried to setup just one board that would both receive and sent the codes, but found the boards lacked the brains to push and get at the same time successfully, which made debugging nearly impossible. I found it far easier to dedicate one device to just receiving and another to sending.
I read that ESP8266’s weren’t that great at sending the blasts and ESP32’s were a better choice due to some improved chips onboard, however I had success with ESP8266.
I wired the blaster like so:
The just like before, created a new ESPHome entry with the following appended to the config, adding the in the buttons and their codes:
An important one here is the tv_nothing_button , it is what is says, it’s a button that just like all the others is registered on the esphome setup, however, it sends a invalid value, triggering nothing, but allows the UI to house proper spacing and a consistent look.
All our devices and lights to control with IR are on a single wall, so mounting the on the opposite wall, higher up towards the roof gave the blaster direct line of sight to all devices, and kept it out of the way. Before mounting I tested all functionality, walking around with the ESP8266 connected to a battery pack to find just the right spot, and quicker debugging. I used Velcro to mount this device so I can swap out the case when I got around to designing one, as well if I ever need to replace the ESP8266, I can easily take it down from the wall.
It’s not pretty, but it works. I’ll eventually get around to designing and printing a case for it.
Considering for each button press, the flow data is Home Assistant App on Phone > Wifi > Home Assistant > Wifi > ESP8266 blaster > Target Device, it actually works really fast. No noticeable latency or delays connecting. Additionally, I just used the normal HA ESPHome API, not MQTT. Every time I open the app, the module is already connected and ready to press a button (no load or unavailability).
Our families use case for the buttons we needed, is simple and straight forward, so this solution of just firing up the Home Assistant App on our phones was the perfect fit.
Automation & Shortcuts
With all the button entities added into Home Assistant, scripts and automations can be made with ease. For example, I created a “boom button” script that toggles all the power buttons.
Additionally, the Shortcuts app on iOS with the Home Assistant app allows you to turn entities on and off, or run scripts. The title of these shortcuts are pre-wired into Siri, so “Turn TV On” voice commands can be wired up in just a few minutes. More about this here.
I did not store the state (“on/off”) of a button in Home Assistant. Though the button entity can, doing so raised risk of state being incorrect if any of the devices are toggled manually or via the real remotes. I opted it was best to treat the buttons just like an IR remote that are unaware of a device being on or off. This limited automation (eg: turn on if not on), however I’m okay with that.
I won’t go into the details on the boards, but if unfamiliar it, the tl;dr is you write some C/Lua code using the Ardunio IDE, include WIFI for ESP8266 and Web Server libraries (here’s hello world example code and a great setup video) and add some handlers to toggle the GPIO pins on certain requests, then flash that code onto the board over USB. If never used before, I assure you it’s not as hard or complicated as it may sound or appear. When the board is plugged in, it fires up, the code executes, connecting to WIFI, and this tiny board becomes a server in your local network.
Here’s the wiring I did:
& here’s the code I flashed onto it (note you will need to add your WIFI credentials):
I placed this downstairs in my kitchen as a sort of satellite Slack Busy Light, so my family could check in on my status while not in our upstairs hallway:
If you have a common anode RGB LED, be aware the mixing of colours (on startup and when ‘away’) probably won’t work out of the box. Mixing colours on a common anode RGB requires some sort of pulsing frequency – can probably Google for more info on this or a library. Also the script will need to be edited, changing LOWs to HIGHs and OUTPUTs to INPUTs, and vice versa. I’ve updated the script to use a library to get the mixed colours more accurate for both common anode and common cathode.
* despite this low cost, I personally didn’t want to wait for shipping overseas, so instead I went with a Canadian supplier and bought a pre-wired no soldering RGB LED for $3.95 and the board for $9.98 (on sale). There was a $12 shipping fee, but I order a lot from them so that cost is hardly noticed. Even so, that’s just $14 (+ $12 shipping). Amazon and many other stores also has low prices for these parts.
Prototyping a small counting game – pressing a button to count up to 5 with LEDs and on an OLED screen – then celebrating once reached.
My daughter loves to help me build simple circuits, turning LED lights on and off on a breadboard. Not yet grasping her 1-2-3’s or A-B-C’s, I thought building a small game would be an engaging way to get her learning with the things she likes.
By no means am I a Python developer, so I’m just swinging away here – the codes very repetitive, but hey, it does the trick easy enough.
Run the script with python3 oled-count-game.py. If the script fails and you get a warning about missing modules, the modules can be installed usually with sudo pip3 install <module_name>, for the GPIO if that’s missing, it can be installed with sudo apt-get install python3-rpi.gpio --assume-yes.
I recognize that my last post about a DIY Status Light the project had a total cost over $100 (and that wasn’t evening including SD cards, power supply, shipping & taxes). And that high cost wasn’t for core functionality, it was for aesthetics.
I wondered if I over did it, and how much it would cost and what we be involved, to build a status light for as cheap as possible. I quickly found the answer (from the store I frequent):
Building this out, you’ll notice in the images on this post, I’m using a breadboard instead of the Squid. I did this because I had all the parts of the Squid already from separate kits just not assembled. Note everything in the pictures used is the exact same as the Squid, the Squids just pre-assembled and the cheapest way to get exactly what is needed and nothing more.
Because there is no big led matrix panel, I found a normal phone charger or laptop can be used to power the Pi and light instead of a proper >2 amp power supply. This saved about $5-10.
This is a solder-less approach, so there’s some extra cost in getting the Zero WH instead of just the Zero W and the pre-wired RGB LED, if you know how to solder and have the equipment and can shop around for cheaper parts or cheaper shipping, you may further shave a few bucks off.
Of course you’d need to get creative on a way to mount this at a place appropriate for your use case. Thinking back to when I used to work in an office setting, this would of been great to have stuck the Pi to the rear of my monitor and put this LED at the top corner of my monitor.
Never using GPIO pins before, the code to control this light was way easier than I thought it would be. I had a bit of a curve ball as it took me a while to realize my LED used a shared anode, not a shared cathode (like the Squid is) as both kinds exist, but the code changes to toggle the two is minor. Here’s the script for both and the wiring mentioned inline to test it out (I used $ pinout on my Pi to get the pin labelling):
Edit this script if you’re using a common anode, set commonCath = False. This script can be run by passing the status as a single arg: python3 rgb-led-status.py <avaliable|busy|offline>. Example: $ python3 rgb-led-status.py busy
Forking the busy server, or setting up a new Flask server to run the code for adjusting this light as shown in the code snippet wouldn’t be a big lift at all (though you’ll have to take my word as I’m too pinched for time to prove that).
This was a fun 30 minute project – and a good way to save $60+ if function is greater than form to you.