[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

Any idea if/when this will be supported for the new smartthings app? They just announced scout is going away and I feel the classic app will not be far behind. Thanks for all you have done!

Until Samsung publishes the documentation for hub connected devices, I will not be trying to support the new app. In fact, I am 100% on Hubitat now, with all local processing. My focus for the platform has definitely shifted. Since the ST Classic and Hubitat Device Handlers/Drivers follows a similar model, I have been continuing to support ST.

Future support of the ST platform will depend on just how much work the “new” platform requires. For now, continue to enjoy the ST Classic App! :wink:

I was actually just looking at hubitat because I found your port. I use your code for my garage door and my security system. Since Scout is going away, I need to figure out how to do the security with hubitat (just send me a text or something to that nature). Thanks!

Greetings to you Dan.
I have received my HE and migrated all of my devices from ST successfully with no or little issue. Thanks for your help, suggestions, guidance and support. With regards,?Tito

2 Likes

Hey Dan this is a ton of good info! I am working to build an irrigation controller. They are calling for a Arduino uno w/ thingshield, but am going to be using the ESP8266. Any reason why this would not work?

No reason it would not work. There are already some sprinkler solutions that utilize the ESP8266 platform with ST. These may be more purpose-built and offer additional options/features versus what you will get with ST_Anything.

For example…

If you do decided to use ST_Anything, the simplest way of doing so would be to used the TimedRelay device as that way the ESP8266 would take care of turning off a zone even if the ST hub or Cloud servers are misbehaving. The following sketch would be a good starting point for a sprinkler solution using ST_Anything, IMHO…

Please correct me if I am wrong, but it looks as though this has the functionality to shut down coded into it?

Seems like the following project in that same GitHub should help you achieve your goal.

I don’t have time right now to look through someone else’s groovy code. I have a hard enough time kleeping track of all of my drivers and apps! :wink:

My wife has been asking me for the last 2 weeks if I could automate are worth her and dryer. The only problem that I find is my dryer uses a 240-volt outlet. Is there a smart plug for that. Or way to regret up with an Arduino.

Many, my self included, use an Aeon HEM device, to monitor power usage from their washer and dryer. I have used Mike Maxwell’s DTH for an old Aeon HEM v1 Device for years successfully.

However, the v1 devices ar hard to find. There are newer versions available, but I have no firsthand experience with them. I recommend you search the community for Laundry Monitoring solutions. ST_Anything does not have any easy solutions for this.

Hello Dan,
I hope you had a nice weekend and happy Monday LOL :slight_smile:It is time for another project almost :slight_smile:

I have one kit like this laying around (an Arduino UNO R3 and Ethernet Shield) https://www.gearbest.com/boards-shields/pp_531728.html

Also a spare 2 relay board and a DHT22 temperature and humidity sensor.
My network switch is right next to my attic door where i want to install this and control 2 attic fans when the temperature reaches a certain point in the summer.
My question is can this be done using your awesome ST_Anything suite??

Summer is almost here in Texas … maybe DHT22 may not be good enough but its worth trying at least

thank you as always
Denis

Does your dryer have a Done indicator LED on it? If it does you could build a sensor using a small low-profile photoresistor taped over the LED connected to an arduino input. When the dryer cycle is done, the Dryer’s LED illuminates and triggers your sensor. I actually saw this idea implemented in a different forum, and while not the most ashetically pleasing solution, it would be the simplest and most reliable one.

The Arduino UNO is very limited on RAM, with only 2K. I am cautiously optimistic that you’ll be able to get the sketch to compile and fit, since you’re only going to define 3 devices (two switch devices and one temp/humidity device.)

Here is a sketch you can try to get you started. I haven’t tried to compile it for an UNO yet to see if it will fit.

//******************************************************************************************
//  File: ST_Anything_Multiples_EthernetW5100_UNO.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 + Ethernet W5100 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 Ethernet W5100 Shield.
//
//            ST_Anything_Multiples implements the following ST Capabilities in multiples of 2 as a demo of what is possible with a single Arduino UNO
//              - 0 x Door Control devices (used typically for Garage Doors - input pin (contact sensor) and output pin (relay switch)
//              - 0 x Contact Sensor devices (used to monitor magnetic door sensors)
//              - 2 x Switch devices (used to turn on a digital output (e.g. LED, relay, etc...)
//              - 0 x Water Sensor devices (using an analog input pin to measure voltage from a water detector board)
//              - 0 x Illuminance Measurement devices (using a photoresitor attached to ananlog input)
//              - 0 x Voltage Measurement devices (using a photoresitor attached to ananlog input)
//              - 0 x Smoke Detector devices (using simple digital input)
//              - 0 x Carbon Monoxide Detector devices (using simple digital input)
//              - 0 x Motion devices (used to detect motion)
//              - 1 x Temperature Measurement devices (Temperature from DHT22 device)
//              - 1 x Humidity Measurement devices (Humidity from DHT22 device)
//              - 0 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...))
//              - 0 x Button devices (sends "pushed" if held for less than 1 second, else sends "held"
//              - 0 x Alarm devices - 1 siren only, 1 siren and strobe (using simple digital outputs)
//              - 0 x Dimmer Switch devices - uses 2 digital outputs, one for on/off and one for pwm level
//              - 0 x MQ-2 Smoke Detector devices (using simple analog input compared to user defined limit)
//
//            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.
//
//            Note: This sketch was fully tested on an Arduino UNO using the Ethernet W5100 Shield.
//    
//  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-16  Dan Ogorchock  New sketch to demonstrate multiple SmartThings Capabilties of each type
//    2017-04-22  Dan Ogorchock  Added Voltage, Carbon Monoxide, and Alarm with Strobe
//    2017-07-04  Dan Ogorchock  Added MQ-2 based Smoke Detection
//    2018-04-15  Dan Ogorchock  Modified/simplified for use with an Arduino UNO R3
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for Arduino Ethernet W5100 Shield
//******************************************************************************************
#include <SmartThingsEthernetW5100.h>    //Library to provide API to the SmartThings Ethernet W5100 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 <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_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <EX_Switch.h>       //Implements an Executor (EX) via a digital output to a relay

//**********************************************************************************************************
//Define which Arduino Pins will be used for each device
//  Notes: Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). 
//         This is on digital pins 10, 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. 
//         On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. 
//         These pins cannot be used for general I/O. On the Mega, the hardware SS pin, 53, 
//         is not used to select either the W5100 or the SD card, but it must be kept as an output 
//         or the SPI interface won't work.
//         See https://www.arduino.cc/en/Main/ArduinoEthernetShieldV1 for details on the W5100 Sield
//**********************************************************************************************************
//"RESERVED" pins for W5100 Ethernet Shield - best to avoid
#define PIN_4_RESERVED            4   //reserved by W5100 Shield on both UNO and MEGA
#define PIN_1O_RESERVED           10  //reserved by W5100 Shield on both UNO and MEGA
#define PIN_11_RESERVED           11  //reserved by W5100 Shield on UNO
#define PIN_12_RESERVED           12  //reserved by W5100 Shield on UNO
#define PIN_13_RESERVED           13  //reserved by W5100 Shield on UNO


//Analog Pins

//Digital Pins
#define PIN_TEMPERATUREHUMIDITY_1 6  //SmartThings Capabilities "Temperature Measurement" and "Relative Humidity Measurement"
#define PIN_SWITCH_1              7  //SmartThings Capability "Switch"
#define PIN_SWITCH_2              8  //SmartThings Capability "Switch"


//******************************************************************************************
//W5100 Ethernet Shield Information
//****************************************************************************************** 
byte mac[] = {0x06,0x02,0x03,0x04,0x05,0x06}; //MAC address, leave first octet 0x06, change others to be unique //  <---You must edit this line!
IPAddress ip(192, 168, 1, 226);               //Arduino 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 withotu having to rely on the ST Cloud for time-critical tasks.
//******************************************************************************************
void callback(const String &msg)
{
  //Uncomment if it weould be desirable to using this function
  //Serial.print(F("ST_Anything_Miltiples 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(s) as you see fit)
  //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_TemperatureHumidity sensor1(F("temphumid1"), 60, 40, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature1","humidity1");
  
  //Interrupt Sensors 

  //Executors
  static st::EX_Switch              executor1(F("switch1"), PIN_SWITCH_1, LOW, true);
  static st::EX_Switch              executor2(F("switch2"), PIN_SWITCH_2, LOW, true);

  //*****************************************************************************
  //  Configure debug print output from each main class 
  //*****************************************************************************
  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 EthernetW5100 Communications Object
    //STATIC IP Assignment - Recommended
    st::Everything::SmartThing = new st::SmartThingsEthernetW5100(mac, 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::SmartThingsEthernetW5100(mac, serverPort, hubIp, hubPort, st::receiveSmartString);

  //Run the Everything class' init() routine which establishes Ethernet communications with the SmartThings Hub
  st::Everything::init();
  
  //*****************************************************************************
  //Add each sensor to the "Everything" Class
  //*****************************************************************************
  st::Everything::addSensor(&sensor1);

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

Out of curiosity I tried to compile this and it is too large for the Uno. I tried modifying one of your sketches for the NodeMCU and it compiles with no problem. I am not a programmer but think this would work

//******************************************************************************************
// 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_ILLUMINANCE_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_SWITCH_2 D2 //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 D7 //SmartThings Capabilty “Motion Sensor” (HC-SR501 PIR Sensor)
//#define PIN_SMOKE_1 D6 //SmartThings Capabilty “Smoke Detector”
#define PIN_TEMPERATUREHUMIDITY_1 D7 //SmartThings Capabilities “Temperature Measurement” and “Relative Humidity Measurement”
//#define PIN_TIMEDRELAY_1 D8 //SmartThings Capability “Relay Switch”

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “XXXXXXXXXXX”; // <—You must edit this line!
String str_password = “XXXXXXXXXXX”; // <—You must edit this line!
IPAddress ip(192, 168, 1, 201); //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, 29); // 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_Illuminance sensor1(F(“illuminance1”), 60, 20, PIN_ILLUMINANCE_1, 0, 1023, 0, 1000);
//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);
static st::PS_TemperatureHumidity sensor1(F(“temphumid1”), 60, 40, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,“temperature1”,“humidity1”);

//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 sensor3(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 executor1(F(“switch1”), PIN_SWITCH_1, LOW, true);
static st::EX_Switch executor2(F(“switch2”), PIN_SWITCH_2, 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 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();
}

How would I say a light since her up using an Arduino.

So I am just trying out one of the “basics”,ST anything, multiples,esp8266wifi, but I am getting this error, if anyone would be so generous as to help me out ?

Arduino: 1.8.8 (Windows 10), Board: “WeMos D1 R1, 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

WARNING: library Servo claims to run on (avr, megaAVR, sam, samd, nrf52, stm32f4) architecture(s) and may be incompatible with your current board which runs on (esp8266) architecture(s).
In file included from C:\Users\XXX\Documents\Arduino\libraries\ST_Anything\EX_Servo.h:42:0,

             from C:\Users\XXX\Documents\Arduino\libraries\ST_Anything\EX_Servo.cpp:36:

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:75:2: error: #error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.”

#error “This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor.”

^

exit status 1
Error compiling for board WeMos D1 R1.

Hi Dan,

I really love what you’ve created, I’ve used the ST_Anything libraries in the past for odd short -term projects, albiet nothing in the last year or so.

I recently attempted to set up an ESP8266 using the ST_Anything_Relays_ESP8266.ino sketch from your examples, and have been encountering some trouble with it. I can’t seem to get any of the pin states to change when I press the button in the app (button stays at “TURNINGON”,
59%20PM
however, the refresh button in the app seems to work, or at least causes the ESP8266 serial output to pass the pin states.

I’m not sure where I could be going on, I’ve double-checked the instructions, and everything -looks- right to me. This is where I am currently:

  • Example sketch ST_Anything_Relays_ESP8266.ino uploaded to ESP8266 with the wireless credentials changed. Processor connects to the wifi router and three relays are added as observed in the serial monitor. [Attached images limited to one]
  • Parent device created in the ST IDE - When the device is configured in the ST Classic app the child devices show up.[Attached images limited to one]
  • When the refresh button is pressed in the classic app, activity is seen in the serial monitor:

17:38:22.885 -> Everything: Received: refresh
17:38:22.885 -> Everything: Sending: relaySwitch1 off
17:38:23.070 -> Everything: Sending: relaySwitch2 off
17:38:23.470 -> Everything: Sending: relaySwitch3 off
17:38:29.147 -> Everything: Free Ram = 46768

I haven’t been able to read through all the posts in this thread, but it seems that it might be similar to what AlecBL is seeing?

If pressing Refresh is working, then we at least know that the Parent Device can talk to the ESP8266. Pressing the On/Off of each child requires those child devices to make a call into the parent device. By any chance, were duplicate child devices created? Did you manually delete any child devices? If so, that will cause the issue you’re seeing. Delete the Parent Device (not DTH groovy code) and manually create it again.

You can also watch the Live Logs and see exactly what the errors are. That would help troubleshoot.

I just compiled the same sketch on my computer, selecting the Wemos D1 board. It compiled and linked without any errors whatsoever. Not sure what to tell you. I did recently update the Servo device code, which also requires other changes to ST_Anything as well. Have you downloaded all of the latest Arduino Libraries and Sketches code from the ST_Anything GitHub repo?

There were instances earlier today where I had duplicate child devices created, but for the last attempt / data gathering for the post, I created a new device and there were no duplicate child devices created.

Unfortunately, I haven’t seen much of anything in the live logging. All I get is this one message when the device is created:

86b9c0cd-e14f-440b-b1dd-bf4724cb8b8c 7:00:38 PM: debug Executing ‘installed()’
6:55:12 PM: info Waiting on events…
6:55:12 PM: info For past logs for individual things go to the My Devices section, find the device and click on the Events link on the device information page.
6:55:12 PM: info This console provides live logging of your SmartThings.

This is what the device page looks like:

Thanks for your insight, I really appreciate the time you have put into this.