arrow_back Blog What I've been up to

What I've been up to

What I've been up to
Piotr
Peter M Pelica
February 28, 2024 sell Technology
translate Ten post jest również dostępny w języku polskim.

Ah yes. The blog. The place to write things. A blog specifically made for writing stuff. The blog.

I mean at this point I should be used to the fact that I write stuff and then forget about the existence of this thing for months or years at the time. Life just gets in the way, or something along those lines.

Anyway.

Those of you that know me (and probably some more people too) know, that I do some home automation stuff (and have been doing it for a long time now). At some point I've discovered Home Assistant and learned a lot of other things that eventually led to my decision of discontinuing writing my own software for this; mostly the maintenance of it all suffered due to me focusing on different areas and simply lacking time. Don't get me wrong, there's still a lot of scripts that I write for this, especially to glue some of this stuff together, but it's a completely different kind of thing to do.

HA is great and I love it, but it only can go as far as the stuff you connect to it will allow you to. It requires sensors and devices that will actually do stuff you want to automate, but here's the thing – almost everything can be a sensor, especially if you DIY it that way.

Meet the ESPHome.

ESPHome is a sister project of Home Assistant, made by Nabu Casa, the company responsible for both of them (and some other cool stuff, do go and check them out). It allows you to take the ESP chips (ESP32, ESP8266 and similar) and install a piece of software onto them that will allow you to configure their behaviour using yaml files – like magic! (I'm seriously oversimplifying things here.)

Okay, okay, but what does that mean? Well, you can do cool stuff like getting your existing electronics that have that chip in them and making them vendor-independent, meaning no more subscriptions or broken devices due to some third-party cloud not working; or you can make some of your dumb devices smart, allowing you to control them via Home Assistant (and it's powerful automations); or you can use the ESP boards and load them with sensors to gather data for your HA instance.

The sensor array

I sometimes joke that my house is slowly becoming a spaceship, as I've got a loads of internal and external sensors, which all feed the data to the HA, which then stores it and allows me to analyse it, make decisions and trigger automations based on that.

Take this as an example – this is a NodeMCU board which features the ESP8266 chip. It has been programmed with the ESPHome and is now taking data from the DHT11 temperature and humidity sensor (the blue thing on the right), sends it to the HA and displays it for me to easily see on the connected display. I've had this one for a while and I'm super-happy with it, it's much more stable over my code. I've recently changed it to also get the data from HA (yes, that's possible – you can get states of other sensors connected to the Home Assistant) and display how much time is left on my air fryer or what's the progress of the 3D print, but only if any of those are currently in progress. It works great, mounted above my workstation, as all it takes is a quick glance and I know what's what.

I have actually created more of those – for example this one is using a different type of the display and shows which bins will be collected and how many days away is that.

The date is pulled from the local council's website and I also get a notification on my phone in the evening before, so that I never forget to take the bins out. Normally it's just a reminder, but I've been caught off guard a few times around holidays, when the date has moved from it's usual "Monday morning".

But then again, a lot of things can be a sensor.

Hack the planet

Well, I guess this shows that I'm old or something...

Anyway, as I said earlier, it's not just sensors and displays, it's also modifying existing equipment, whether it's changing how it works or just adding extras to it.

Take this IR Bridge by Automate Things – it's a shield for Wemos D1 Mini, essentially turning it into a infrared receiver and transmitter. Integrating it in ESPHome using a Remote Transmitter component is trivial and you get yourself a smart universal remote that can automate many things that do not have any kind of control other than an IR remote – for example AV receivers, TVs or air conditioning units.

In my case I've added a smart socket to my PC monitor, which monitors the power usage and therefore knows, if the screen is on or not – then it can turn on or off the hi fi system accordingly.

Additionally, if I start streaming music on my Chromecast, then the hi fi will turn itself on and a channel on which the Chromecast is connected will be selected. Magic. I can also control it's volume using my phone.

Everyone in the UK knows how high the electric bills have been recently, so finding ways to use less energy is a must. Well, I've got a "dumb" meter, so it's either tracking the energy use by noting it down or using a non-invasive way like the Glow project. This uses a photodiode which counts the number of pulses on the meter – you know, the blinking light with 1000 impulses / 1 kWh written next to it; this then connects to a ESP board and counts the pulses, sending data to the HA's pulse meter integration, therefore providing essentially real-time usage stats in the HA energy dashboard – telling me how much energy I've used today, how much I'm using right at this moment and if provided with the current kWh price, can tell you the cost – which you can get directly from your energy operator, if they have an API, like Octopus Energy (affiliate link: we each get £50, if you sign up with it).

Here's another smartified piece of tech – the IKEA Förnuftig air purifier. It's doing it's job nicely, but now, thanks to tht's tutorial in the HA Community I can control mine using the power of automations.

Using a D1 Mini and a voltage regulator, I take the power from air purifier's power supply, and then send a signal to mimic the dial that's originally there.

I can now automate it to, for example, turn itself on low mode when I'm going to sleep or when I leave the house and put it back to normal otherwise.

Another thing I've done recently is this roller blind motor – using a stepper motor and a 3D print model from nidayand and heavily modified ESPHome config from sender I've automated my blinds to open and close automatically, upgrading my existing system to wake me up with light to allow for the natural light as well.

Now, apart from the lights, the blinds will open about an hour before I need to wake up, to let the sun in, allowing me to wake up more naturally. They will also close themselves when I go to sleep or it's dark outside, whichever comes first.

Do it yourself

Well, I know that most of it looks hacky or partially done. To tell the truth – that's because it is! Ultimately it's a DIY project that I spend a lot of time on, but it's currently in its most stable stage (probably). The important bit is to design those systems in a way that everything could be controlled manually, in case the automation fails – this could be due to a configuration error or a power cut.

Could I live without all of those? Probably. The reason I'm doing it is mostly so that I can forget about stuff, because it's gonna happen on it's own – so I can focus on wherever my brain will take me next. And learn. And have fun.