[RELEASE] ST_Anything v2.9.7 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi

Sorry, but I have absolutely no time nor desire to support a “customer” with this type of integration. It is much more geared toward the home hobbyist. If I were you, I would get the customer to buy some sort of off-the-shelf ready-to-run solution for their blinds, especially if you have little experience with Arduino/ESP8266/SmartThings. While it definitely works, it is not 100% reliable due to the cloud-based architecture of SmartThings.

That being said, if you really want to roll-your-own solution, I did do some 433MHz integration a few years back using my ST_Anything library and a RCSwitch library for the Arduino. It was a fun little project, but not sure how many folks actually found it useful. I am not planning on updating the example sketch and groovy device handler for the new v2.x release, so it currently works with the old ThingShield. It wouldn’t be all that hard for you to figure out how to use it though, with the newer Ethernet based v2.x libraries. To download it, you’d need to grab the v1.6 release of ST_Anything from GitHub, as I did not include it in v2.x.

Not a problem, I realise this isn’t exactly how ST was designed to be used I’m just weighing up all of my options. Thanks for the input, I’ll have a look into it and see how I get on!

Hi! You had mentioned a new ST _Anything w/shield over on a different thread when I was trying to find the ST shield hardware, and so I am trying to get it up and running but am having some difficulties. I’ve managed to get all the wiring done up right, and I believe I have things on the Arduino Mega/ST Shield configured correctly (one quirk i’ll describe below) - but when I try to use the device handler to have things update in the ST app UI, they all just permanently list as ‘open’ and never update.

Here’s a paste-bin of the Arduino Mega booting up and loading the sketch: http://pastebin.com/kyqEqBSK

All the devices will print to the serial out as open/close just fine - except the GarageDoor sensor, which as soon as it lists as ‘open’ starts flapping open/closed constantly until it gets closed again. It was behaving this way when there were no wires plugged into the board so I’m not sure what’s up there. It will also occasionally spontaneously reboot.

Anyway - here’s the code actually loaded on the Mega: http://pastebin.com/TzkKX202
Sometimes it verifies and compiles without complaint, other times collect2.exe errors out after the ld command - seems like a behavioral bug with using tmp files? In any case, the code seems to work but not sure if the problem is here or in the device handler.

Here’s the device handler code: http://pastebin.com/0aAMcVmk
Again, seems like it SHOULD work but there is obviously something not quite right because they all default to ‘open’ and never update.

This is my first arduino project so I’m excited but I also have to ask a silly question - I’ve been leaving the Mega plugged into my laptop while I try and test the App side of things - do I need to detach it and just run it on basic power in order to fully test it? I hadn’t thought so since the ST shield was detected by my hub while the Mega was still attached to my laptop… but just gotta ask.

Attention to details was all that was wrong with your sketch and device handler.

Every sensor object you created in the Arduino sketch must have an EXACT, CASE SENSITIVE corresponding tile for in the Device Handler. You had spelling differences, case differences, and even whole word differences. They must match exactly.

Also, you cannot use pin 14 for the garageDoor input. Pins 14 and 15 must be jumpered to pins 2 and 3 respectively for the communications to work between the Arduino MEGA and the ThingShield. I moved your garagDoor input to pin 22. If I were using a MEGA for my project, I would start my digital inputs pins at pin 22 and go up to pin 53. Easier to avoid the pins that are on the shield that way.

Here is the updated sketch and device handler

