Offloading resource-intensive messaging tasks from the microcontroller
In the post 'A secured way to home brewed HA', I implemented a way to get into a pool of unsecured IOT devices from outside network without compromising the security. In this post, I explore a solution to do same going the other way round. I'll take the problem of notifications (messaging) arising from, lets say, ESP nodes (unsecured network) and deliver it outside global network securely.
Let's consider the following 2 channels:
- SMS via Twilio service
Both of these provide an API to make restful webservice calls to their service. But since they require use of SSL, which a processor like ESP8266 might not have enough horsepower to deal with. The workaround that I went for is of course, to use Raspberry Pi for all such messaging tasks and then have that as a single messaging/notification node to which all the other ESP nodes send information to over HTTP.
Few other advantages of this architecture would be:
- The messages/notifications can be pushed to a local database providing an opportunity for analytics
- Single point of routing control which provides an easy way to switch between channels and/or use any combination of it
- Scalable solution to adopt new messaging channels and services without putting resource constraints on the user nodes i.e. ESPs, Particle boards, etc
References & Further Reading:
- Twython: https://twython.readthedocs.io/en/latest/
- Twilo: https://www.twilio.com/docs
Related but unrelated:
- Make sure you configure your preferred notification channel