[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

After reading a ton… I have to ask…

Right now I’m controlling my Somfy RTS shades with Domoticz and importing them into ST… I am banging my head against a brick wall to do the same with my newly installed 433MHz controlled Faro Barcelona Lantau ceiling fan…

I’ve read this development (of which I’m already a huge fan and have started using it, THANKS) could control 433MHz devices somehow?

I have done a quick search in Amazon and found this:

https://www.amazon.es/s?k=arduino+433mhz&__mk_es_ES=ÅMÅŽÕÑ&crid=2OGQXEQIOAP83&sprefix=arduino+433%2Caps%2C212&ref=nb_sb_ss_ac-o-p_1_11

What reference should I get to pair it with an arduino uno, nano or ESP8266-01S? (The ones I have laying around at the moment)

Or is there a device I should look out for that has wifi/Ethernet + 433 + anything else I could need for this task?

Thanks again!!!

First, I really have no idea if it is possible to control your new 433MHz ceiling fan with ST_Anything. The only support I have added was to control a simple On/Off 433MHz outlet using the RCSwitch Arduino library.

Here are the details of that work from many. many years ago. I do not use it nor do I know of anyone who is till using it.

and this is the Arduino library

Personally, I would look at some of the commercial off-the-shelf devices that are designed to bridge smart home platforms with RF devices. Have you looked at Bond?

1 Like

I’ll take a look!

Thanks for all that info!!!

I did look at bond… Too expensive for what it does… :sweat_smile::sweat_smile:

1 Like

Hi Dan (and all), I’m wondering if it is possible to combine multiple relays (and possibly sensors) into a single device. I have 2 use cases, both for a new house designed and wired especially for ST_Anything!

Wired Window Shades: Each shade uses two switches (or Timed Relays), one for Up and one for Down. Instead of showing up as two different switches, it would of course be fantastic if it were to be interpreted by ST and HE (I’m using both in two different locations) as a single Window Shade with “Up” and “Down” functions instead of two “On” and “Off” switches.

Latching relays: Latching/bistable relays have 2 coils in them: one that is pulsed to turn on, and one that is pulsed to turn off. Right now the only way to do this from ST_Anything is to treat them as two different switches. Once again, that’s very confusing on the hub interface side of things. It would be much better if they showed up as a single switch, where toggling it to the “On” state sent a momentary activation to one relay/coil and toggling it to the “Off” state sent a momentary activation to the second relay/coil. Because DPDT latching relays could also be used to send back confirmation to the Arduino of the state it’s in (which can currently be done by adding a third device in ST_Anything, a contact sensor), it would be even better if it were possible to incorporate a contact sensor into a single device.

I have no idea if this is possible to accomplish or not, but I have a number of both devices in the new house, and am looking for a cleaner way to integrate them than using multiple ST_Anything devices for what are essentially single devices. Thanks in advance!

Yes, these requests are possible…but would require quite a bit of code to implement on both the Arduino side, as well as possibly the ST DTH side. With all of the recent announcements regarding SmartThings direction regarding their Legacy Platform (upon which ST_Anything is built), I really do not have any motivation to put a lot of effort into something that will need a massive rewrite over the next 12 months.

Since I have my house running 100% on Hubitat these days, there is not a lot of incentive for me to rewrite ST_Anything to work with the New ST Platform API. I may take a look at it out of pure curiosity, but I make no promises to anyone that ST_Anything will continue to work after the Legacy Groovy Platform is shut down.

Of course, I will continue to maintain it on Hubitat as that is what I depend on. I have been happy to keep things working on SmartThings for over 2 years since I moved to Hubitat. However, this change may be the ‘straw that breaks the camel’s back’, so to speak.

Thank you for your reply, Dan. The new house I speak of is on Hubitat, so I should have posted this on that thread. I will do so! I’ll make the switch at my current place over to Hubitat at some point as well, so really, if this is possible to implement on Hubduino (only), I’d be immensely grateful!

1 Like

Hi Dan, Thanks for everything you’ve done with ST_Anything and for sharing it. It’s been a great learning tool for me.

I am trying to automate the function of my pool and some diy solar heaters I made. At the moment, I have several thermistors I’m utilizing as well as a bunch of digital outputs to actuate relays to send commands to my pump.

I’m using a NodeMCU-32S and I’ve got the thermistors functioning completely using the voltage sensor, and a modified version of the corresponding DTH to display temp. My issue comes with the outputs - they don’t function at all. It appears to me that I am not seeing any communication back to the ESP32, but I’m not sure how to verify that. I’ve tried the switch executor and the timed relay sensor (which is what I’ll need in the end). The devices are created and look good in the ST Classic app. IP addresses are correct, and ports are specified for the ESP32 and hub as in the example file (ST_Anything_Multiples_ESP32WiFi.ino). My hub is a Samsung Connect Home. For what it’s worth, if I invert switch logic for the outputs, they are permanently on as I would expect, given the rest of the code below. I’m interested to “hear” what anyone thinks, as I am very new to this, I’m guessing everyone here could teach me a thing or two.

My sketch file:

#include <SmartThingsESP32WiFi.h>

#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_Voltage.h>      //Implements a Polling Sensor (PS) to measure voltage on an analog input pin
#include <S_TimedRelay.h>    //Implements a Sensor to control a digital output pin with timing/cycle repeat capabilities
#include <EX_Switch.h>       //Implements an Executor (EX) via a digital output to a relay

#define PIN_TMP36_1 36
#define PIN_TMP36_2 39

#define PIN_THERM_1 34
#define PIN_THERM_2 35
#define PIN_THERM_3 32

#define PIN_SWITCH_1 23
#define PIN_SWITCH_2 22
#define PIN_SWITCH_3 21
#define PIN_SWITCH_4 19

#define PIN_VALVE1_1 18
#define PIN_VALVE1_2 17

String str_ssid     = "XXX";
String str_password = "XXX";
IPAddress ip(10, 0, 20, 10);       //Device IP Address
IPAddress gateway(10, 0, 20, 1);    //Router gateway
IPAddress subnet(255, 255, 255, 0);   //LAN subnet mask
IPAddress dnsserver(10, 0, 20, 1);  //DNS server
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address
IPAddress hubIp(10, 0, 20, 5);    // smartthings hub ip
const unsigned int hubPort = 39500;   // smartthings hub port

void setup() 
{  
  Serial.begin(115200);
  delay(10);

  //connect to WiFi
  st::Everything::SmartThing = new st::SmartThingsESP32WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
  //Run the Everything class' init() routine which establishes WiFi communications with SmartThings Hub
  st::Everything::init();

  static st::PS_Voltage       sensor1(F("voltage1"), 10, 0, PIN_TMP36_1, 0, 4095, 0, 3300, 10, 100); //Front Heater
  static st::PS_Voltage       sensor2(F("voltage2"), 10, 2, PIN_TMP36_2, 0, 4095, 0, 3300, 10, 100); //Rear Heater
  static st::PS_Voltage       sensor3(F("voltage3"), 10, 4, PIN_THERM_1, 0, 4095, 0, 3300, 10, 100); //Pump Temp
  static st::PS_Voltage       sensor4(F("voltage4"), 10, 6, PIN_THERM_2, 0, 4095, 0, 3300, 10, 100); //Pump Temp
  static st::PS_Voltage       sensor5(F("voltage5"), 10, 8, PIN_THERM_3, 0, 4095, 0, 3300, 10, 100); //Pump Temp

  static st::S_TimedRelay     sensor6(F("relaySwitch1"), PIN_SWITCH_1, LOW, false, 2000, 0, 1, 0);
  static st::S_TimedRelay     sensor7(F("relaySwitch2"), PIN_SWITCH_2, LOW, false, 2000, 0, 1, 0);
  static st::S_TimedRelay     sensor8(F("relaySwitch3"), PIN_SWITCH_3, LOW, false, 2000, 0, 1, 0);
  static st::S_TimedRelay     sensor9(F("relaySwitch4"), PIN_SWITCH_4, LOW, false, 2000, 0, 1, 0);
  static st::S_TimedRelay     sensor10(F("relaySwitch5"), PIN_VALVE1_1, LOW, false, 500, 0, 1, 0);
  static st::S_TimedRelay     sensor11(F("relaySwitch6"), PIN_VALVE1_2, LOW, false, 500, 0, 1, 0);
  static st::S_TimedRelay     sensor12(F("relaySwitch7"), PIN_VALVE1_1, LOW, false, 3000, 0, 1, 0);
  static st::S_TimedRelay     sensor13(F("relaySwitch8"), PIN_VALVE1_2, LOW, false, 3000, 0, 1, 0);

  //  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;
  //connect to WiFi
  st::Everything::SmartThing = new st::SmartThingsESP32WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
  //Run the Everything class' init() routine which establishes WiFi communications with SmartThings Hub
  st::Everything::init();
  
  //Add each device to the "Everything" Class
  st::Everything::addSensor(&sensor1);
  st::Everything::addSensor(&sensor2);
  st::Everything::addSensor(&sensor3);
  st::Everything::addSensor(&sensor4);
  st::Everything::addSensor(&sensor5);

  st::Everything::addSensor(&sensor6);
  st::Everything::addSensor(&sensor7);
  st::Everything::addSensor(&sensor8);
  st::Everything::addSensor(&sensor9);
  st::Everything::addSensor(&sensor10);
  st::Everything::addSensor(&sensor11);
  st::Everything::addSensor(&sensor12);
  st::Everything::addSensor(&sensor13);
    
  //Initialize each of the devices which were added to the Everything Class
  st::Everything::initDevices();
}

void loop() 
{
  //Execute the Everything run method which takes care of "Everything"
  st::Everything::run();
}

Joe,

Sounds like you are very close to having things working. Couple questions for you…

  1. Can you ping the ESP32 board at 10.0.20.10?
  2. You’re using the ST Classic App, correct?
  3. Remove the ‘Arduino IP address’ from the Parent Device’s settings using the Classic App, and then type it back in, being sure to use 10.0.20.10.
  4. Do the same with the Arduino Port - use 8090.
  5. With the Arduino IDE Serial Monitor Window connected to the ESP32, take note of anything that does not look correct. When you click “Refresh” on the Parent Device via the Classic App, you should literally see the work ‘refresh’ appear in the Arduino IDE Serial Monitor window.
  6. Look in the ST Web IDE’s Live Logs while clicking “Refresh” in the ST Classic App. You should see some information about sending ‘refresh’ to the ESP32 in there.

Share some screenshots of the settings in the Classic App, as well as the Live Logs, and Arduino Serial Monitor Window.

Thanks Dan, I appreciate the response.

  1. I can ping the ESP32 ip address, yes.
  2. ST Classic App, yes.
  3. re-typed teh IP address, but no change.
  4. Arduino Port is 8090.
    5, 6. I see no sign of the refresh in the serial monitor, but I do see it in the ST IDE live log (shown below).

17:45:11.469 -> Initializing ESP32 WiFi network. Please be patient…
17:45:12.439 -> Attempting to connect to WPA SSID: Barron_IoT
17:45:12.439 -> .[WiFi-event] event: 7
17:45:12.610 -> WiFi connected
17:45:12.610 -> IP address:
17:45:12.610 -> 10.0.20.10
17:45:12.610 -> [WiFi-event] event: 7
17:45:12.610 -> WiFi connected
17:45:12.610 -> IP address:
17:45:12.610 -> 10.0.20.10
17:45:12.610 -> [WiFi-event] event: 7
17:45:12.610 -> WiFi connected
17:45:12.610 -> IP address:
17:45:12.610 -> 10.0.20.10
17:45:12.610 -> [WiFi-event] event: 7
17:45:12.610 -> WiFi connected
17:45:12.610 -> IP address:
17:45:12.610 -> 10.0.20.10
17:45:12.956 ->
17:45:12.956 ->
17:45:12.956 -> Enter the following three lines of data into ST App on your phone!
17:45:12.956 -> localIP = 10.0.20.10
17:45:12.956 -> serverPort = 8090
17:45:12.956 -> MAC Address = 2462ABF39B54
17:45:12.956 ->
17:45:12.956 -> SSID = Barron_IoT
17:45:12.956 -> PASSWORD = Today001
17:45:12.956 -> hubIP = 10.0.20.5
17:45:12.956 -> hubPort = 39500
17:45:12.956 -> RSSI = -63
17:45:12.956 ->
17:45:12.956 -> SmartThingsESP32WiFI: Intialized
17:45:12.990 ->
17:45:12.990 -> Everything: init ended
17:45:12.990 -> Everything: Free RAM = 263528
17:45:12.990 -> Everything: adding sensor named voltage1
17:45:12.990 -> Everything: Free RAM = 263528
17:45:12.990 -> Everything: adding sensor named voltage2
17:45:12.990 -> Everything: Free RAM = 263528
17:45:12.990 -> Everything: adding sensor named voltage3
17:45:12.990 -> Everything: Free RAM = 263528
17:45:12.990 -> Everything: adding sensor named voltage4
17:45:12.990 -> Everything: Free RAM = 263528
17:45:12.990 -> Everything: adding sensor named voltage5
17:45:13.025 -> Everything: Free RAM = 263528
17:45:13.025 -> Everything: adding sensor named relaySwitch1
17:45:13.025 -> Everything: Free RAM = 263528
17:45:13.025 -> Everything: adding sensor named relaySwitch2
17:45:13.025 -> Everything: Free RAM = 263528
17:45:13.025 -> Everything: adding sensor named relaySwitch3
17:45:13.025 -> Everything: Free RAM = 263528
17:45:13.025 -> Everything: adding sensor named relaySwitch4
17:45:13.025 -> Everything: Free RAM = 263528
17:45:13.025 -> Everything: adding sensor named relaySwitch5
17:45:13.059 -> Everything: Free RAM = 263528
17:45:13.059 -> Everything: adding sensor named relaySwitch6
17:45:13.059 -> Everything: Free RAM = 263528
17:45:13.059 -> Everything: adding sensor named relaySwitch7
17:45:13.059 -> Everything: Free RAM = 263528
17:45:13.059 -> Everything: adding sensor named relaySwitch8
17:45:13.059 -> Everything: Free RAM = 263528
17:45:13.059 -> Everything: initDevices started
17:45:13.059 -> Everything: Free RAM = 263528
17:45:13.059 -> Everything: Sending: voltage1 563.54
17:45:13.197 -> Everything: Sending: voltage2 224.51
17:45:13.849 -> Everything: Sending: voltage3 910.86
17:45:14.500 -> Everything: Sending: voltage4 908.61
17:45:15.119 -> Everything: Sending: voltage5 895.55
17:45:15.703 -> Everything: Sending: relaySwitch1 off
17:45:16.389 -> Everything: Sending: relaySwitch2 off
17:45:16.977 -> Everything: Sending: relaySwitch3 off
17:45:17.598 -> Everything: Sending: relaySwitch4 off
17:45:18.219 -> Everything: Sending: relaySwitch5 off
17:45:18.838 -> Everything: Sending: relaySwitch6 off
17:45:19.457 -> Everything: Sending: relaySwitch7 off
17:45:20.079 -> Everything: Sending: relaySwitch8 off
17:45:20.701 -> Everything: initDevices ended
17:45:20.701 -> Everything: Free RAM = 259288
17:45:30.817 -> Everything: Sending: voltage1 579.90
17:45:32.789 -> Everything: Sending: voltage2 579.49
17:45:35.300 -> Everything: Sending: voltage3 905.95
17:45:36.747 -> Everything: Sending: voltage4 906.67
17:45:39.438 -> Everything: Sending: voltage5 897.73
17:45:40.884 -> Everything: Sending: voltage1 581.67
17:45:42.854 -> Everything: Sending: voltage2 560.72
17:45:45.747 -> Everything: Sending: voltage3 906.92
17:45:46.785 -> Everything: Sending: voltage4 908.45
17:45:49.883 -> Everything: Sending: voltage5 895.23
17:45:50.984 -> Everything: Sending: voltage1 579.58
17:45:52.914 -> Everything: Sending: voltage2 578.29
17:45:56.158 -> Everything: Sending: voltage3 903.93
17:45:56.818 -> Everything: Sending: voltage4 906.67
17:46:00.188 -> Everything: Sending: voltage5 897.08
17:46:01.253 -> Everything: Sending: voltage1 579.01
17:46:03.084 -> Everything: Sending: voltage2 576.75
17:46:06.329 -> Everything: Sending: voltage3 907.32
17:46:07.190 -> Everything: Free Ram = 257252

5:46:45 PM: debug 2462ABF39B54-voltage2 - name: voltage, value: 562.81
5:46:45 PM: debug Parsing: voltage2 562.81
5:46:45 PM: debug 2462ABF39B54-voltage1 - name: voltage, value: 580.54
5:46:45 PM: debug Parsing: voltage1 580.54
5:46:41 PM: debug 2462ABF39B54-voltage5 - name: voltage, value: 896.04
5:46:41 PM: debug Parsing: voltage5 896.04
5:46:40 PM: debug 2462ABF39B54-voltage4 - name: voltage, value: 907.00
5:46:40 PM: debug Parsing: voltage4 907.00
5:46:38 PM: debug [name:rssi, value:-63, displayed:false, linkText:Pool Controller, descriptionText:Pool Controller rssi is -63, isStateChange:false]
5:46:38 PM: debug Parsing: rssi -63
5:46:38 PM: debug 2462ABF39B54-voltage3 - name: voltage, value: 906.92
5:46:38 PM: debug Parsing: voltage3 906.92
5:46:35 PM: debug 2462ABF39B54-voltage2 - name: voltage, value: 577.08
5:46:35 PM: debug Parsing: voltage2 577.08
5:46:34 PM: debug 2462ABF39B54-voltage1 - name: voltage, value: 580.54
5:46:34 PM: debug Parsing: voltage1 580.54
5:46:29 PM: debug 2462ABF39B54-voltage4 - name: voltage, value: 907.32
5:46:29 PM: debug Parsing: voltage4 907.32
5:46:28 PM: debug 2462ABF39B54-voltage3 - name: voltage, value: 906.92
5:46:27 PM: debug Parsing: voltage3 906.92
5:46:25 PM: debug [name:rssi, value:-63, displayed:false, linkText:Pool Controller, descriptionText:Pool Controller rssi is -63, isStateChange:false]
5:46:25 PM: debug Parsing: rssi -63
5:46:23 PM: debug 2462ABF39B54-voltage1 - name: voltage, value: 580.86
5:46:23 PM: debug Parsing: voltage1 580.86
5:46:21 PM: debug 2462ABF39B54-voltage5 - name: voltage, value: 895.47
5:46:21 PM: debug Parsing: voltage5 895.47
5:46:19 PM: debug 2462ABF39B54-voltage4 - name: voltage, value: 908.04
5:46:19 PM: debug Parsing: voltage4 908.04
5:46:17 PM: debug 2462ABF39B54-voltage3 - name: voltage, value: 907.08
5:46:17 PM: debug Parsing: voltage3 907.08
5:46:14 PM: debug 2462ABF39B54-voltage2 - name: voltage, value: 576.92
5:46:14 PM: debug Parsing: voltage2 576.92
5:46:13 PM: debug 2462ABF39B54-voltage1 - name: voltage, value: 570.07
5:46:13 PM: debug Parsing: voltage1 570.07
5:46:13 PM: debug [name:rssi, value:-63, displayed:false, linkText:Pool Controller, descriptionText:Pool Controller rssi is -63, isStateChange:false]
5:46:13 PM: debug Parsing: rssi -63
5:46:07 PM: debug 2462ABF39B54-voltage3 - name: voltage, value: 907.32
5:46:07 PM: debug Parsing: voltage3 907.32
5:46:04 PM: debug 2462ABF39B54-voltage2 - name: voltage, value: 576.75
5:46:04 PM: debug Parsing: voltage2 576.75
5:46:03 PM: debug 2462ABF39B54-voltage5 - name: voltage, value: 897.08
5:46:03 PM: debug Parsing: voltage5 897.08
5:46:02 PM: debug [name:rssi, value:-63, displayed:false, linkText:Pool Controller, descriptionText:Pool Controller rssi is -63, isStateChange:false]
5:46:02 PM: debug Parsing: rssi -63
5:45:59 PM: debug Using ip: 10.0.20.10 and port: 8090 for device: 79051381-5acd-42d9-99ff-96e1259b280f
5:45:59 PM: debug Executing 'sendEthernet' refresh
5:45:59 PM: debug Executing 'refresh()'

Try a full power cycle of your ST Hub.

You are the Primary Account holder for the hub, right? Not a secondary user on the ST account?

Power cycled, still no change. I am the primary account holder, yes.

I wonder if the ESP32 is connected to a satellite node instead of the main router/hub? What happens if you unplug all of the satellites and move the ESP32 next to the main hub?

Just a pure guess.

Hello there Dan
i am having trouble with my latest project i have tried 3 different NodeMCU units and none of them want to connect to my network with the following sketch.
I have double checked and triple checked the ssid and the password and rebooted the router and the ST hub
Is there any other reason that may cause a problem ???
I am attaching the sketch right in here please have a look and tell me if you see anything wrong the sketch compiles with no errors. On the serial monitor on the Arduino IDE all i see is gibberish i am not sure if anything is displayed there anyhow from ST_Anything.
As always thank you and i greatly appreciate your work
Denis

//******************************************************************************************

// 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 5 //SmartThings Capability “Motion Sensor” (HC-SR501 PIR Sensor)
#define PIN_TEMPERATUREHUMIDITY 6 //SmartThings Capability “DHT22”
#define PIN_RELAY_1 7 //SmartThings Capability “Relay Switch”
#define PIN_RELAY_2 8 //SmartThings Capability “Relay Switch”

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “grabockanet_2ghz”; // <—You must edit this line!
String str_password = “4697374387”; // <—You must edit this line!
IPAddress ip(192, 168, 1, 29); //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, 192); // 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_TemperatureHumidity sensor1(F(“temphumid1”), 60, 40, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT22,“temperature1”,“humidity1”);

//Interrupt Sensors

static st::IS_Motion sensor2(F(“motion1”), PIN_MOTION_1, HIGH, false);

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

static st::EX_Switch executor1(F(“switch1”), PIN_RELAY_1, LOW, true);
static st::EX_Switch executor2(F(“switch2”), PIN_RELAY_2, LOW, true);

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

What do you see in the Arduino IDE Serial Monitor window when the boards are trying to connect?

What version of the ESP8266 Board Manager are you using in the Arduino IDE?

Double check that your SSID is correct, and really is a 2.4GHz WiFi SSID.

Double check your WiFi password.

Not sure what else it would be, unless your router is blocking WiFi connections for some reason. Did you enable MAC address filtering/blocking?

Hello again - haven’t posted since [RELEASE] ST_Anything - Arduino/ESP8266/ESP32

but a short update - I had a lot of trouble with my ESP8266 at ten digital outs and getting it to sit well with this code and so eventually came back to it this past week - this time with an ESP32 device. I’ve now got far more I/O to play with so I allocated 10 digital I/Os to controlling my LED array and used the onboard light as the fake switch for ST_Anything. It’s working like a charm - the onboard light kicks on and off via SmartThings and the callback let’s me then issue sequences to my LED array. FANTASTIC!

TLDR; use an ESP32 they’re just as cheap and you can do more with them.

I still find config a bit odd since the instructions to put IP/MAC in the ST app don’t work - I just do it in the IDE for the device directly and it works fine.