//******************************************************************************************
//  File: ST_Anything_Doors_ThingShield.ino
//  Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
//  Summary:  This Arduino Sketch, along with the ST_Anything library and the revised SmartThings
//            library, demonstrates the ability of one Arduino + SmartThings Shield to
//            implement a multi input/output custom device for integration into SmartThings.
//            The ST_Anything library takes care of all of the work to schedule device updates
//            as well as all communications with the SmartThings Shield.
//
//            ST_Anything_Doors implements the following:
//              - 2 x Door Control devices (used as Garage Doors)
//              - 4 x Contact Sensor devices (used to monitor magnetic door sensors)
//              - 1 x Motion device (used to detect motion in the garage)
//              - 1 x Temperature/Humidity device (unsed to monitor temp & humidity in the garage)
//
//            During the development of this re-usable library, it became apparent that the
//            Arduino UNO R3's very limited 2K of SRAM was very limiting in the number of
//            devices that could be implemented simultaneously.  A tremendous amount of effort
//            has gone into reducing the SRAM usage, including siginificant improvements to
//            the SmartThings Arduino library.  The SmartThings library was also modified to
//            include support for using Hardware Serial port(s) on the UNO, MEGA, and Leonardo.
//            During testing, it was determined that the Hardware Serial ports provide much
//            better performance and reliability versus the SoftwareSerial library.  Also, the
//            MEGA 2560's 8K of SRAM is well worth the few extra dollars to save your sanity
//            versus always running out of SRAM on the UNO R3.  The MEGA 2560 also has 4 Hardware
//            serial ports (i.e. UARTS) which makes it very easy to use Hardware Serial instead
//            of SoftwareSerial, while still being able to see debug data on the USB serial
//            console port (pins 0 & 1).
//
//            Note: We did not have a Leonardo for testing, but did fully test on UNO R3 and
//            MEGA 2560 using both SoftwareSerial and Hardware Serial communications to the
//            Thing Shield.
//
//  Change History:
//
//    Date        Who            What
//    ----        ---            ----
//    2015-01-03  Dan & Daniel   Original Creation
//    2015-01-07  Dan Ogorchock  Modified for Door Monitoring and Garage Door Control
//    2015-03-28  Dan Ogorchock  Removed RCSwitch #include now that the libraries are split up
//    2015-03-31  Daniel O.      Memory optimizations utilizing progmem
//    2017-02-12  Dan Ogorchock  Revised to use the new SMartThings v2.0 library
//
//******************************************************************************************
 
//******************************************************************************************
// SmartThings Library for Arduino Shield
//******************************************************************************************
#include <SmartThingsThingShield.h>    //Library to provide API to the SmartThings Shield
 
//******************************************************************************************
// ST_Anything Library
//******************************************************************************************
#include <Constants.h>       //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library
#include <Device.h>          //Generic Device Class, inherited by Sensor and Executor classes
#include <Sensor.h>          //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)
#include <InterruptSensor.h> //Generic Interrupt "Sensor" Class, waits for change of state on digital input
#include <PollingSensor.h>   //Generic Polling "Sensor" Class, polls Arduino pins periodically
#include <Everything.h>      //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications
 
 
#include <PS_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <IS_Motion.h>       //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor
#include <IS_Contact.h>      //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin
#include <IS_DoorControl.h> //Implements an Interrupt Sensor (IS) and Executor to monitor the status of a digital input pin and control a digital output pin
 
//******************************************************************************************
//Define which Arduino Pins will be used for each device
//  Notes: -Serial Communications Pins are defined in Constants.h (avoid pins 0,1,2,3
//          for inputs and output devices below as they may be used for communications)
//         -Always avoid Pin 6 as it is reserved by the SmartThings Shield
//
//******************************************************************************************
//"RESERVED" pins for SmartThings ThingShield - best to avoid
#define PIN_O_RESERVED               0  //reserved by ThingShield for Serial communications OR USB Serial Monitor
#define PIN_1_RESERVED               1  //reserved by ThingShield for Serial communications OR USB Serial Monitor
#define PIN_2_RESERVED               2  //reserved by ThingShield for Serial communications
#define PIN_3_RESERVED               3  //reserved by ThingShield for Serial communications
#define PIN_6_RESERVED               6  //reserved by ThingShield (possible future use?)
 
//Motion and Temperature/Humidity Pins (Note: using Analog pins as Digital inputs)
#define PIN_MOTION                   A0
#define PIN_TEMPERATUREHUMIDITY      A1
 
#define PIN_CONTACT_FRONT_DBL_DOOR   5
#define PIN_CONTACT_DINING_RM_WNDW   7
#define PIN_CONTACT_LVNG_PATIO_DOOR  8
#define PIN_CONTACT_KTCH_NOOK_WNDW   9
#define PIN_CONTACT_SUN_ROOM_DOOR    10
#define PIN_CONTACT_SUN_ROOM_WNDW    11
#define PIN_CONTACT_BEDROOM1_WNDW    12
#define PIN_CONTACT_BEDROOM2_WNDW    13
#define PIN_CONTACT_GARAGE_DOOR      22
 
 
//If using SoftwareSerial (e.g. Arduino UNO), must define pins for transmit and receive
#define pinRX 3
#define pinTX 2
 
