[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

If you want to use a very specific resistance, yes you can do it with an Arduino. But the Arduino itself is not providing the resistance value, it is simply operating a switch that controls a relay, that completes a circuit containing the resistance you want to use.

Does this make sense? If not, I can try to draw a simple diagram for you.

Good day, my friend
I need your help to check the next library, in order to add the SHT30 temperature and humidity sensor that comes in the shield wemos

//******************************************************************************************
//  File: PS_Sht3x.h
//  Authors: Dan G Ogorchock 
//
//  Summary:  PS_AdafruitThermocouple is a class which implements the SmartThings "Temperature Measurement" 
//			  device capability.
//			  It inherits from the st::PollingSensor class.  The current version uses a digital input to measure the 
//			  temperature Adafruit MAX31855 series thermocouple sensor.    
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_Sht3x sensor2("temphumid1", 120, 7, "temperature1", "humidity1", false);
//
//			  st::PS_Sht3x() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- String strTemp - OPTIONAL - name of temperature sensor to send to ST Cloud (defaults to "temperature")
//				- String strHumid - OPTIONAL - name of humidity sensor to send to ST Cloud (defaults to "humidity")
//				- bool In_C - OPTIONAL - true = Report Celsius, false = Report Farenheit (Farentheit is the default)
//				- byte filterConstant - OPTIONAL - Value from 5% to 100% to determine how much filtering/averaging is performed 100 = none (default), 5 = maximum
//
//            Filtering/Averaging
//
//            Filtering the value sent to ST is performed per the following equation
//
//            filteredValue = (filterConstant/100 * currentValue) + ((1 - filterConstant/100) * filteredValue) 
//
//			  This class supports receiving configuration data from the SmartThings cloud via the ST App.  A user preference
//			  can be configured in your phone's ST App, and then the "Configure" tile will send the data for all sensors to 
//			  the ST Shield.  For PollingSensors, this data is handled in the beSMart() function.
//
//			  TODO:  Determine a method to persist the ST Cloud's Polling Interval data
//
//  Change History:
//
//    Date        Who            What
//    ----        ---            ----
//    2015-03-24  Dan Ogorchock  Original Creation
//    2018-08-30  Dan Ogorchock  Modified comment section above to comply with new Parent/Child Device Handler requirements
//
//
//******************************************************************************************

#ifndef ST_PS_SHT3X_H
#define ST_PS_SHT3X_H

#include "PollingSensor.h"
#include <WEMOS_SHT3X.h>

namespace st
{
	class PS_Sht3x: public PollingSensor
	{
		private:
			float m_fTemperatureSensorValue;//current Temperature value
			float m_fHumiditySensorValue;	//current Humidity Value
			static Sht3x Sht3xSensor;		//I2C

			String m_strTemperature;		//name of temparature sensor to use when transferring data to ST Cloud
			String m_strHumidity;			//name of temparature sensor to use when transferring data to ST Cloud	
			bool m_In_C;					//Return temp in C
			float m_fFilterConstant;        //Filter constant % as floating point from 0.00 to 1.00

		public:

			//constructor - called in your sketch's global variable declaration section
			PS_Sht3x(const __FlashStringHelper *name, unsigned int interval, int offset, String strTemp = "temperature1", String strHumid = "humidity1", bool In_C = false, byte filterConstant = 100);
			
			//destructor
			virtual ~PS_Sht3x();

			//SmartThings Shield data handler (receives configuration data from ST - polling interval, and adjusts on the fly)
			virtual void beSmart(const String &str);
			
			//initialization routine
			virtual void init();

			//function to get data from sensor and queue results for transfer to ST Cloud 
			virtual void getData();
			
			//gets
			inline float getTemperatureSensorValue() const { return m_fTemperatureSensorValue; }
			inline float getHumiditySensorValue() const { return m_fHumiditySensorValue; }
				
	};
}
#endif

//******************************************************************************************
//  File: PS_Sht3x.cpp
//  Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son) & Josh Hill
//
//  Summary:  PS_Sht3x is a class which implements both the SmartThings "Temperature Measurement" 
//			  and "Relative Humidity Measurement" device capabilities.
//			  It inherits from the st::PollingSensor class.  The current version uses I2C to measure the 
//			  temperature and humidity from an Si7021 sensor.  This was tested with a generic Si7021 sensor from AliExpress.
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_Sht3x sensor2("temphumid1", 120, 7, "temperature1", "humidity1", false);
//
//			  st::PS_Sht3x() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- String strTemp - OPTIONAL - name of temperature sensor to send to ST Cloud (defaults to "temperature")
//				- String strHumid - OPTIONAL - name of humidity sensor to send to ST Cloud (defaults to "humidity")
//				- bool In_C - OPTIONAL - true = Report Celsius, false = Report Farenheit (Farentheit is the default)
//				- byte filterConstant - OPTIONAL - Value from 5% to 100% to determine how much filtering/averaging is performed 100 = none (default), 5 = maximum
//
//            Filtering/Averaging
//
//            Filtering the value sent to ST is performed per the following equation
//
//            filteredValue = (filterConstant/100 * currentValue) + ((1 - filterConstant/100) * filteredValue) 
//
//			  This class supports receiving configuration data from the SmartThings cloud via the ST App.  A user preference
//			  can be configured in your phone's ST App, and then the "Configure" tile will send the data for all sensors to 
//			  the ST Shield.  For PollingSensors, this data is handled in the beSMart() function.
//
//			  TODO:  Determine a method to persist the ST Cloud's Polling Interval data
//
//  Change History:
//
//    Date        Who            What
//    ----        ---            ----
//    2015-01-03  Dan & Daniel   Original Creation
//	  2015-01-17  Dan Ogorchock	 Added optional temperature and humidity device names in constructor to allow multiple Temp/Humidity sensors
//    2015-01-17  Dan Ogorchock	 Added optional temperature and humidity device names in constructor to allow multiple Temp/Humidity sensors
//    2015-03-29  Dan Ogorchock	 Optimized use of the DHT library (made it static) to reduce SRAM memory usage at runtime.
//    2017-06-27  Dan Ogorchock  Added optional Celsius reading argument
//    2017-08-17  Dan Ogorchock  Added optional filter constant argument and to transmit floating point values to SmartThings
//    2018-03-24  Josh Hill      Modified library to use Si7021 over I2C
//
//******************************************************************************************

#include "PS_Sht3x.h"

#include "Constants.h"
#include "Everything.h"

//#include "WEMOS_SHT3X.h"


namespace st
{
//private
	

//public
	//constructor - called in your sketch's global variable declaration section
	PS_Sht3x::PS_Sht3x(const __FlashStringHelper *name, unsigned int interval, int offset, String strTemp, String strHumid, bool In_C, byte filterConstant) :
		PollingSensor(name, interval, offset),
		m_fTemperatureSensorValue(-1.0),
		m_fHumiditySensorValue(-1.0),
		m_strTemperature(strTemp),
		m_strHumidity(strHumid),
		m_In_C(In_C)
	{

		//check for upper and lower limit and adjust accordingly
		if ((filterConstant <= 0) || (filterConstant >= 100))
		{
			m_fFilterConstant = 1.0;
		}
		else if (filterConstant <= 5)
		{
			m_fFilterConstant = 0.05;
		}
		else
		{
			m_fFilterConstant = float(filterConstant) / 100;
		}

	}
	
	//destructor
	PS_Sht3x::~PS_Sht3x()
	{
		
	}

	//SmartThings Shield data handler (receives configuration data from ST - polling interval, and adjusts on the fly)
	void PS_Sht3x::beSmart(const String &str)
	{
		String s = str.substring(str.indexOf(' ') + 1);

		if (s.toInt() != 0) {
			st::PollingSensor::setInterval(s.toInt() * 1000);
			if (st::PollingSensor::debug) {
				Serial.print(F("PS_Sht3x::beSmart set polling interval to "));
				Serial.println(s.toInt());
			}
		}
		else {
			if (st::PollingSensor::debug) 
			{
				Serial.print(F("PS_Sht3x::beSmart cannot convert "));
				Serial.print(s);
				Serial.println(F(" to an Integer."));
			}
		}
	}

	//initialization routine - get first set of readings and send to ST cloud
	void PS_Sht3x::init()
	{
		delay(1500);		//Needed to prevent "Unknown Error" on first read of DHT Sensori (possibly not necessary with Si7021)
		
		bool status;
		status = Sht3xSensor.get();
		if (!status) {
			Serial.println("Could not find a valid Sht30 sensor, check wiring!");
			while (1);
		}

		getData();
	}
	
	//function to get data from sensor and queue results for transfer to ST Cloud 
	void PS_Sht3x::getData()
	{
		// READ DATA
		//Humidity
		if (m_fHumiditySensorValue == -1.0)
		{
			Serial.println("First time through Humidity)");
			m_fHumiditySensorValue = Sht3xSensor.humidity;  //first time through, no filtering
		}
		else
		{
			m_fHumiditySensorValue = (m_fFilterConstant * Sht3xSensor.humidity) + (1 - m_fFilterConstant) * m_fHumiditySensorValue;
		}

		//Temperature
		if (m_fTemperatureSensorValue == -1.0)
		{
			Serial.println("First time through Termperature)");
			//first time through, no filtering
			if (m_In_C == false)
			{
				m_fTemperatureSensorValue = Sht3xSensor.fTemp;
			}
			else
			{
				m_fTemperatureSensorValue = Sht3xSensor.cTemp;
			}
		}
		else
		{
			if (m_In_C == false)
			{
				m_fTemperatureSensorValue = (m_fFilterConstant * Sht3xSensor.fTemp + (1 - m_fFilterConstant) * m_fTemperatureSensorValue;
			}
			else
			{
				m_fTemperatureSensorValue = (m_fFilterConstant * Sht3xSensor.cTemp + (1 - m_fFilterConstant) * m_fTemperatureSensorValue;
			}
			
		}


		// DISPLAY DATA
		//Serial.print(m_nHumiditySensorValue, 1);
		//Serial.print(F(",\t\t"));
		//Serial.print(m_nTemperatureSensorValue, 1);
		//Serial.println();

		Everything::sendSmartString(m_strTemperature + " " + String(m_fTemperatureSensorValue));
		Everything::sendSmartString(m_strHumidity + " " + String(m_fHumiditySensorValue));
	}
	

	//initialize static members
	Sht3x PS_Sht3x::Sht3xSensor = Sht3x();
//  Adafruit_Si7021 PS_Adafruit_Si7021_TempHumidity::Si7021Sensor = Adafruit_Si7021();
}


#ifndef __WEMOS_SHT3X_H
#define __WEMOS_SHT3X_H

#if ARDUINO >= 100
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif

#include "Wire.h"

#define SHT30_ADDRESS  0x45

class SHT3X{
public:
	SHT3X(void);
	byte get(void);
	float cTemp=0;
	float fTemp=0;
	float humidity=0;

private:
	uint8_t _address;

};

#endif

#include "WEMOS_SHT3X.h"

/* Motor()

*/
SHT3X::SHT3X(void)
{
	Wire.begin();
    _address = SHT30_ADDRESS;
}

byte SHT3X::get()
{
	unsigned int data[6];
	// Start I2C Transmission
	Wire.beginTransmission(_address);
	// Send measurement command
	Wire.write(0x2C);
	Wire.write(0x06);
	// Stop I2C transmission
	if (Wire.endTransmission()!=0) 
		return 1;  

	delay(500);
	// Request 6 bytes of data
	Wire.requestFrom(_address, 6);

	// Read 6 bytes of data
	// cTemp msb, cTemp lsb, cTemp crc, humidity msb, humidity lsb, humidity crc
	for (int i=0;i<6;i++) {
		data[i]=Wire.read();
	};
	
	delay(50);
	
	if (Wire.available()!=0) 
		return 2;
	// Convert the data
	cTemp = ((((data[0] * 256.0) + data[1]) * 175) / 65535.0) - 45;
	fTemp = (cTemp * 1.8) + 32;
	humidity = ((((data[3] * 256.0) + data[4]) * 100) / 65535.0);

	return 0;
}

Changed Board libs to 2.4.2., re-uploaded the sketch.
Here are my findings - I can see the ST shows the status change for the Contact (the activity also is visible via a serial port monitor on Arduino IDE ), but nothing will change once the switch/button is pressed, just stuck on “Turning On” (nothing on the serial monitor as well).
Looks like the board will pass commands to the SM, but not backwards.

You did select your Hub and Location when manually configuring the Parent Device, correct?

Did you configure the settings of the Parent Device to use the microcontroller’s IP address and Port? Make sure they match the sketch.

Question…did you by any chance replace or reset your home router recently? Are you using static IP addressing of the microcontrollers, or Reserved DHCP addresses in your router? This would explain what you’re seeing…

1 Like

You did select your Hub and Location when manually configuring the Parent Device, correct?

Correct!

Did you configure the settings of the Parent Device to use the microcontroller’s IP address and Port? Make sure they match the sketch.

Yes, they are matching.

Question…did you by any chance replace or reset your home router recently?

Did not.

Are you using static IP addressing of the microcontrollers, or Reserved DHCP addresses in your router?

I am using the static IP reservation on the router level (Binding the assigned IP address with MAC)

Another thing that I noticed - it creates a double child object once a new device is added and configured (IP, port, MAC) even though I put 0 in the BUTTON N field.:roll_eyes:

I have replaced a router with my a hot spare one, but no luck (configured all static IPs) :scream:

Thanks for a quick reply!

Have you considered using a smart thermostat to control the boiler? You can change the temperature setpoint via the hub based on rules that use temperature sensors in areas other than the thermostat location. Im a huge fan of ST_Anything, but sometimes it is not the best solution.

1 Like

Have you updated all of the Groovy Device Handlers from my GitHub repository? I added some new code to try to prevent the double child issue to the Parent DTH.

Also, once you have the double child problem, you really need to delete the parent and start over. The duplicate child devices will not behave properly. I have seen one receive updates but not be able to control anything, while the other does the opposite.

Dan,
I think it is all started, once I accidentally updated my DHs from GitHub.
Here is what I noticed today, my bench board ESP01 locks up after 5 mins or so. I have downloaded the new libraries before completing the sketch.
At this point I have verified there is no issues with Samsung ST hub (Z-Wave devices are working, as well as Google integration)
The next step would be wiping the entire DHs and My devices to start from a clean slate unless you have a suggestion.

I cannot think why you’d be having these issues. You definitely need a matched set of the ST_Anything groovy Device Handlers. The Parent and Child devices are a matched set. A couple of months back I made some changes that required all of them to be updated. There is no need to delete the devices, though. Just remember to update and publish all of the device handlers. Using Github integration makes this pretty quick and easy. Also, if updating manually, I would not delete the Device Handlers. I would overwrite, save, and publish each and every one of them.

The ESP01 locking up in 5 minutes is a little concerning. This is using Arduino 1.8.8 and ESP8266 v2.4.2? I testing that combination for days and days on a NodeMCU ESP8266 and had no issues. I even had a rule trigger every minute to send an ‘on’ command to a Timed Relay device. It always turned on and automatically turned off after a few seconds as expected.

Correct, confirmed with 3 different boards, I am moving to v2.5.0 since v2.4.0 has a memory leak.
Also , no a child created once I add ST_Anything Ethernet into My devices on ST web-page, and configure it in ST classic app.

Tried v2.5.0 - no luck. :scream:
At this point none of my ST_Anything devices communicating back to the phone app or ST cloud.
All devices’ IPs are pingable.
Can you please share a code for
I even had a rule trigger every minute to send an ‘on’ command to a Timed Relay device.

Let’s step back and make sure we’re on the same page.

I thought the ESP8266s were able to send data to the ST Hub/Cloud successfully. Is this no longer the case? I was under the impression that ST sending data to the ESP8266 was the problem?

For ESP8266 to ST communications to work, the following must be correct:

  1. In the sketch, the IP address of the ST Hub must be correct
  2. In the sketch, the port for the ST Hub must be 39500
  3. In the ST Classic Mobile App, Parent Device’s settings must have the correct MAC address of the ESP8266 (retrieved from the Arduino IDE Serial Monitor window)
  4. In the ST Web IDE, the Parent Device’s Hub and Location must be set correctly

For ST to ESP8266 communications to work

  1. In the ST Classic Mobile App, Parent Device’s settings must have the correct IP address of the ESP8266 - must match what is in the sketch!
  2. In the ST Classic Mobile App, Parent Device’s settings must have the correct Port of the ESP8266 (usually 8090) - must match what is in the sketch!
  3. In the ST Web IDE, the Parent Device’s Hub and Location must be set correctly

Verify all of those settings. Share screen captures of Live Logs, Parent Device IDE settings, the Arduino Sketch, etc… It is very hard to troubleshoot without more data.

It does, but diagram will be also great… thank you in advance.

Here you go. It is a very simple circuit, which can switch a resistor on and off. It cannot vary the resistance.

Note: Not all temperature sensors are simply thermistors. Please be careful and fully understand exactly what the boiler’s circuitry is expecting to prevent damage.

Dan,
Thanks for sticking with me on this issue, very appreciated.
I have verified :
For ESP8266 to ST communications to work :

  1. In the sketch, the IP address of the ST Hub must be correct - VERIFIED
  2. In the sketch, the port for the ST Hub must be 39500 - VERIFIED
  3. In the ST Classic Mobile App, Parent Device’s settings must have the correct MAC address of the ESP8266 (retrieved from the Arduino IDE Serial Monitor window) - VERIFIED
  4. In the ST Web IDE, the Parent Device’s Hub and Location must be set correctly - VERIFIED

For ST to ESP8266 communications to work

  1. In the ST Classic Mobile App, Parent Device’s settings must have the correct IP address of the ESP8266 - must match what is in the sketch! - VERIFIED

  2. In the ST Classic Mobile App, Parent Device’s settings must have the correct Port of the ESP8266 (usually 8090) - must match what is in the sketch! - VERIFIED

  1. In the ST Web IDE, the Parent Device’s Hub and Location must be set correctly - VERIFIED

After I added a test device I did not see any activities from the device.

Tried to activate the contact but no a status change in the app but I cansee is is opens/closes in the serial port monitor.

HERE IS MY SKETCH

//******************************************************************************************
// File: ST_Anything_Multiples_ESP01WiFi.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 ESP8266-01 (ESP-01) 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 ESP-01’s WiFi.
//
// ST_Anything_Multiples implements the following ST Capabilities in multiples of 1 as a demo of what is possible with a single ESP-01
// - 1 x Contact Sensor device (used to monitor magnetic door sensors)
// - 1 x Motion devices (used to detect motion)
//
// Note: The tiny ESP-01 only has 2 GPIO pins, so this example is somewhat limited. Use the ST_ANything_Multiples_ESP8266WiFi.ino example to see
// what else is possible. As long as you only try using 2 pins, you can use them for whatever you’d like.
//
// 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-02-21 Dan Ogorchock New example specifically for running everythin on a ESP-01 (no Arduino required!)
// 2017-04-24 Dan Ogorchock Updated for use with new v2.5 Parent/Child Device handlers
//
//******************************************************************************************
//******************************************************************************************
// 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 <IS_Button.h> //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses
#include <PS_TemperatureHumidity.h> //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library.
#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 <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

//******************************************************************************************
//Define which Arduino Pins will be used for each device
//******************************************************************************************

#define PIN_CONTACT_1 2
#define PIN_RELAY_1 0 //SmartThings Capability “Relay Switch”

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “xxx@HOME”; // <—You must edit this line!
String str_password = “xxxxxxxxxxxx”; // <—You must edit this line!
IPAddress ip(192, 168, 10, 87); //Device IP Address // <—You must edit this line!
IPAddress gateway(192, 168, 10, 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, 10, 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(192, 168, 10, 200); // 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)
{
//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 ESP-01
// 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
static st::IS_Contact sensor1(F(“contact1”), PIN_CONTACT_1, LOW, true);

//Special sensors/executors (uses portions of both polling and executor classes)

//Executors
static st::EX_Switch executor1(F(“switch1”), PIN_RELAY_1, 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 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);

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

Can you please show me a screen shot of the Parent Device’s details from the ST Web IDE?

Hi Dan:
Good Afternoon.
I need your help.
I have two switches ( 1 and 2) in ST_Anything_Multiples_ESP8266WiFi sketch. I would like to operate these two switches with some logic. Is it possible to add additional conditional logic inside the sketch? Please advise. Thanks, Regards, Tito

Maybe… what logic would you like to perform?

Search this thread for numerous posts regarding the use of the sketch’s internal “callback()” function and you will see examples of how to implement local logic.

Here you go

To add a more confusion:
Here is what I noticed today while trying to fix everything - a numeral devices would work once only after a power cycling, and wouldn’t to respond to the ST app command and/or local state changes. All those devices a mix of pool devices which were and were NOT flushed with new ST_Anything libraries!
Here is an email recieved today from Samsung ST.
February 19, we began rolling out a new design interface in the SmartThings app.
My wildest guess- is it what really affected me?
I would not think so since the Google and Skybell integration with Zwave lamps works fine.