Power Apps for Home Automation
- Posted in:
- Azure
- DevOps
- Home IoT
- IoT Edge
- Raspberry PI
Power Apps is a great no-code/low-code platform for home automation.
Remote Sauna project
Last weekend I added a new functionality into my home automation. Now the sauna can be turned on and off remotely.
This project had been in my todo list for a long time. I used to be able to turn the sauna on by phone. Just calling my son and asking him to turn it on and voilà, when I got home, it would be ready. Unfortunately, the automation stopped working once he went to high school.
DIY – Do It Yourself
I bought a long drill to drill the hole from sauna to technical room. Huhh. Finally. That was the first and most important step.
The rest of the work are simple DIY - “Do It Yourself” tasks.
#1 Installing the one wire digital temperature sensor DS18B20.
#2 Installing the reed switch sensor + magnet for sauna door.
#3 Installing a big ABB relay OKYM 0R40 into my home electrical panel that I found in my garage by luck.
#4 Already having a small reserve relay module to control the big relay.
#5 Already having the I2C to One Wire (DS2482-100) bridge device connected.
The One Wire system is a very nice solution as it can handle great amount of temperature sensors connected into it.
#6 Eliminating the mechanical sauna heater timer.
After studying the schema I figured out that only one cable has to be reconnected.
#7 Connecting cables into Raspberry PI.
It used to look quite nice when I first started the project. From time to time, I decide to add to its functionalities, increasing the amount of cables by one or two.
#8 Connecting the sauna cables into the big relay.
Logic and programming
Every sauna automation has at least three important rules.
1. If sauna door is open then sauna can’t be turned on.
2. If sauna has been turned on already more than 3 hours then it turns off automatically.
3. If sauna temperature is extremely high (more than 110C) then it just turns off.
Implementation: the sauna button is disabled as the sauna door is open. Closing sauna door will enable the button immediately.
Raspberry PI
Raspberry PI is the central hub of home automation. The base OS is Linux and on top of that is Azure IoT Edge, docker platform and containers. The code is inside the containers.
Visual Studio 2019 is the programming IDE. Code deployment and continuous delivery is fully automated by Azure DevOps and a self-hosted Arm32 deployment agent based on Raspberry PI.
A lot of Raspberry pin’s are already used but I have still some availability.
Power Apps as a user Interface
Home automation user interface is built on Power Apps. There are many reasons of choosing Power Apps over custom made web app.
#1 Power Apps is a no-code/low-code platform. Ready made components to just drag and drop them into place.
#2 Authentication is already done and it’s based on Office 365 security.
#3 Secure database connection to Azure CosmosDB is implemented by Azure Functions.
#4 Two-way communication between the app and Raspberry is secured by Azure IoT Edge.