Conditional triggers


#1

Say you want to build a simple house alarm that goes off when a door sensor or movement sensor is triggered in a room, you’d want to be able to turn off/on the alarm or have it be on at only a specific time of the day. To do this we need conditional triggers, e.g this alarm scenario only happens if a button is turned ON. Of course one could just enable/disable the whole trigger from the dashboard, but with conditional triggers, you’d get much more customizability. One could have a physical switch that turns the trigger on/off or you could even have a location condition, which in the example would disable the alarm when my GPS location is in the house and enable it when I’m away.


#2

Hi @vegetish. Thanks for the thorough explanation on your use case(s). Seriously, this helps our design team a lot and makes sure we know how to meet the needs of our Community…Many times we will gather as much information in the topic posts and use it as a spec when designing features.

Hmmm. So it sounds like what would work is the ability to represent a given trigger with a widget. Let me explain through an example and you can tell me if we are on same page.


Let’s define Trigger A as:
“If temp. above 80 F, then turn on Air Conditioner.”

You’d like to turn this trigger ON/OFF without having to go to your Triggers & Alerts section of dashboard and enable/disable the trigger from there. Furthermore, you’d like to turn trigger ON/OFF based on external factors, such as time, location.

To meet your needs, you create a button widget that is tied to Trigger A. You call this button “Trigger A Button”. Trigger A Button is placed on the dashboard interface just like any other button widget on the dashboard.

  • When Trigger A Button is ON, then Trigger A is enabled.

  • When Trigger A Button is OFF, then Trigger A is disabled.


Since there is now a button on the dashboard representing your trigger,

  • You can manually turn Trigger A Button ON / OFF.

  • You can use the Cayenne Scheduling feature to turn Trigger A Button ON / OFF at specific times during the day (thus enabling / disabling Trigger A).

  • You can even use Trigger A Button in the Cayenne Triggers & Alerts feature (A trigger within a trigger!).
    Example: When location is within 5 miles of ‘House’, then turn ON Trigger A Button. *

*This is assuming the location widget (we are working on this!) is already implemented.

**To your point, it would be great to be able to also tie the Trigger A Button to a physical button in the real world. That way, you can flip a switch and turn ON/OFF the trigger. (Of course, a potential issue could be if you turn ON/OFF the button widget on the dashboard but the physical switch doesn’t change so now it’s contradicting the actual status of the trigger…but let’s not worry about this just yet).

Thanks again for your time here!

-B


More complex triggers?
#3

Yep @bestes, you got it right. :wink:

You’re right that if you had a physical switch like a light switch that can have the state ON/OFF you could end up with a contradicting status. What I had in my mind as an ON/OFF button was something like this momentary push button: http://www.aliexpress.com/item/Waterproof-stainless-steel-Red-Led-12V-16mm-Metal-Push-Button-Momentary-Switch-For-Car-Boat/32373717173.html

When the trigger is enabled, the LED on the button will glow, whether it was enabled through the dashboard, triggered by time/location/etc, or physically pushed. Then when it’s pushed, the trigger will disable and the LED will turn off at the same time to indicate the status of the trigger to the user.


#4

Hope I’m not violating any protocol jumping in here but I have a seemingly similar need. I have a RPi3 running Jessie. I have the following devices installed and working within my Cayenne project: relay board, MCP3008 w/LDR connected, DS18B20 temp sensor and a simple LED. I want a fan, controlled by the relay module, to turn on when the DS18B20 indicates 84F and I want the fan to turn off (relay off) when the temp on the DS18B20 drops below 80F. I created two IF/THEN events for this. The event that turns the fan on (higher temp) works fine, but when the temp drops below 80F the fan doesn’t turn off. In other words, once the relay is triggered on by the rising temp, it stays on forever, unless I manually trigger the relay “button” off.
Kudos on Cayenne, this is a very cool concept.
Any suggestions how I can make this happen based on the temp parameters and not on physically operating a “switch”? Thanks in advance for your thoughts!


#5

Should have worked harder before posting. Here’s how I made this work – stirred by bestes’ post.
All done from dashboard on my Android smartphone using Cayenne widgets, etc.
Create LED Switch (cnx to GPIO on 23 in my case) – turns on LED if pressed.
Create trigger to activate light switch if temp of DS18B20 hits 84F.
Create trigger to turn light switch off if DS18B20 is below 81F.
Create trigger for relay on if light switch on.
Create trigger for relay off if light switch off.
This works great with a slight delay between LED action and relay operation - a few seconds.
Seems a bit round-about BUT VERRRY cool & fun!