//******************************************************************************************
//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 sktech.
//******************************************************************************************
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
 
  //Masquerade as the ThingShield to send data to the Arduino, as if from the ST Cloud (uncomment and edit following line)
  //st::receiveSmartString("Put your command here!");  //use same strings that the Device Handler would send
}
 
//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
  //******************************************************************************************
  //Declare each Device that is attached to the Arduino
  //  Notes: - For each device, there is typically a corresponding "tile" defined in your
  //           SmartThings DeviceType Groovy code
  //         - For details on each device's constructor arguments below, please refer to the
  //           corresponding header (.h) and program (.cpp) files.
  //         - The name assigned to each device (1st argument below) must match the Groovy
  //           DeviceType Tile name.  (Note: "temphumid" below is the exception to this rule
  //           as the DHT sensors produce both "temperature" and "humidity".  Data from that
  //           particular sensor is sent to the ST Shield in two separate updates, one for
  //           "temperature" and one for "humidity")
  //******************************************************************************************
  //Polling Sensors
  //static st::PS_TemperatureHumidity sensor1(F("temphumid"), 120, 10, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT22);
 
  //Interrupt Sensors
  //static st::IS_Motion sensor2(F("motion"), PIN_MOTION, HIGH, false);
  //static st::IS_DoorControl sensor3(F("leftDoor"), PIN_CONTACT_LEFTGARAGE_DOOR, LOW, true, PIN_RELAY_LEFTGARAGE_DOOR, LOW, true, 1000);
  //static st::IS_DoorControl sensor4(F("rightDoor"), PIN_CONTACT_RIGHTGARAGE_DOOR, LOW, true, PIN_RELAY_RIGHTGARAGE_DOOR, LOW, true, 1000);
 
  static st::IS_Contact sensor1(F("frontDoubleDoors"), PIN_CONTACT_FRONT_DBL_DOOR, LOW, true);
  static st::IS_Contact sensor2(F("diningRoomWindows"), PIN_CONTACT_DINING_RM_WNDW, LOW, true);
  static st::IS_Contact sensor3(F("livingRoomPatioDoor"), PIN_CONTACT_LVNG_PATIO_DOOR, LOW, true);
  static st::IS_Contact sensor4(F("kitchenNookWindows"), PIN_CONTACT_KTCH_NOOK_WNDW, LOW, true);
  static st::IS_Contact sensor5(F("sunroomPatioDoor"), PIN_CONTACT_SUN_ROOM_DOOR, LOW, true);
  static st::IS_Contact sensor6(F("sunroomWindows"), PIN_CONTACT_SUN_ROOM_WNDW, LOW, true);
  static st::IS_Contact sensor7(F("bedroom1Windows"), PIN_CONTACT_BEDROOM1_WNDW, LOW, true);
  static st::IS_Contact sensor8(F("bedroom2Windows"), PIN_CONTACT_BEDROOM2_WNDW, LOW, true);
  static st::IS_Contact sensor9(F("garageDoor"), PIN_CONTACT_GARAGE_DOOR, LOW, true);
 
  //Executors
  //static st::EX_Switch executor1(F("sampleEX"), PIN_sampleEX, LOW, true);
 
 
  //*****************************************************************************
  //  Configure debug print output from each main class
  //  -Note: Set these to "false" if using Hardware Serial on pins 0 & 1
  //         to prevent communication conflicts with the ST Shield communications
  //*****************************************************************************
  st::Everything::debug = true;
  st::Executor::debug = true;
  st::Device::debug = true;
  st::PollingSensor::debug = true;
  st::InterruptSensor::debug = true;
 
  //*****************************************************************************
  //Initialize the "Everything" Class
  //*****************************************************************************
 
  //Initialize the optional local callback routine (safe to comment out if not desired)
  st::Everything::callOnMsgSend = callback;
 
  //Create the SmartThings Thingshield Communications Object based on Arduino Model
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_MINI)   //Arduino UNO, NANO, MINI
  st::Everything::SmartThing = new st::SmartThingsThingShield(pinRX, pinTX, st::receiveSmartString);      //Use Software Serial
