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


(Dan) #2267

Are you sure the baud rate is the same on the ESP01 and within the ST_Anything sketch?

(cslee) #2268

Here’s the baudrate I set for Serial1. I think it’s correct.

//Initialize the Serial1 baudrate to match your ESP-01’s baud rate (e.g. 9600, 57600, 115200)

//Run the Everything class’ init() routine which establishes Ethernet communications with the SmartThings Hub

Additionally, If I swap tx/rx, I will say It cannot initialize ESP-01

(Allan) #2269

This is just a general FYI for anyone that still needs to buy a controller. With the latest firmware the ESP32 has been rock solid for me and doesn’t suffer some of the wifi issues it used to have. I know there is “catchall” code in ST_anything to reboot the controller when it has continuous WiFi issues but mine hasn’t rebooted since I upgraded firmware on my access points which was over a month ago. Well worth the $13 or whatever they sell for.

(Steve ) #2270

Hi, I’ve been watching this thread for a while wanting to try and do it but I think I’m going to give it a go.
At the moment I’m using a SonoffTH with a AM2301 temp & humidity sensor for measuring my son’s Vivarium but it’s being so unreliable (some bug with the code apparently)
So want to try and achieve the same setup through here.
Am I right in thinking all I need to get started is a Arduino board or Esp board and a WiFi module or is it best to get one with WiFi built in?
Also can i still use my AM2301 sensors and just cut off the plug-in connector to be able to solder.
Sorry for all the daft questions just don’t want to get the very basics wrong I’m sure I’ll be able to get it running ok once I have them in front of me.

(Dan) #2271

You’ll want to pick up a NodeMCU ESP8266 as they work very reliably and have built-in WiFi. In fact, your Sonoff also uses a ESP8266 based microcontroller. These are the boards I use.

Probably? But I have not tested ST_Anything with that particular sensor. Based on this website, https://playground.arduino.cc/Main/DHTLib, the AM2301 is just a DHT21 sensor. I use Rob Tillaart’s DHTStable Arduino library behind the scenes in ST_Anything. So, it should just work if you declare the device as follows:

st::PS_TemperatureHumidity sensor1(F("temphumid1"), 120, 7, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT21, "temperature1", "humidity1", false);

(Steve ) #2272

Thanks for the reply Dan.
Luckily the NodeMcu boards are the ones i ordered earlier.
Can you remember which temp and humidity sensors are the most reliable as I may buy some more anyway, just something that’s most compatible.
Thanks for the info.

(Dan) #2273

That’s a very good question… The DHT22’s are what I have used mostly. Sometimes they are reliable, sometimes they are a little flakey.

I recently added support for some I2C sensors. They seem to be pretty reliable. I am using a AM2320 I2C sensor in my attic and it has been very reliable. It also looks alot like a DHT22 or your AM2301, as I believe they are all made by the same company.

I also added support for the BME280 I2C sensor, which does Temp and Humidity (and Barometric Pressure).

(Steve ) #2274

Thanks for that might get 1 of each to compare.
Problem with my son’s Vivarium is it has different humidity levels throughout so I thought about putting 2 in and getting a average.

(Fraser Wallace) #2275

Thanks Ogiewon, I have successfully built my master garage controller with 2 sonar presence sensors and 2 door controllers on a Nodemcu 12E. After trying all sorts of dumb mistakes everything is working fine. I was so pleased I knocked up a temperature, motion, door sensor on an ESP8266 from bits and pieces laying around on my desk.
Thanks again for all your work and time developing and helping.

(Robert Linnaeus) #2276

Hi All,

I just wanted to take a quick opportunity to recomend the particle photon to anyone looking for a WiFi dev board. I’ve used quite a few and this is my favorite by far. Particle offers a cloud based IDE, API service layer, and monitoring console. Ontop of that it is pretty easy to write an DTH that communicates via restful API calls, or integrate via IFTTT (for which there is direct support).

If anyone has a good zigbee or zwave dev board that costs $20 or less I would really like to hear about it! I’ve tried a couple zigbee devices and they were a major pain.

(Steve ) #2277

Hi @ogiewon
Sorry for the very basic question this is my very first venture into Arduino IDE.
I’ve been following your readme’s and i’m uncommenting the wrong section and cant figure it out and am getting a error.
Thanks i’ll try not to ask any more noob questions lol
Here’s a screenshot

(Dan) #2278

It appears that you accidentally ‘uncommented a comment’ on the line below the pink highlighted one in your image above.

it should read

const unsigned int hubPort = 39500;  //smartthings hub port

If you were using Hubitat, instead of SmartThings, you would comment out the line above and uncomment the line immediately below it.

(Steve ) #2279

Thanks it seemed to flash ok.
I forgot to turn on the window monitor to find the Mac address so need to do it again, bit late here now (UK)

(cslee) #2280

