Example 1: Notify me if the air quality in my house is bad
A very common use of actions is to have it send you an email or SMS if a feed value hits a certain threshold. In this case, I have an Adafruit PMSA003I Air Quality breakout board that is reading the air quality in my kitchen. I want to get notified by email if the air quality gets unhealthy in my home while cooking. Here is a simple Blockly action to make that work:
As you can see above, I chose the Reactive trigger as I only want to get notified if something happens (not regularly). I chose my AQI feed, and have it emailing me if the value ever gets higher than 50. I don't want to get a ton of messages about this, so I have it limit how often I get the emails to a max of every 15 minutes. I then checked Notify on Reset as this will let me know when the feed has gone back below 50.
For the Action, I have it sending me an email. You can change the information in the subject and body of the email or leave it as the default. Also notice you can use the {{feed_name}}
and {{value}}
shortcodes in both the subject and the body to personalize the email you get. Then in the 'using:' portion of the email action be sure to put the same feed as above. This is how the email action knows what to use for the shortcodes.
Example 2: Send me an SMS with the temperature outside every day at 8:00am
In this example I have the action set up to send me the temperature from my outdoor weather station every morning at 8:00am.
I used the Scheduled trigger with the Daily Schedule block, and set it to 8:00 AM. You can also switch the block to the daily, weekly, monthly, or annually block. Then I used the SMS (IO+ only) block for the action, and set the feed to my temperature feed.
Example 3: Turn on buzzer if sump pump is too full, and then turn buzzer off again after 1 minute.
This example is a bit more advanced and will require two actions to get it to work right. The first action we want to set up is to turn the buzzer on if the water in the sump pump well reaches a certain level.
Here we used the Reactive block to turn on my buzzer by setting the Buzzer feed to TRUE. This will happen if the Reactive feed detects that the water in my sump pump well is more than 80% full. I will check the water level in the sump pump well every 30 minutes.
Then I will create a second action and use the Timer block to trigger at the same time. But the Trigger block works differently in that it won't take action until a set amount of time has passed. In this case we want to turn off that buzzer after 1 minute.
The most important things here are that I have it set to Run After 1 min (so the buzzer will run for 1 minute before we turn it off). The next thing is that I have Extend Timer checked. This will make sure that as long as the SumpLevel feed is higher than 80, the buzzer won't turn back on again after it has been turned off.
Text editor powered by tinymce.