[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

I got a ESP8266 NodeMCU board and have been successful at putting a static IP in it that works on my network. Thanks for the tip.
For my door sensors I am currently using wired sensors. I did this with SmartThings Multi-purpose sensors that I disassembled and tacked a wire onto the hall effect device output (pulled up to 3.3v). I am powering them from a 3.3 volt source. The wired door sensors connect to the tacked wire and ground. It is better because it is aesthetically nicer and I don’t need to replace batteries, but it is expensive.
I am hoping to interface the ESP8266 board to several wired door / window / motion sensors which will convert to virtual sensors in ST using your software and firmware and the ST and Arduino IDEs.
I have looked all through your GitHub and am having a little difficulty determining what I should be using. Can you point me in the right direction?
Thanks
Tim

Toby,

Probably the easiest way to get started is to simply follow the ReadMe file. It highlights all of the steps to get an example sketch up and running. As far as wired door and window sensors, that’s pretty easy to accomplish. A great place to start is using my AlarmPanel example below. You will need to adjust the number of “contact sensor” devices in the setup() portion of the sketch to match your number of sensors/wired zones. You can comment out the “Alarm” device if you’re not planning on having a siren attached to the ESP8266. Other example sketches have motion detector devices that you can add as well.

In an ST_Anything, you should spent almost all of your time editing the PIN definition section, and the setup() routine to define devices that use those PIN definitions. At the top of each ST_Anything devices C++ code, you will find detailed comments describing what all of the device constructor arguments are used for. Let me know if you need help.

All,

I have released a BETA v1.0 of HubDuino for the new Hubitat Elevation Hub. Details are available in the Hubitat forums (I believe you need to be an owner to see some of the forums) as well as in a new HubDuino ReadMe file that explains the different setup.

Note: I have made some minor changes to some of the ST_Anything Arduino libraries and some of the ST Groovy Child Device Handlers to support Hubitat. Please let me know if you notice any issues on the SmartThings platform.

Bearded Dragon Vivarium Controller migrated to ST_Anything!
Last year I built out a traditional ‘Arduino Logic’ ESP8266 NodeMCU 0.9 controller and it has worked like a champ for the duration. It’s been controlling 2 relays for DaVinci’s basking and UVB lights and also has (2) DS18B20 thermos’ and a DHT11 for humidity attached. I have OTA setup on it as well in case we wanted to change the schedules for his lighting. Well…I mapped all of the existing pin connections in the ST_Anything sketch, modded the DS1820 for 2 sensors and pulled the trigger to send it via OTA to DaVinci’s ESP and…YEAHHH BABY! All controls and readings fired up straight away.( After configuring the Thing in the SmartThings App of course) TOO COOL! Thank you again for keeping this most excellent project rolling!!

1 Like

Hi Dan, I have a need for one capability to control two alternating pins (open and close actions from one ST button) for controlling motorized blinds. I saw on your Git repro that someone started coding some new classes for this purpose but you recommended against that approach. I currently have everything working fine by using two of your TimedRelay types but that means I have two separate buttons in the ST app - labeled Open and Close. Would you happen to have a modified IS_DoorControl class with the additional arguments (to add a second pin) that you mentioned in that Github conversation? I’m not overly confident in my ability to add it myself. Any help would be much appreciated!

1 Like

Unfortunately, I never finished that work on the new blinds controller type of class. It is a little complicated, due to having to keep track of multiple pins and timing logic, as well as making them mutually exclusive to avoid trying to open and close at the same time.

Need some help. I am able to get my WeMo D1 to work with the example code for the ESP8266WiFi. What I want is to have the WeMo D1 only do two functions both of which are Buttons. I am unsure how to modify the code to have the Arduino only announce the two button types. I have tried commenting out the other multiple options and also commented out all the errors that occur because of those #define statements being commented out. Guidance please?

Here you go. Just a matter of commenting out the correct lines of code. Be sure to adjust your pin number assignments as you see fit. Also, please note that NO child devices will be created for “button” devices, as non are needed. Just the Parent device is all you’ll need. Be sure to configure the parent’s settings to have the correct number of buttons. One more thing, if you manually delete child devices from an existing parent device, chances are pretty good that you will not get any updates processed. Just delete the Parent and start from scratch once the microcontroller has been updated with the new sketch.

//******************************************************************************************
//  File: ST_Anything_Multiples_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266's WiFi.
//
//            ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266
//              - 1 x Alarm device (using a simple digital output)
//              - 1 x Contact Sensor devices (used to monitor magnetic door sensors)
//              - 1 x Switch devices (used to turn on a digital output (e.g. LED, relay, etc...)
//              - 1 x Motion devices (used to detect motion)
//              - 1 x Smoke Detector devices (using simple digital input)
//              - 1 x Temperature Measurement devices (Temperature from Dallas Semi 1-Wire DS18B20 device)
//              - 1 x Relay Switch devices (used to turn on a digital output for a set number of cycles And On/Off times (e.g.relay, etc...))
//              - 2 x Button devices (sends "pushed" if held for less than 1 second, else sends "held"
//              - 1 x Water Sensor devices (using the 1 analog input pin to measure voltage from a water detector board)
//    
//  Change History:
//
//    Date        Who            What
//    ----        ---            ----
//    2015-01-03  Dan & Daniel   Original Creation
//    2017-02-12  Dan Ogorchock  Revised to use the new SMartThings v2.0 library
//    2017-04-17  Dan Ogorchock  New example showing use of Multiple device of same ST Capability
//                               used with new Parent/Child Device Handlers (i.e. Composite DH)
//    2017-05-25  Dan Ogorchock  Revised example sketch, taking into account limitations of NodeMCU GPIO pins
//    2018-02-09  Dan Ogorchock  Added support for Hubitat Elevation Hub
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP8266WiFi
//******************************************************************************************
#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// 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 <Executor.h>        //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#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_Illuminance.h>  //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

#include <PS_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <PS_DS18B20_Temperature.h>  //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries 
#include <PS_Water.h>        //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)
#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_Smoke.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
#include <IS_Button.h>       //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses
#include <EX_Switch.h>       //Implements an Executor (EX) via a digital output to a relay
#include <EX_Alarm.h>        //Implements Executor (EX)as an Alarm Siren capability via a digital output to a relay
#include <S_TimedRelay.h>    //Implements a Sensor to control a digital output pin with timing capabilities

//*************************************************************************************************
//NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings)
//*************************************************************************************************
//#define LED_BUILTIN 16
//#define BUILTIN_LED 16
//
//#define D0 16  //no internal pullup resistor
//#define D1  5
//#define D2  4
//#define D3  0  //must not be pulled low during power on/reset, toggles value during boot
//#define D4  2  //must not be pulled low during power on/reset, toggles value during boot
//#define D5 14
//#define D6 12
//#define D7 13
//#define D8 15  //must not be pulled high during power on/reset

//******************************************************************************************
//Define which Arduino Pins will be used for each device
//******************************************************************************************
//#define PIN_WATER_1               A0  //NodeMCU ESP8266 only has one Analog Input Pin 'A0'

//#define PIN_ALARM_1               D0  //SmartThings Capabilty "Alarm"
//#define PIN_SWITCH_1              D1  //SmartThings Capability "Switch"
//#define PIN_CONTACT_1             D2  //SmartThings Capabilty "Contact Sensor"
#define PIN_BUTTON_1              D3  //SmartThings Capabilty Button / Holdable Button (Normally Open!)
#define PIN_BUTTON_2              D4  //SmartThings Capabilty Button / Holdable Button (Normally Open!)
//#define PIN_MOTION_1              D5  //SmartThings Capabilty "Motion Sensor" (HC-SR501 PIR Sensor)
//#define PIN_SMOKE_1               D6  //SmartThings Capabilty "Smoke Detector"
//#define PIN_TEMPERATURE_1         D7  //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)
//#define PIN_TIMEDRELAY_1          D8  //SmartThings Capability "Relay Switch"

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid     = "yourSSIDhere";                           //  <---You must edit this line!
String str_password = "yourWiFiPasswordhere";                   //  <---You must edit this line!
IPAddress ip(192, 168, 1, 227);       //Device IP Address       //  <---You must edit this line!
IPAddress gateway(192, 168, 1, 1);    //Router gateway          //  <---You must edit this line!
IPAddress subnet(255, 255, 255, 0);   //LAN subnet mask         //  <---You must edit this line!
IPAddress dnsserver(192, 168, 1, 1);  //DNS server              //  <---You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address
IPAddress hubIp(192, 168, 1, 149);    // smartthings/hubitat hub ip //  <---You must edit this line!

// SmartThings / Hubitat Hub TCP/IP Address: UNCOMMENT line that corresponds to your hub, COMMENT the other
const unsigned int hubPort = 39500;   // smartthings hub port
//const unsigned int hubPort = 39501;   // hubitat hub port

//******************************************************************************************
//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 Device Hanlder Groovy code, except when using new COMPOSITE Device Handler
  //         - 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
  //           Device Handler names.  (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 Hub in two separate updates, one for 
  //           "temperature" and one for "humidity")
  //         - The new Composite Device Handler is comprised of a Parent DH and various Child
  //           DH's.  The names used below MUST not be changed for the Automatic Creation of
  //           child devices to work properly.  Simply increment the number by +1 for each duplicate
  //           device (e.g. contact1, contact2, contact3, etc...)  You can rename the Child Devices
  //           to match your specific use case in the ST Phone Application.
  //******************************************************************************************
  //Polling Sensors
//  static st::PS_Water               sensor1(F("water1"), 60, 20, PIN_WATER_1, 200);
//  static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1); 
  
  //Interrupt Sensors 
//  static st::IS_Contact             sensor3(F("contact1"), PIN_CONTACT_1, LOW, true);
  static st::IS_Button              sensor4(F("button1"), PIN_BUTTON_1, 1000, LOW, true, 500);
  static st::IS_Button              sensor5(F("button2"), PIN_BUTTON_2, 1000, LOW, true, 500);
//  static st::IS_Motion              sensor6(F("motion1"), PIN_MOTION_1, HIGH, false);
//  static st::IS_Smoke               sensor7(F("smoke1"), PIN_SMOKE_1, HIGH, true, 500);

  //Special sensors/executors (uses portions of both polling and executor classes)
//  static st::S_TimedRelay           sensor8(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 3000, 0, 1);
  
  //Executors
//  static st::EX_Alarm executor1(F("alarm1"), PIN_ALARM_1, LOW, true);
//  static st::EX_Switch executor2(F("switch1"), PIN_SWITCH_1, LOW, true);  //Inverted logic for "Active Low" Relay Board
  
  //*****************************************************************************
  //  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 ESP8266WiFi Communications Object
    //STATIC IP Assignment - Recommended
    st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
 
    //DHCP IP Assigment - Must set your router's DHCP server to provice a static IP address for this device's MAC address
    //st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);

  //Run the Everything class' init() routine which establishes WiFi communications with SmartThings Hub
  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);  
      
  //*****************************************************************************
  //Add each executor to the "Everything" Class
  //*****************************************************************************
