2019/08/08

Raspberry + Automations = Easy Life ????

Trips to go home are usually long and there are times in which I usually have a lot of dead time and I like to use it to procrastinate and finish up solutions of how to optimize or automate some daily tasks that I have and wrap up some “micro-side projects”.  While you may be interested in this post, before you continue reading, I have to warn you that there are going to be instances where I am going to be very technical, and you may not understand anything, in case this happens and you continue reading, you may discover that you want to buy a raspberry.

My last warning, do not expect big projects, as I said previously, this is about “micro side projects”, which means, to solve minimum tasks.

But wait a minute… What is the Raspberry?

According to Wikipedia:
The Raspberry Pi is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote teaching of basic computer science in schools and in developing countries. [5][6][7] The original model became far more popular than anticipated, [8] selling outside its target market for uses such as robotics.

No-Pi + Raspberry = Raspberry Everywhere

Image: Termius, one of the best SSH clients for iOS connected to raspberry.

To be concrete, it all started when I was given a Raspberry Pi 3b for my birthday, every nerd would see it as a 92x17x64mm mini computer ideal for creating retro consoles, and that was the reason why it was a gift. My first reaction was to install a Micro SD memory card in the operating system Retropie (a variant of Debian oriented to the emulation of retro consoles).

On the first days, I installed some super Nintendo games, but then, I installed no-ip (a service to have a web domain with Pi’s dynamics) and I configured my router to connect by SSH remotely and thus connect from anywhere (I know, I became technician, but I told you I was going to become one).

But what does all this mean? For a normal person, not much, but for a programmer with extended travel times, a way to create new things in those dead moments and that allowed me to automate many tasks and have a home server with a very low cost.

However, in those moments of procrastination I saw the birth of some projects that I will mention below.

HomeKit + Raspberry = Homebridge

Image: My home setup

Apple it’s a company that I follow, and a few years ago it gave birth to Apple HomeKit, a platform for home automation. The concept was quite simple but not all my devices were compatible, so here is where I discovered Homebridge, a Node service that allows us to add non-compatible accessories to HomeKit, that way and with the help of very cheap hardware, I was able to adapt some plugins to integrate my air conditioning, smart tv, lights among other things to HomeKit. The result? to control the temperature of my air conditioner or change the channels of my old smart tv, as if they were completely new devices and why not, control the lighting as well. In this way, if I am arriving home, the lights are turned on and if it is very hot or cold I can also control the temperature from any device.

Raspberry + Media Server = Stream for anywhere

Image: Infuse 6, my media player par excellence

One of the first things I did with the Raspberry was to make a media server to stream content. However, the download process was very tedious and therefore I created an integration with the TV Time API (an app to track the progress of series) so every time I started to follow a show or watch an episode, it was downloaded automatically and it would sent me a PUSH notification to my iPhone.

Raspberry + Siri shortcuts = (Almost) Everything is posible

Image: My siri shortcuts setup in action!

In May of last year, Apple announced Siri would have Shortcuts, which is the rebrand of an app called Workflow. According to them they mentioned: A shortcut is a quick way to get one or more tasks done with your apps. The Shortcuts app lets you create your own shortcuts with multiple steps. For example, build a “Surf Time” shortcut that grabs the surf report, gives an ETA to the beach, and launches your surf music playlist.

Among the tasks allowed, there was one that would execute scripts by SSH, that is, I can add a Raspberry task and execute it through Siri. Interesting right? In the boring world of programming, it is hahaha.

Thanks to this, I was able to make a very interesting mix of functionalities, for example: If I want to download a very heavy file, I can execute the “Download clipboard” shortcut and the Raspberry will automatically start downloading it, or another example could be if I execute the shortcut “Sleep mode” it will turn off all the devices, activate my alarms and configure the mode do not disturb on my iPhone …

Do you already have a Raspberry? Do you use Siri shortcuts or any automation? Let me know!