[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

@Vyker & @dgirard

I have implemented the “WiFi.mode(WIFI_STA);” fix in my SmartThingsESP8266WiFi.cpp file. The revised file is in my githup repository.

Thank you both for highlighting this.

I do not see a simple method to do the same thing in the WiFiEsp library (ESP01 as a WiFi shield for an Arduino). If either of you know how to do this, I am all ears!

1 Like


I am not sure about the Leonardo, as I do not have one. You could simply modify your code to use the SMartThingsWiFiEsp library and then compile it in the Arduino IDE to see how much memory and storage it reports.


Hi Dan.

I will try adding the library and see what happens



1 Like

I’m using an Arduino Mega 2560 with an Enthernet shield and I’ve just got 1 window contact sensor hooked up. When I open the serial output window in the Arduino IDE I get the correct status for open / closed for the contact sensor. However in my SmartThings IDE it always shows open and the history (Recently) shows no activity. What am I doing wrong?

The contact1 sensor is a Child device. Click on the name “contact1” and you should see the actual child device. Look at its “recently” data for the child device and you should see the data updates. You can also use the IDE’s live logging to see monitor the flow of traffic between the Arduino and ST. Also, make sure you update the Parent’s settings from within your phone’s ST App (click the gear icon) to set the IP address and port of the Arduino and the MAC address (all uppercase, no delimiters.)

I am assuming you are using my Parent_ST_Anything_Ethernet device handler, correct?

Also, it is very important that you use the standard device naming convention inside your Arduino sketch. Check out my github readme, near the bottom, for the naming convention.

You can rename the child devices from within your ST Phone App to whatever you’d like, but the names in the sketch are used by the Parent DH to create and update the child devices.

I deleted all the handlers and the devices associated with them and started over and still nothing. I downloaded the *.ino file again and updated the ip addresses and mac address and reloaded that onto the Arduino. I get the right status again in the Arduino IDE but not in SmartThings app. The part I misunderstood originally is that all I have to do is add the Parent_ST_Anything_Ethernet device and it will create the rest of the devices. I created that manually last time. However, after I added the Parent_ST_Anything_Ethernet and went into the SmartThings IDE it gave me an error and said all the fields had to be filled out and they already were. I put 1 in the buttons value and then it saved. I then changed that back to 0 since I don’t have any buttons. The devices aren’t getting created automatically, nothing happens. The only thing I was little confused by was the DNS ip address but I pulled that off my router settings so I’m sure that’s fine.

Did your create a unique MAC address for the Arduino’s W5100 shield?
Did you follow my advice to start the MAC address with “06”?
Did you assign an IP address to your Arduino that is in the same network as the rest of your home network?
Did you leave the Arduino port alone in the sketch? It is as good as any port…

Did you put your HUB’s IP address in the Arduino sketch?
Did you the leave the HUB’s port in the sketch alone for the hub? This is the same for all hubs.

Did you go into the ST Phone App, after your manually created the Parent Device, and configure the parent?
-You must enter the IP address, Port, and MAC Address of the Arduino? Copy and paste a screenshot here so I can help you troubleshoot the issue.

What does the Live Logging in the ST Web IDE show for the Parent when you change the state of the contact sensor? Copy and paste the data here so I can help you troubleshoot the issue.

What does the Arduino Serial Monitor window show? Copy and paste the data here after restarting the Arduino so I can help your troubleshoot the issue.

So I just think I figured it out. It was a bad network cable. I tried everything but replacing that. What was confusing me was the good status coming back into the serial monitor so just assumed I was making a connection. However, I finally thought about it and obviously that is coming back over the USB cable connected to the computer. I created a basic sketch to just make a network connection and report back status and it wasn’t connecting. Sorry for the rabbit trail. I’ll get your sketch loaded and then try it out again.

Well, I’m an idiot. It was the cable the whole time. As soon as I loaded the sketch again after replacing the cable the contact was loaded in the ST App. Sorry for wasting your time :frowning: and thank you for helping me out. Now I can get to hooking the rest of my contact sensors up.

1 Like

Glad to hear it is working. Let me know if you need any more assistance.

OK, solucionado :+1:

1 Like

Greetings friend;
You know the xbee reference wifi s6b maybe you can adapt to the project, look at this example https://learn.sparkfun.com/tutorials/internet-datalogging-with-arduino-and-xbee-wifi, this xbee s6b is Connects directly to a 2.4Ghz WIFI network and through the tx pins and rx communicates with an arduino to receive or send the GET or POST requests to commence with the smartthings HUB.

Thank you for your attention and I look forward to your comments.

It appears that the Xbee WiFi solution would cost ~$60 USD to simply add WiFi capability to an Arduino. The ESP01-based and WINC1500 WiFi shields are much lower cost solutions to simply adding WiFi to an Arduino, and are both already supported in ST_Anything.

I appreciate the suggestion, as I was not aware that Xbee even made a WiFi version of their board. Good to know! Thanks!

I’m trying to add a LCD display to a modified ST_Anything_Multiples_ESP8266WiFi.ino. I have a single DS18B20_Temperature sensor connected to D6. Monitor is showing “Everything: Sending: temperature1 80” and the ST app is also showing the same value. I have my LCD displaying a dummy text to prove that it too is working. Which variable contains my temp?.. I can’t seem to figure it out…
(static st::PS_DS18B20_Temperature sensor4(F(“temperature1”), 120, 0, PIN_DS18B20_Temperature_1, false, 10, 1);


The simplest way to monitor (“sniff”) the flow of traffic from ST_Anything to the ST Cloud is to implement the optional “callback()” function in your sketch as show below. This function is called everytime the ST Cloud is updated with new data from the Arduino/ESP8266. By “sniffing” this data, you can grab anything you’d like and update your LCD screen appropriately. I have uncommented a few of the lines so you can monitor the stream of data within your Arduino IDE Serial Monitor window. You simply need to parse the desired data from the correct string and update the LCD display from within this function.

//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 = "));
  //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


Just wanted to say thanks for this library! I’m new to smartthings, but this helped so much.

For the first project, I put together a garage door controller with a cheap ESP8266 relay board with one input for the door sensor. Code worked perfectly. Total cost less than $30.

Second one, I just finished up - a doorbell sensor to attach to my existing 24VAC doorbell. I used an ESP-01 board, and made a slight modification to the code so that it sends a signal on power on. The doorbell triggers a pair of transistors that allow power to the ESP-01 board so that I’m not heating up the board for no reason dropping 24VAC to 3.3VDC. There is a small delay of about 4 seconds between the doorbell press and notification from ST, but that is more than allowable. Total cost about $15.

Lastly, my house is already wired up for alarm sensors, so I’ll be setting up an UNO with ethernet shield once I finish installing my sensors.

No issues to speak of at all, just wanted to share some succes.

Thanks again!


Glad to hear ST_Anything provided you with a baseline for your projects. For you upcoming project, I recommend using an Arduino MEGA 2560 instead of an UNO. The extra RAM (8k vs 2k), the 3 extra HW Serial UARTs, and the abundance of I/O pins makes it a much more powerful platform, for very little extra cost.

I do have a Mega on hand already. I only have about 8 sensors and that will be wired in though. Is using the Mega still worth it?

If you already have an UNO and a MEGA, go ahead and try the UNO. It will probably be just fine. I just hate when users buy an UNO and then wonder why they are so constrained. That’s why I encourage the MEGA if you’re buying something.

In your case, you could also simply use 1 to 2 NodeMCU ESP8266’s to handle all Alarm Panel duties. You’ve got options!

Thanks for the advice! I’ve got all sorts of arduino everything around, including atmega328/2560 bare chips. A Due actually runs my fishtank :slight_smile:

I thought about using the ESP, but figured a wired LAN connection should be more reliable, especially since all the security wires terminate in the furnace room of my basement (where wifi signal varies), and I already have a network switch installed there.

I love your library so much, I’m basically looking for excuses to use it elsewhere and build more sensors. I’m considering ESP-01 wireless water sensors around the house that would only switch on and send a signal on detect. Batteries should last a long time that way. I figure I can design a custom board and make these for cheap enough to throw one anywhere there’s water.

1 Like