Push it!
I've been offered several times home security systems. Usually door to door salesman starts his pitch by asking if I have considered my home security. Yes, I have considered, building some, but not buying. At least the service model, that is being offered is severely flawed. For home invasion, which is still extremely rare in Finland, it does not help if the security can't appear on site in couple of minutes. For fire, water or some other emergency it's very much for the damage control. What if this could be achieved without any recurring fees?
If I'm having environmental monitoring data available from my Wirepas sensor network, how would I make use of all gathered data in a proper way. Fancy of dashboards are just for showing of the system and after a while it get's as boring as watching paint dry. I assume that the normal state of things is not interesting at all. If the temperature at garage exceed 100 degrees Celsius or relative humidity in living room is 100% is more interesting. Or doors are wide open at 03.12 AM.
It's quite obvious that you need to be informed about anomalies when they occur, instead of you checking the status of things from some web page. Fortunately Android and IOS smart devices have push notifications. Naturally it does not happen itself but some infrastructure is required. It's getting even better, you don't have to reinvent the wheel and start setting up servers for achieving this. There are services such as Push Over, which provides push messaging service for Android, IOS and DeskTop environment for reasonable price.
They have already though how the end-to-end solution works. User need to install an application to mobile phone or desktop and create an account. Device and account gets an id that's used to subscribe to notifications.
Developer gets application ID, and a group id associated to application. For example if I create an "home security app", users may register their devices to it and start receiving push notifications. Application developer could send notifications to a whole group or individual users. Sending itself should be quite straight forward operation. Pushover uses a simple, versioned REST API to receive messages and broadcast them to devices running device clients. Standard HTTP libraries available in just about every language, or even from the command line, can be used.
For example by using 'curl' tool in Linux the sending of push:
curl -s \
--form-string "token=APP_TOKEN" \
--form-string "user=USER_KEY" \
--form-string "message=Your sofa is on fire!" \
https://api.pushover.net/1/messages.json
Unfortunately HTTPS is used in the request so that immediately creates a dependency to libssl. There are wrappers for many popular languages like Java, C, Python and Rust. Rust sounds promising until I try 'cargo build', which naturally ends to an error related to dependency on ancient open ssl library. Creating a c program with libcurl seems to be also unnecessarily complicated task, so I'll just end up writing trivial Bash script as above and call using good old system() function. If I set limits for the normal values of measurables and trigger an alarm if things are not within the normal range, this arrangement will do fine. I will most likely revisit the Rust part of the topic later.
This all leaves me thinking about the old programmer joke about "hello world" and how it starts from basic 10 print "Hello World" and gets insanely complex as the writers level of education grows.
If the first line of Basic you learn is 10 PRINT "Hello World" the second is 20 GOTO 10 😆
Of course one of the advantages of building and running your own home security system is that if you accidentally trigger it, you don't have the embarrassment of explaining so to your security company.
Link to the joke: https://www.smart-jokes.org/programmer-evolution.html