This article is contributed. See the original author and article here.
At Microsoft Ignite 2020, Scott Hanselman showcased how he is using Azure, IoT (Internet of Things), and Developer Tools to help his family manage household chores.
Scott, like more and more people who are working from home, realized that there had to be a better way to stay in front of the need to do additional chores around his home. With everyone at home, things like dishes, garbage, and general chores add up fast. He wanted to be able to see at a glance the current list of chores that needed to be completed, real-time status of chores that can change quickly over time, and to be notified when certain chores were needed to be complete, for instance garbage.
Scott already leverages a DAKboard, which allows customization of a display via a website. On his DAKboard, Scott can put his work/personal calendar, family photos and the weather all on a monitor that sits in his kitchen. He wanted to be able to add a “heatmap” of sorts to his DAKboard that would show parts of the house that notable chores are (garbage cans for instance) and what the “status” of them are in real-time. This way, if he sees that a chore needs to be done, the family can respond.
There are a few things at play here.
- Sensors: Most of the chores rely on items that are not “smart”, so external sensors and an IoT solution will be needed.
- Web: The heatmap requires real-time updates, so a web solution that offers such will be needed.
- Notifications: Finally, he wants to be notified when the threshold is met of a certain chore instantly, so a communication mechanism is needed.
With the above requirements, we can start to build a solution. The solution will require an IoT device that will poll the status of a particular chore. The device will update a datastore via a service and the heatmap will be a web application that will sync with the value of the datastore in real time. With that, we landed on the below solution architecture.
To build the solution, we knew that an IoT device would be needed to monitor the status of the chore. We decided on a Raspberry Pi with a connected . In the case of garbage status, the sensor was attached to the inside of the lid of the garbage can. The sensor could then check the level of the garbage in the can and update the chore datastore via an Azure Function written in Node.js. When the datastore is updated, another Azure Function, written in C#, is triggered that compares the current level to the threshold, and if it is met, a notification is sent.
For the notification, we relied on recently announced Azure Communication Services to send an SMS. When the notification function determines a message needs to be sent, it will leverage a phone number obtained via Azure Communication Services and the chore assignee will get a message from that number. Azure Communication Services is configured via the Azure Portal, more information can be seen at the GitHub repository for the ChoresIOT solution. Working against Azure Communication Services is seamless, as it is included in the already existing Azure SDK (software development kit). There is also an Azure Logic App connector for Azure Communication Services that you can leverage.
For the heatmap UI, we need to leverage a web technology that allows real-time communication with the function that manages the datastore. The technology that was decided on was Azure SignalR Service. The complete application leverages ASP.NET Core Blazor WebAssembly in .NET 5 configured to integrate with Azure SignalR Service. Because we are leveraging WebAssembly, we are able to deploy the application to any host since a backend server is not required. We deployed the web application to Azure Static Web Apps, a new service in Azure where you can host applications that do not require a connected backend server. Finally, since the solution is using Azure SignalR Service, when the chore datastore is updated, the heatmap will update automatically whenever the threshold for a particular chore is met.
Now that the solution is complete, whenever a chore status is updated via the Raspberry Pi, the datastore will be updated via the Azure Function. Once the datastore is updated, the other Azure Function will check the status the chore threshold and send an SMS if needed. Finally, the heatmap will be updated in real-time. This end to end experience can be seen below during the Microsoft Ignite 2020 session.
As you can see in the video, when Scott puts trash into the garbage, the heatmap automatically updates and he receives an SMS message, powered by Azure Communication Services.
The ChoresIoT GitHub Repository lists out all the parts needed to setup a similar solution at home. Take a look at the source code and contribute or ask questions if interested. For more information on Azure Communication Services and how to enable telephony-over-IP communications features to your applications, be sure to check out the documentation.
Also be sure to check out the free services that you can create in Azure today.
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.