//  st::Everything::addExecutor(&executor1);
//  st::Everything::addExecutor(&executor2);
    
  //*****************************************************************************
  //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();
}

Thank you for this! I managed to use a relay code above to get my car starters working. I do have an issue though. My one car starter requires me to unlock the car prior to starting it. Here is what I am trying to do but the I only see relay 1 & 2. I need relaySwitch3 to play on D6 same as relaySwitch2. Suggestions?

//******************************************************************************************
// File: ST_Anything_RemoteStart_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266’s WiFi.
//
// ST_Anything_RemoteStart implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266
// - 2 x Relay Switch devices (used to turn on a digital output for a set number of cycles And On/Off times (e.g.relay, etc…))
//
// Change History:
//
// Date Who What
// ---- — ----
// 2018-01-22 Dan Ogorchock Example sketch chaining two timed relays to run in sequence
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP8266WiFi
//******************************************************************************************
#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// 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 <Executor.h> //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#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_Illuminance.h> //Implements a Polling Sensor (PS) to measure light levels via a photo resistor
//
//#include <PS_TemperatureHumidity.h> //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
//#include <PS_DS18B20_Temperature.h> //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries
//#include <PS_Water.h> //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)
//#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_Smoke.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
//#include <IS_Button.h> //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses
//#include <EX_Switch.h> //Implements an Executor (EX) via a digital output to a relay
//#include <EX_Alarm.h> //Implements Executor (EX)as an Alarm Siren capability via a digital output to a relay
#include <S_TimedRelay.h> //Implements a Sensor to control a digital output pin with timing capabilities

