Wednesday, December 21, 2016

Alarms based on sensor readings

This tutorial will demonstrate how to configure Rule that will generate Alarm when certain device reports temperature or humidity that exceeds certain thresholds.

Lets assume that we have devices that are able to report humidity and temperature values. We have one device per room (zone) in the building or other facility and we want to specify different rules based on zone type.

Assumptions

We assume you have already configured email plugin that will distribute generated alarms to recepients. You can follow previous tutorial to do this.

How it works?

We will provision simple rule that filters incoming data using:

  • “Message type” filter to react on telemetry data.
  • “Device Attributes” filter to process data from device that has certain room type as a server side attribute.
  • “Device Telemetry” filter to detect humidity and temperature values that are out of pre-configured range.

Device provisioning

Let’s create a Device and provision certain server-side attributes: ZoneId and ZoneType.

Step 1. Create Device

Navigate to devices page and click on big red “+” button. Populate device name and description and click “Add” button.

image

Step 2. Provision ZoneID and ZoneType attributes

Open device card that you have created. Navigate to “Attributes” tab and select “Server” attributes scope.

image

Click on the highlighted “+” button. Add two attributes “ZoneId” and “ZoneType” as shown below. We will use them later in the rule filters.

image image

Rule configuration

Step 3. Create “Server Room Monitoring” Rule

Navigate to rules page and click on big red “+” button. Populate rule name and description first.

image

Our rule will contain three filters as described in “how it works” section.

Step 4. Message type filter

Add filter based on message type (see image below).

image

Step 5. Attributes filter

Add filter based on the server-side attributes (see image below).

typeof ss.ZoneType !== 'undefined' && ss.ZoneType === 'Server Room'

image

Step 6. Telemetry filter

(
    typeof temperature !== 'undefined' 
    && (temperature <= 10 || temperature >= 25)
)
|| 
(
    typeof humidity !== 'undefined' 
    && (humidity <= 40 || humidity >= 60)
)

Add filter based on the sensor reading (see image below).

image

Step 7. Alarm Processor

Let’s add simple processor that will generate and save alarm to the database based on templates below.

Alarm ID:

[$date.get('yyyy-MM-dd HH:mm')] $ss.get('ZoneId') HVAC malfunction detected!

Alarm Body:

[$date.get('yyyy-MM-dd HH:mm:ss')] $ss.get('ZoneId') HVAC malfunction detected. 
Temperature - $temperature.valueAsString (°C). 
Humidity - $humidity.valueAsString (%)!

image

NOTE Alarm Id is a unique identifier. If there will be multiple events that match filters, alarms will be de-duplicated based on the Alarm Id. Email will be sent once per alarm.

In our case we use timestamp that is truncated to minutes to make sure that we will send email once per minute or less frequently.

Step 8. Rule Action

Select “SendGrid Email Plugin” from previous tutorial and click on “Create” button. Don’t forget to replace “[email protected]” with your mail address.

image

Step 9. Save and Activate Rule

Once rule is saved successfully, don’t forget to activate it by clicking on “Activate” button (see image below).

image

Dry run

Let’s check our configuration by publishing some telemetry data. We will use access token from the device that we have created on the first step.

mosquitto_pub -d -h "demo.thingsboard.io" -t "v1/devices/me/telemetry" -u "$YOUR_ACCESS_TOKEN" -m "{'temperature':42, 'humidity':74}"

Troubleshooting

If you have configured something wrong, you should see errors logged on the corresponding tab:

image

If there is no error in the rule, but you can’t see the email - check errors in the target plugin.

20 comments:

  1. We’ve been where you are now – sitting there on the verge of screaming, thinking “write my essay for me”. We provide 100% legit edubirdie scam, custom written essays that are guaranteed to pass an online plagiarism check and are never resold

    ReplyDelete
  2. This site is great; it covers a lot of ground that interests me and provides a wealth of knowledge. I'm hoping that the future holds even more intriguing things connections game



    ReplyDelete
  3. This post is very amazing alarm based sensor readings is very beneficial moreover any one find cheap writing service so we are providing you best assignments service Dissertation Help London.

    ReplyDelete
  4. What a fantastic resource! It delves deeply into many topics that pique my interest and offers a plethora of information geometry dash lite

    ReplyDelete
  5. The warning device based on sensor readings is an advanced warning device that helps users feel secure about surrounding risks. flappy bird

    ReplyDelete
  6. Immerse yourself in a colorful 3D world with eye-catching visual effects in tunnel rush. Enjoy exciting music and vivid sound effects, providing a great gaming experience.

    ReplyDelete
  7. Get ready to shred, carve, and conquer in the online game that puts you in control on the slopes, slope.

    ReplyDelete
  8. With modern sensor-driven alarm systems, you can enjoy enhanced security. Utilize your cutting-edge technologies to safeguard your residence or place of work. After reading your post, I learned some useful information that will broaden my understanding. We appreciate you sharing this post with us.
    Nueva Jersey Violencia Doméstica Acto

    ReplyDelete
  9. The sensor-based alarm system works similarly to the mechanics in the fnaf games – both rely on constant monitoring of information to detect potential danger. Both help you react in time and avoid unwanted situations.

    ReplyDelete
  10. To begin programming an Arduino UNO device, you will need to have the Arduino IDE loaded along with all of the software that is associated with it. tunnel rush

    ReplyDelete
  11. Fnf brings back the classic rhythm-game style with a modern twist, where players go head-to-head in intense musical duels. Master the beats and prove your skills in this colorful and energetic indie hit.

    ReplyDelete
  12. This sounds like a great tutorial for setting up alarms based on sensor escape road readings. It's important to have rules in place for different zones and to ensure that the alarms are distributed to the right recipients.

    ReplyDelete
  13. Sensor-based alarms are Geoguessr Free systems that monitor sensor data and trigger alerts when specific thresholds are met.

    ReplyDelete
  14. slope game is an addictive online arcade game that challenges players to navigate a fast-moving ball down a steep, twisting slope.

    ReplyDelete
  15. Thanks for this clear and practical guide! The way you explained setting up alarms based on sensor readings really makes it easy to follow along. Excited to try this with my project! Also, if anyone ever finds themselves in need of expert legal help, feel free to check out this abogados de lesiones personales de hampton virginia It’s always great to have reliable professionals on your side!

    ReplyDelete
  16. This compatibility test is an accurate love calculator that tells couples everything about their relationship status. Shall we discover it?

    ReplyDelete
  17. This tutorial explains setting up alarms for temperature and humidity thresholds using a Rule. By leveraging sensor readings from devices in each room, you can create tailored alerts. Ensure you have the email plugin ready for notification distribution. It’s like strategizing in a wordle game ; precision and pattern recognition are key! Follow along to effectively manage your environment and keep things in check!

    ReplyDelete
  18. To set up alarms based on sensor readings for temperature and humidity, follow this tutorial. Consider using the slope game method to establish clear thresholds for each room's devices. By configuring filters—like "Message type" for telemetry data and "Device Attributes" for room types—you can effectively manage alerts. Don't forget to set up your email plugin for notifications to recipients.

    ReplyDelete
  19. Wow, setting up alerts based on sensor data sounds like a very detailed and specific process! Has anyone successfully implemented Sprunki Incredibox something like this in their system?

    ReplyDelete
  20. This increase in complexity makes Block Blast Puzzle a game that requires both patience and strategy, as you need to think a few moves ahead to avoid running out of room for your blocks.

    ReplyDelete