Announcing the "ST_Anything" Arduino/ThingShield Project

@heyitzjesse

Can you explain how you have things wired up a little? Are you using two different sirens, one for an Alarm and another for the door “beeps”? Or just one siren?

By far, the simplest thing to do is simply have ST send a Push notification to your phone(s) every time a door is opened. Thus, you’d get a quick audible notification.

If you have two sirens, the below suggestion works very easily. (Even if you have just one siren, you could use 2 different relays, either one of which could turn on the siren, as long as you wire them in parallel.)

You could pretty easily add some simple code to the “callback()” function in the Arduino sketch which would “see” any door being opened, and then it would trigger a Timed Relay device. The Timed Relay device is nice because you can determine how long the relay is left on before it automatically turns off. You could even make it do a short sequence of beeps if desired. (Read the comments at the top of the EX_TimedRelay.h or .cpp file to see what each argument of the constructor is used for.)

Using the local “callback()” routine to do this has the advantage of 100% local control within the Arduino code. Even though it runs locally, it also properly updates the ST cloud.

Here is an UNTESTED example, which assumes your contact sensors and timed relays are named per my new naming convention required for use with the Composite (Parent/Child) Device Handlers.

//******************************************************************************************
//st::Everything::callOnMsgSend() optional callback routine.  This is a sniffer to monitor
//    data being sent to ST.  This allows a user to act on data changes locally within the
//    Arduino sketch.
//******************************************************************************************

void callback(const String &msg)
{

  Serial.print(F("ST_Anything Callback: Sniffed data = "));
  Serial.println(msg);

  //TODO:  Add local logic here to take action when a device's value/state is changed


  //NOTE:  you may need to play with the logic below to get the behavior you desire!!!
  if (msg == "contact1 open") {st::receiveSmartString("relaySwitch1 on");}
  if (msg == "contact2 open") {st::receiveSmartString("relaySwitch1 on");}
  
}