Tuesday, November 8, 2016

Triggers

After some playing with gateway functions and Home Automation Systems, I have realized that I often need to pass some data from one sensor to another. Either periodically every time there is new value or just when there is a condition met. These conditions are mostly rather simple, like voltage on battery powered node is reaching low level, or turn on light then there is a person in front of PIR alarm sensor. Having a gateway, I can collect the data. Pass it through Ethernet to MQTT, then to some automation server like NodeRed, process the state and send the result all the way back to another remote sensor or relay. I thought this can be a bit overkill and always require a running computer or at least a Raspberry Pi, so the triggers were born.

Triggers is new option in firmware 1.7.3, it offers as the name suggest, triggering events on sensors or zones. The overview is shown on following picture:



There can be up to 10 triggers created, or more if you set it in code, that can do various task or react on zone state or sensor value.

The setting of each trigger is shown on right. You can assign name up to 15 characters for each trigger and turn it On or Off. Important is the source address, that is the sensor or zone number, that triggers the subsequent action. Symbol is condition describing when the trigger should happen. Put it simple, it is "if ... then" in code. There can be "=","!","<",">","A", that is equal, not equal, less then, more then or always. Value is a float number that the condition is compared to, except for symbol always that is processed anyway. Then there is logging flag, it means the trigger event is passed to logger, which can then send SMS or email, based on logger setting. Pass flag will indicate that when the event is triggered, gateway will pass the value to To address sensor. Pass once flag is preventing subsequent sending of value for same trigger, and it is reset when condition is negative. Pass Off will send first message to recipient after the condition is negative. Pass value or constant switch is deciding if a source address value is passed to destination address or the constant present in Constant On and Constant Off.

With above you can dynamically assign many events that can help you improve your home automation directly in friendly web interface. On first example picture above, there are 2 triggers created. First to send SMS or email when battery is reaching low level on my meteo station. And second will turn on light whenever there is PIR sensor triggered on zone called stairs. Simple as that, and it just works!

You can create many other scenarios for triggers, such as simply passing data from one sensor to another. I have in mind passing external temperature and humidity to internal temperature and humidity sensor that turns On/Off fan in bathroom. This way you can compare the two values and make better decision.






No comments:

Post a Comment