//*************************************************************************************************
//NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings)
// (no need to uncomment these are they are now defined in the Arduino IDE automatically based on
// the board type you select.)
//*************************************************************************************************
//#define LED_BUILTIN 16
//#define BUILTIN_LED 16
//
//#define D0 16 //no internal pullup resistor
//#define D1 5
//#define D2 4
//#define D3 0 //must not be pulled low during power on/reset, toggles value during boot
//#define D4 2 //must not be pulled low during power on/reset, toggles value during boot
//#define D5 14
//#define D6 12
//#define D7 13
//#define D8 15 //must not be pulled high during power on/reset

//******************************************************************************************
//Define which Pins will be used for each device
//******************************************************************************************
#define PIN_TIMEDRELAY_1 D5 // Starts MDX
#define PIN_TIMEDRELAY_2 D6 // Starts Van
#define PIN_TIMEDRELAY_3 D6 // Unlocks Van

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “”; // <—You must edit this line!
String str_password = “”; // <—You must edit this line!
IPAddress ip(10, 0, 0, 4); //Device IP Address // <—You must edit this line!
IPAddress gateway(10, 0, 0, 1); //Router gateway // <—You must edit this line!
IPAddress subnet(255, 0, 0, 0); //LAN subnet mask // <—You must edit this line!
IPAddress dnsserver(10, 0, 0, 1); //DNS server // <—You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings Hub Information
IPAddress hubIp(10, 0, 0, 30); // smartthings hub ip // <—You must edit this line!
const unsigned int hubPort = 39500; // smartthings hub port

