ALL - I have finished my initial testing of a change requested by another user to the IS_DoorControl device. You can now determine in the Arduino Sketch if you’d like the output to behave as a momentary output (default) or as an on/off switch output (i.e. Open = output ON, Closed = output OFF, instead of a simple momentary output toggle)
I have uploaded to my GitHub repository the following files. Note - this is a matched set of files. There is no need to update the Child Door Control driver unless you have updated your microcontroller with the updated IS_DoorControl library files first.
Arduino ST_Anything library files
- IS_DoorControl.h
- IS_DoorControl.cpp
SmartThings Groovy Device Handler
In your existing sketch, you will need to add an additional parameter when creating the device. Here is an example code snippet where the first door control device uses momentary (default, if no parameter is supplied) and the second door control device uses an on/off switch style output.
static st::IS_DoorControl sensor1(F("doorControl1"), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, true, 1000, 1000);
static st::IS_DoorControl sensor2(F("doorControl2"), PIN_DOORCONTROL_CONTACT_2, LOW, true, PIN_DOORCONTROL_RELAY_2, LOW, true, 1000, 1000, false);
And here is the documentation for all of the parameters…
// Create an instance of this class in your sketch's global variable section
// For Example: st::IS_DoorControl sensor3(F("doorControl1"), PIN_CONTACT_DOOR_1, LOW, true, PIN_RELAY_DOOR_1, LOW, true, 1000, 1000, true);
//
// st::IS_DoorControl() constructor requires the following arguments
// - String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
// - byte pinInput - REQUIRED - the Arduino Pin to be used as a digital input
// - bool iState - REQUIRED - LOW or HIGH - determines which value indicates the interrupt is true
// - bool internalPullup - REQUIRED - true == INTERNAL_PULLUP
// - byte pinOutput - REQUIRED - the Arduino Pin to be used as a digital output
// - bool startingState - REQUIRED - the value desired for the initial state of the switch. LOW = "off", HIGH = "on"
// - bool invertLogic - REQUIRED - determines whether the Arduino Digital Output should use inverted logic
// - long delayTime - REQUIRED - the number of milliseconds to keep the output on
// - long numReqCounts - OPTIONAL - number of counts before changing state of input (prevent false alarms)
// - bool useMomentary - OPTIONAL - use momentary output (true) or standard switch (false) (defaults to true)
NOTE for ALL Users: The new groovy Device Handler and Arduino code are somewhat of a matched set. The new Child Door Control Driver should only be used after updating and deploying the Arduino code with the new IS_DoorControl.h and .cpp files.