I got a new ESP-01 which is not “AI_thinker” but it works. However, I have to set the BAUDRATE to 115200 as I cant change the BAUDRATE of this ESP-01 with AT+CIOBAUD. It does not recognize the command. Lets see if it’s stable at this BAUD.

(cslee) #2281

As I have now got the ESP-01 to work, now I want to add my stuff to the ST_Anything sketch.

I tried this but it wont compile. If I comment out either my code or the
st::Everything::run(); , it will compile but not with both.

Any suggestion?

//Arduino Loop() routine
void loop()
//Execute the Everything run method which takes care of “Everything”

for (i=0; i < NumberStations; i=i+1){
scanbutton (i);
if (B[i] != oldB[i]) {
   progRelays (i, B[i]);
   oldB[i] = B[i];
delay (100);



(Dan) #2282

First things first… please do not ever add a delay() statement in the sketch, or any files you include in the sketch. delay() blocks execution and prevents the timely servicing of the networking and other ST_Anything functionality, like polling/scanning I/O for changes.

Second, what are you trying to do, exactly? If you’re trying to add manual pushbuttons or switches to have local control of outputs, please refer to one of my example sketches, like ST_Anything_Relays_Buttons_ESP8266.ino to see one safe method of adding local control capabilities. You will see in this example that ST_Anything is still handling changes to the digital outputs/relays, in a way that ensures SmartThings is kept up to date. You should never directly change any GPIO pins in the loop() as ST_Anything and SmartThings will not be aware of those changes.

Note: The example sketch I referenced above is for the ESP8266… You will need to copy/paste the pertinent code from this example sketch to your Arduino MEGA/ESPWiFi sketch. Also, the example assumes a pushbutton input to toggle the output. If you is not desired, you will simply need to modify the logic from a toggle, to on/off based on the input pin.

(Ocelotl) #2283

Hello I’m trying use a Wemos D1 Mini to control 2 garage doors with the DoorControl library. I was able to successfully flash it. All the wiring seems solid and I check for continuity and everything seems to be in working order.

The issue I’m having seems to be in the Smartthings IDE. I followed the instructions for this and Child one was always OPEN even when the Sensor was clearly closed. I also tried different pins and different sensors and it was always showing as open. The only time it worked was when I got a duplicate of that Child and I then deleted the malfunctioning Child. I deleted the Parent to see if it would work fine after adding it again, but this time I don’t get any Childs. I’m not sure what to do now other than try another Wemos D1, do you know why this would be happening?


(Steve ) #2284

Hi sorry i really am being thick
i can’t figure out how to declare the device and the pin configuration,
i thought i just added it in and commented out the other ones.
I’ve been trying to google before asking but can’t see anything specific to help.

Arduino: 1.8.7 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
This is the error

C:\Users\Steve\Documents\Arduino\Sketches\ST_Anything_I2C_ESP8266WiFi\ST_Anything_I2C_ESP8266WiFi.ino: In function 'void setup()':

ST_Anything_I2C_ESP8266WiFi:155:71: error: 'PIN_TEMPERATUREHUMIDITY' was not declared in this scope

    static st::PS_TemperatureHumidity sensor1(F("temphumid1"), 120, 7, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT21, "temperature1", "humidity1", false);


ST_Anything_I2C_ESP8266WiFi:194:30: error: 'sensor3' was not declared in this scope



ST_Anything_I2C_ESP8266WiFi:195:30: error: 'sensor4' was not declared in this scope



ST_Anything_I2C_ESP8266WiFi:196:30: error: 'sensor5' was not declared in this scope



ST_Anything_I2C_ESP8266WiFi:197:30: error: 'sensor6' was not declared in this scope



ST_Anything_I2C_ESP8266WiFi:198:30: error: 'sensor7' was not declared in this scope



Multiple libraries were found for "Servo.h"
 Used: C:\Users\Steve\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\Servo
 Not used: C:\Program Files\Arduino\libraries\Servo
exit status 1
'PIN_TEMPERATUREHUMIDITY' was not declared in this scope

(Dan) #2285

The Wemos D1 is fine. Sometime, ST cloud back end creates a duplicate child device that is useless and must manually be deleted. This can get a little frustrating until everything works properly. After that, I’ve never had the problem come back again. It just needs a good clean start. If your new Parent does not create children, it is a problem with the settings of the parent device. After getting those settings saved, a REFRESH command is sent to your Wemos D1 board to send status updates for all of the devices you’ve defined. You can also manually press REFRESH in the Parent Device.

(Dan) #2286

You’ve got the basic idea… however, a little further down in the setup() routine, you will see where each of the devices you’ve defined are added to “Everything” object… This list must match the devices that you created earlier in the setup() routine. So, if you comment an example device out, you must comment it out here as well.

  //Add each sensor to the "Everything" Class
  //Add each executor to the "Everything" Class