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.






Monday, November 7, 2016

Schematics for new boards.

Just small maintenance update for today. I have just uploaded current versions for gateway version 1.7. and remote node 1.2. to my Google Drive account and linked them in blog. PCB's or complete boards are on sale in my online shop.

Saturday, November 5, 2016

MQTT functions

The MQTT portion of gateway is now supporting following:
  • Publish of any sensor that is connected to it.
  • Subscribe and pass messages to any input.
  • Subscribe to send SMS messages to contacts listed in contact list.
There is simple panel, screenshot on right picture, allowing you to set the MQTT server IP address and it's port, and enable or disable this function globally.

This means that if you have a MQTT gateway running, you can setup further any automation you like. There can be:
  • Domoticz or any Home Automation System connected, all of them allows MQTT.
  • Any mobile device gateway for MQTT like MQTT dashboard on Android. Where you can in minutes create buttons, dials, or switches to trigger actions on your nodes, like in the picture on left.
  • NodeRed an excellent piece of software for more advanced automation system. I use it for logging sensor values to database.
MQTT topic for subscribe is: OHS/#
And gateway listens on: OHS/In/#