This block monitors JSON values coming in from a temperature sensor and sends an SMS notification if temperature reading crosses a threshold indicating fire.
Fire sensor alert BLOCK makes use of two event handlers. The first event handler monitors incoming messages from temperature sensors and generates an alert when temperature is beyond 420 degrees (indicating fire).
This alert is fed into another event handler along with contact information of person to be notified. This event handler uses the information to compose and send an SMS to the contact using RingCentral's API. Visit https://developer.ringcentral.com to get your credentials for RingCentral API.
This block can be extended to other scenarios as well, to monitor for readings from sensors going outside predefined range.
As extension, more alerting handlers can be added to send emails or other types of notifications.
Sensor readings in JSON format are sent to input channel: fire-sensor-alert-channel
{ "temp": 451, "device_id": "com.pubnub.sensor25" }
Need help? Contact PubNub Support.
Copyright (c) 2018 PubNub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.