//******************************************************************************************
//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)
{
// static unsigned long lastOn = 0; //last time relaySwitch1 was turned on (used prevent misfires of relaySwitch2)

// 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
// if (msg == “relaySwitch1 on”)
// {
// lastOn = millis();
// }
// else if ((msg == “relaySwitch1 off”) && (millis() - lastOn < 6000))
// {
// st::receiveSmartString(“relaySwitch2 on”);
// }

//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 Device Hanlder Groovy code, except when using new COMPOSITE Device Handler
// - 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
// Device Handler names. (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 Hub in two separate updates, one for
// “temperature” and one for “humidity”)
// - The new Composite Device Handler is comprised of a Parent DH and various Child
// DH’s. The names used below MUST not be changed for the Automatic Creation of
// child devices to work properly. Simply increment the number by +1 for each duplicate
// device (e.g. contact1, contact2, contact3, etc…) You can rename the Child Devices
// to match your specific use case in the ST Phone Application.
//******************************************************************************************
//Polling Sensors

//Interrupt Sensors

//Special sensors/executors (uses portions of both polling and executor classes)
static st::S_TimedRelay sensor1(F(“relaySwitch1”), PIN_TIMEDRELAY_1, LOW, true, 1000, 1000, 2);
static st::S_TimedRelay sensor2(F(“relaySwitch2”), PIN_TIMEDRELAY_2, LOW, true, 1000, 1000, 2);
static st::S_TimedRelay sensor3(F(“relaySwitch3”), PIN_TIMEDRELAY_3, LOW, true, 1500, 1);

//Executors

//*****************************************************************************
// 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 ESP8266WiFi Communications Object
//STATIC IP Assignment - Recommended
st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

//DHCP IP Assigment - Must set your router's DHCP server to provice a static IP address for this device's MAC address
//st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);

//Run the Everything class’ init() routine which establishes WiFi communications with SmartThings Hub
st::Everything::init();

//*****************************************************************************
//Add each sensor to the “Everything” Class
//*****************************************************************************
st::Everything::addSensor(&sensor1);
st::Everything::addSensor(&sensor2);

//*****************************************************************************
//Add each executor to the “Everything” Class
//*****************************************************************************

//*****************************************************************************
//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();
}