#elif defined(ARDUINO_AVR_LEONARDO)  //Arduino Leonardo
  st::Everything::SmartThing = new st::SmartThingsThingShield(&Serial1, st::receiveSmartString);  //Use Hardware Serial
#elif defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560)  //Arduino MEGA 1280 or 2560
  st::Everything::SmartThing = new st::SmartThingsThingShield(&Serial3, st::receiveSmartString);  //Use Hardware Serial
#else
  //assume user is using an UNO for the unknown case
  st::Everything::SmartThing = new st::SmartThingsThingShield(pinRX, pinTX, st::receiveSmartString);               //Software Serial
#endif
 
  //Run the Everything class' init() routine which establishes communications with SmartThings
  st::Everything::init();
 
  //*****************************************************************************
  //Add each sensor to the "Everything" Class
  //*****************************************************************************
  st::Everything::addSensor(&sensor1);
  st::Everything::addSensor(&sensor2);
  st::Everything::addSensor(&sensor3);
  st::Everything::addSensor(&sensor4);
  st::Everything::addSensor(&sensor5);
  st::Everything::addSensor(&sensor6);
  st::Everything::addSensor(&sensor7);
  st::Everything::addSensor(&sensor8);
  st::Everything::addSensor(&sensor9);
 
  //*****************************************************************************
  //Add each executor to the "Everything" Class
  //*****************************************************************************
  //st::Everything::addExecutor(&executor1);
 
  //*****************************************************************************
  //Initialize each of the devices which were added to the Everything Class
  st::Everything::initDevices();
  //*****************************************************************************
}
 
//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
  //*****************************************************************************
  //Execute the Everything run method which takes care of "Everything"
  //*****************************************************************************
  st::Everything::run();
}

Device Handler

/**
 *  ST_Anything_Doors Device Type - ST_Anything_Doors.device.groovy
 *
 *  Copyright 2015 Daniel Ogorchock
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *  Change History:
 *
 *    Date        Who            What
 *    ----        ---            ----
 *    2015-01-10  Dan Ogorchock  Original Creation
 *
 *
 */
 
