Adding interrupt driven automation events

So I now have the new version of the automation software working. I am having reliability problems with one of the Ardiuino locations and I’m not sure if it’s a hardware or software issue.


However, theere is a need to not continually poll infrequent, and non sampling events. especially high frequency ones.


To that, I am beginning to adapt both the arduino and the node software to allow irregular events to send data back to node. To be clear here, the Ardiuno is still operating in polled mode (The main loop checks), but on different frequencies, I am enabling the detection and subsequent sending of an event back to node when and if there is an imprtant change or condition.


For example, a sump pump.

The reality of the typical sump pump is that it runs maybe 10 seconds at a clip, I need to be checking every 3 seconds or so as to not miss a run.


So, the arduino, will be coded to read the status and only when it is on, to send a message to node.


Downstream (pun intended) I can look for the data and take action on a regular basis like send an email.

For this, I want an Arduino to constantly monitor the pump, but only send in data when the running is detected.

I am modifying the Arduino code to have several diferent frequencies of checking and, when each time for a given frequency codes, to call different functions related to that frequency.

Each different function will have its’ own logic and, if detected, it will compose and send a message to node.


In order to maintain my base set of arduino code, I will use compiler switches indicating which Arduino code I am compiling (Attic, garage, etc) and then both the function code and the call to it will be included/excluded.


Node will pick up the unsolicited message and simply add it to the database for logging. It won’t look to remove it’s matching send message and then remove it from the queue.