Make sure you add sensor3 to the section of code above and you should be all set.

Thank you!!

1 Like

@ogiewon

Does the PS_Illuminance.h support a digital lux sensor?

This is what I bought: https://www.banggood.com/GY-30-3-5V-0-65535-Lux-BH1750FVI-Digital-Light-Intensity-Sensor-Module-For-Arduino-p-1170218.html?utm_design=41&utm_source=emarsys&utm_medium=Neworder171109&utm_campaign=trigger-emarsys&utm_content=Winna&sc_src=email_2675773&sc_eh=4bcec3a67f4fecfe1&sc_llid=1714813&sc_lid=105229698&sc_uid=L29WioyKU7

Currently, the only illuminance sensor support is a very simple analog photo-resistor, such as

Another user, @vseven, did add support for a digital RGB Illuminance sensor not too long ago. Perhaps it would be a good starting point for your sensor?

@ogiewon

Thanks! I will look into this once the chipset gets here.

Hi Dan,
Just wanted to say thank you for all your work. The Node MCU really does work very well with your firmware.
Take care,
Toby

1 Like

@ogiewon

I wanted to second this thank you! I can’t believe the amount of opportunities you just opened for me that are now affordable. I am absolutely excited to create more custom automations for my home.

With your assistance I have done the following:

  • Automated (2) vehicle auto-starts leveraging a Wemo D1 and dual relay setup
  • Automate with WebCoRE life actions:
    • For Van: Open Garage Door, Ensure it is Open, Start Van, If garage door is open after 22 min close garage door (autostart shuts off)

Projects I am looking to do over the next 4 months:

  • Dedicated outdoor LUX sensor (WU is not reliable)
  • Irrigation control with soil sensors throughout yard
  • Lightning detection system

Thank you again!

1 Like

@prayerfuldrop and @Toby_Landes

I am so happy to hear that you are both finding ST_Anything useful for your home automation projects. This exactly what my son and I envisioned when we conceived the project. I knew the basic components were there with the old ThingShield, but I also knew that it took a lot of effort for new users to get up and running.

Please keep sharing your projects with the rest of the community, as I am always impressed with how creative people are. Many features within ST_Anything are a direct result of community requests for special, unique features.

Ok … where to start … I seem to be having a problem… I will start here. I am using an Arduino Mega with a W5100 Ethernet shield and have made the necessary changes to the sketch (ST_Anything_Doors_Windows_EthernetW5100.ino) for MAC, IP, Gateway …etc … everything compiled correctly and uploaded. I then proceeded through the SmartThings instructions on adding the DH and then the Parent Device. After opening the SmartThings app on my phone I proceeded to finish doing the configuration of the Device and click save. Here is where I am having the problem … no children are being created. If I click on the “Recently” tab at the top I can see data coming in from the Ardiuno (motion active/inactive, doors open and close) but nothing for children being created. I do not see any errors on the Serial Monitor and when I click refresh on my phone I can see the Adriuno sending the names and status of all the contacts. I sure hope I am not missing something stupid but I am at my wits end

Double check your MAC address in the parent device. Check live logging in ST IDE for any errors. Make sure you Publish all of the Child Device Handlers. Make sure you assigned your location and Hub to the Parent in the ST IDE.

I double checked everything and all was good so as a last resort I downloaded the github collection again and started from scratch with flashing my Audriuno Mega and everything started working. I can not explain why though and that part is very frustrating… lol One thing I have noticed is that my illuminancen sensor vales are backwards (dark room returns a high value and bright room returns a low value) is there a way to reverse this … and thank you for your quick response!