metadata {
    definition (name: "ST_Anything_Doors_KriegTiger", namespace: "ogiewon", author: "Daniel Ogorchock") {
        capability "Sensor"
        capability "Contact Sensor"

        attribute "frontDoubleDoors", "string"
        attribute "diningRoomWindows", "string"
        attribute "livingRoomPatioDoor", "string"
        attribute "kitchenNookWindows", "string"
        attribute "sunroomPatioDoor", "string"
        attribute "sunroomWindows", "string"        
        attribute "bedroom1Windows", "string"
        attribute "bedroom2Windows", "string"
        attribute "garageDoor", "string"
    }
 
    simulator {

    }
   
    // tile definitions
    tiles {
        standardTile("frontDoubleDoors", "device.frontDoubleDoors", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("livingRoomPatioDoor", "device.livingRoomPatioDoor", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("sunroomPatioDoor", "device.sunroomPatioDoor", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("diningRoomWindows", "device.diningRoomWindows", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("kitchenNookWindows", "device.kitchenNookWindows", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("sunroomWindows", "device.sunroomWindows", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("bedroom1Windows", "device.bedroom1Windows", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("bedroom2Windows", "device.bedroom2Windows", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
        standardTile("garageDoor", "device.garageDoor", width: 1, height: 1, canChangeIcon: true, canChangeBackground: true) {
            state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
            state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
        }
       
        main (["frontDoubleDoors"])
        details(["frontDoubleDoors","livingRoomPatioDoor","sunroomPatioDoor","diningRoomWindows","kitchenNookWindows","sunroomWindows","bedroom1Windows","bedroom2Windows","garageDoor"])
    }
}
 
//Map parse(String description) {
def parse(String description) {
    def msg = zigbee.parse(description)?.text
    log.debug "Parse got '${msg}'"
 
    def parts = msg.split(" ")
    def name  = parts.length>0?parts[0].trim():null
    def value = parts.length>1?parts[1].trim():null
 
    name = value != "ping" ? name : null
 
    def result = createEvent(name: name, value: value)
 
    log.debug result
 
    return result
}
2 Likes

Ahh, thanks! The example I was following had consistency in the files themselves but not across code (arduino -> device handler -> etc). I will update it asap. :]

@ogiewon - Got it sorted now. The comment about pin 14 made me go back and check things again and I was a dork and missed the instructions about pin 2 to 14 and 3 to 15. All is green now.

All that’s left are the smoke detectors and glass break sensors, which is its own problem because those are also powered by the security system. Any suggestions there? Can the Mega drive the voltage needed for those devices or do I need to find external power?

Hello Dan/Daniel,
Wanted to say a quick thank you. I was banging my head against a wall attempting to figure out a way to get a smart shield until I came across this post.

Ive altered the code on the EthernetW1500 version to fit my pins (22-33), matched in both definitions and detection sections. Removed the excess sensors bringing my total to 12 (3 Door, 3 Motion PiR, 6 Window Zones).

Just got everything wired up in the closet, device handler installed and published, device on the hub connected and MAC matched to my code. The trouble I am having is while I can see the device on the android ST app, and enter into its configuration to confirm details, I have no visibility on any sensors of the device. When I last checked before removing the arduino from USB I was able to see sensors checking via the serial monitor. Not exactly sure where to go from there and was hoping you might be able to point me in the right direction.

And if you ever pass through Austin TX, remind me of the beers you will be owed =-)
Al

@Gingerbeard - You’re in Austin? How about we go grab a pint in his honor? :]

@Krieg, Ha nice. Something about strangers on the internet or something. If you are going to Dreamhack next month ping me. We can talk all kinds of smart things stuff as I am just getting into it.

Just as an update on my issue. I have done some network testing and found a local issue. Resolved that, and now we are getting communication to the Smart Things shard under live logging. So that’s working. Going to remove the device and handler again, and see if a clean start (or 3rd or 4th) does the trick.

Ok I’m still not getting any tiles. My assumption was this would allow me to detect or manually add the sensors. Or even just pop them for me.

Now I’m starting to think I’ll need to edit the device handler code to account for each sensor. Could @ogiewon confirm the expected behaviour when you get a chance. Thanks!!

Lol - fair enough, I can relate to the ‘random person from the internet’ caution. Not familiar with Dreamhack, this project to get my old home security system sensors into SmartThings is likely going to be my only one. I’ve got tons of other projects to get taken care of between home and acreage renovation, it’s been fun to dip into the tech side a bit though for this.

Yes, you must edit the device handler to have an exact matching tile for every sensor you define in the Arduino sketch. Nothing is automatically created on the ST side. Look at the example I posted above for another user.

I doubt the Arduino can supply enough power to the old smoke and glass breakage detectors.

I see IS_Smoke.h and cpp files with examples - does this code look good to you?:

  #define PIN_SMOKE_LVR_DETECTOR      42
  static st::IS_Contact sensor9(F("GarageDoor"), PIN_CONTACT_GARAGE_DOOR, LOW, true);
  static st::IS_Contact sensor10(F("MasterBedroomWindows"), PIN_CONTACT_MASTBR_WNDW, LOW, true);
  static st::IS_Smoke   sensor11(F("LivingRoomSmokeDetector"), PIN_SMOKE_LVR_DETECTOR, HIGH, true);

I’m guessing at ‘high’ since that is what the example used.

@ogiewon Many thanks! Perhaps a quick blurb in the readme reminding us new folks would save some questions. I picked a hell of a place to start my introduction into SmartThings (Alarmduino and Nest). Thankfully some smart switches will arrive today, and Google Home next week. Now if I can just get my electric smoker onto ST… =-)

1 Like

If you’re using a powered device, you need to determine if it supplies a voltage or is simply a set of dry contacts. If dry contacts, you’ll want the Internal Pull-up feature enabled. The High/Low setting provides a simple way to reverse the logic.

If the device supplies its own power, things are more complicated. You have to disable internal pull-up. You have to figure out what voltage is supplied and scale it to 5v or 3.3v depending on the board you’re using. You have to tie the GND pins of the old alarm panel to that of the Arduino. None of it is hard, but if you mess up, you might destroy your microcontroller.

Always looking for help on the documentation. Please feel free to issue a pull request on Github with any improvements you think others would find useful. As the author of the software, it is difficult to know what others will need to know. Also, we have delivered this project as a means of giving back to the community. I have a full time job and family that keeps me busy. Any help others can provide to make the solution better is always welcome. :smiley:

Currently (and from the beginning, really) I’ve been running the ground wires from all the sensors to the original control board for the alarm system, and hooked up the Arduino ground to one of the control board ground contacts as well. So only the signal wires are going to the Arduino. For the smoke detectors and glass break sensors, they get power from the original control board as well.

If I’m reading this right, smoke detector power is DC 13.75v @ 100mA, glass break (on the aux power lines) is DC 13.75v @ 500mA. There are zones off the screen to the left in the picture that have the usual wire to the zone and one to ground - just showing the power situation with the photo.

The AC power comes in on the last two pins to run them and charge the battery backup. I’ve been planning on powering the Arduino with a portable USB battery, which can get charged by an extension cord from the wall.

So if I understand you right, because the smoke detector is powered, I want to change that ‘true’ to ‘false’ on the sensor11 definition line? Still curious what kind of sensor type I need to use for the glass break, contact, generic?

The section of your Alarm Panel that is shown appears to show just the power signal to the Smoke Detector. Is there any other section on the diagram that shows the smoke detector input? Do not hook up 13V to the Arduino under any circumstances! Use a volt meter and measure the voltages. I do not have an alarm panel, so I really do not understand the wiring diagram. There are other users who have done exactly what you are attempting.

For glass break detector, I would simply use a “Contact Sensor” as SmartThings does not have a “Glass Break” capability that I am aware of. I know that my ST_Anything library definitely does not have a glass breakage device class.

Take a look at my old discussion from the original release of ST_Anything. You may find some useful wiring information there for your panel. I found the start of a subsection of dialogue below which may be helpful.

I didn’t - kept those power posts far away from my arduino, not sure how much of that translates through the sensor wires though.

All zones show ‘3.3K E.O.L RES’ which I had initially assumed meant ‘3.3v’ - but looking at it now I may have managed to not smoked my board with pure luck. Glass break sensor being previously on Zone 2 (pins 2,3) and smoke being on Zone 8 (pins 11, 12). One interesting thing is that zone 7&8 is painted in white on the board vs 1-6 that are all just outlined. That has to be significant but I’m not sure why, maybe the high vs low attribute?

I just noticed the section horizontal section on the mid-left part of the picture, what do you make of the bottom portion of that, since the note about pin 23,24 is just power?

I got the smoke detector added to my sketch using the following code in relevant places:

 #include <IS_Smoke.h>
 #define PIN_SMOKE_LVR_DETECTOR       42
  static st::IS_Smoke   sensor11(F("LivingRoomSmokeDetector"), PIN_SMOKE_LVR_DETECTOR, HIGH, false);
  st::Everything::addSensor(&sensor11);

It lists as ‘detected’ (rather than open or closed) in the Mega serial output contents. I just don’t know how to get that added to the device handler properly. The original example of the handler has a tile that looks like a smoke detector on it that you can press for siren/off but I’m not sure that’s it or if I just need a basic sensor tile to link to something else.

Here’s how my project looks currently - I’ll work on tidying it up later. You can see the Mega’s ground connection going to pin 15, and the ground pins from the various sensors go back to the other ground (aka ‘com’) on the original panel - 2, 5, 8, 11. The original battery backup is only powering the panel (and perhaps the glass break/smoke detector), the Mega itself is powered by a 10,000mAh portable power station battery on a smart USB port with 2A+ capability that’s plugged into the wall to keep it at full power until the city power goes out. I also left the resistors in place… well just because, to be honest. They made decent jumper-pin style connections to the female ended blue cables in the picture and didn’t hamper the signal any.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.