[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

Sweet, thanks! Makes much more sense now! Yes my relay pulls low to trigger. which is an issue since I plan on using this for the garage door and we occasionally have power outages. I have tried with the relay attached an it hangs on boot and also triggers the relays. No good… I plan on adding a Mosfet that on boot will be trigged after a short pause. Still in the works.

Also you have spent a bit of time on this. Do you have a donation page or something?


No donation page. I enjoy giving back to the community. Your success is my reward. (Although, I wouldn’t so “no” to new free hardware to integrate into ST_Anything! :slight_smile: If you have a new microcontroller or sensor that you’d like to see integrated, I am willing to listen!)

I am using a 2-channel relay board like the following on from Amazon. Using the exact same code I posted above, I do NOT have any cycling of the relays during an NodeMCU ESP8266 power on or reset cycle. I am powering the relay module with a constant 5V and triggering it with the GPIO pin D2 of the NodeMCU ESP8266. If you’re having issues during power on, I’d recommend trying different NodeMCU ESP8266 GPIO pins for the relay output to see if you can find one that works best for your application

I have done some research (as noted in the ReadMe) regarding the various limitations of the GPIO pins of the NodeMCU ESP8266 based boards (LoLin v3 and Amica boards.) There are definitely GPIO pins you should avoid to prevent spurious state changes during the reset/power on cycle. I believe D1, D2, D5, D6, and D7 are the safest pins to use based on my research and experimental findings. YMMV, of course.

Well thanks again for all your time. This is exactly what ST needs. I have the exact same relay board, I think I actually used a link in one of your other threads to buy it. After looking at the GPIO list I think I might be using D8, which would explain my problem.

My other projects after I get this completed are: ESP8266 with accelerometer on the washer and dryer to notify me when they are done. I have already datalogged both my washer and dryer with an Arduino UNO, next hurdle is I2C with the ESP8266. Other project is DIY motorized curtains.

Yep, D8 is not the best choice for a Active Low Logic relay board.

For my Washer and Dryer, I am using an Aeon Labs 1st Gen Power Meter with a custom Device Handler. I was able to buy a few of these for <$15 each during a sale a few months back.

And here is the custom Device Handler which sends “button pushed” events to CoRE to send my wife and me text messages each time either the washer or dryer is complete. It works very well. I tried using a SmartThings Multisensor’s accelerometer, but it wasn’t reliable. The power meter has been working great for me.

1 Like

:smiley: Dunno about the others in here, but I’d be up for reading a blog post one day about all the quirky automations you’ve got running in your house Dan.

1 Like

Interesting idea, although I really don’t have too many quirky automations actually running. I do still run an Arduino UNO + Thingshield (using very old code still) to act as a Temperature + Humidity, sensor Motion sensor, 4 door sensors, and 2 garage doors controllers. That was the project that started it all. I hope to replace the UNO/Thingshield with a NodeMCU ESP8266 in the near future as the performance is much quicker. I am hoping it is as reliable!

The washer/dryer monitoring system was something others in the community had come up with. I was planning on using an ESP8266 to monitor the power usage of each of these devices, and I had even bought a pair of clamp-on current transformers for the project. But then there was that awesome deal on the Aeon v1 power monitoring z-wave devices. It was too good a deal to pass up, and was nicely and neatly packaged already.

I have considered building a whole home power monitoring system, with each breaker in my panel being monitored independently. I just haven’t found the energy for that project :wink:

The rest of my SmartThings devices are pretty normal - GE Z-Wave switches and dimmers, a few GE Link bulbs, ST Multi sensors and motion sensors here and there throughout the house, a water sensor monitoring the Air Conditioning drip pan, a siren, etc…

I really enjoy putting the puzzle pieces together with respect to the Arduino C++ world and the physical devices, sensors, and actuators. That’s why I am always intrigued by use cases other come up with. Here are some of the things that I’ve added to ST_Anything as user requests:

  • RCSwitch (inexpensive 433MHz RF devices)
  • Adafruit Thermocouple
  • Dallas Semiconductor DS18B20
  • A paddle wheel pulse counter to measure water flow using Arduino Hardware Interrupts
  • A dimmable switch (using Arduino PWM output)

One of my other fun projects was tearing apart a Cree Connected light bulb to get its Zigbee module. I then connected this to an Arduino Nano and am able discern On/Off and 100 dim levels, each of which can be used to execute a routine on the Arduino as the user sees fit. Amazing how the NodeMCU ESP8266 modules are now so much cheaper than the light bulb + arduino hack!


Was thinking ahead to the motorized curtains, what would be the best way to go about this?
I would like to pass a value to the ESP8266 (0-100% like a dimmer?) to denote a position. The only two executor classes you have are the Alarm, and Switch, can others be added? Can you point me in the right direction?

There is a dimmer switch class as well. Look in the ST_Anything library folder and you’ll find it. Read the comments at the top of the .h or .cpp file. You will need to tweak it to run the motor.

Note: I do not believe I have created a Child Dimmer Switch Device Handler yet… if not, I should be able to create one this weekend.

1 Like

Hey Dan have you looked into the MQ2 Smoke, Gas, & CO2 sensor?

I’ll send you one for testing if needed

Got it all set up thanks!

I have a question, can you group/hide child things, like multi sensor do. (ie lux,temp,humidity only show when opening parent sensor?, not crowing up things list )

FYI I’m very novice at this stuff, but with your great instructions i was able to get this far.

Thanks again,

@Nathan909 - Nathan,

Glad to see you got it up and running! In answer to your question, YES, you can very easily hide the child devices, however you will not be able to rename them, move them to separate ‘rooms’, or delete them individually.

In order to change the behavior, simply edit the following line of code in the Parent_ST_Anything_Ethernet device handler. Modify the “isComponent: false” to be “isComponent: true” instead. Save and Publish-For Self again.

 				addChildDevice(deviceHandlerName, "${device.deviceNetworkId}-${deviceName}${deviceNumber}", null,
                	[completedSetup: true, label: "${device.displayName} ${deviceName}${deviceNumber}", 
                	isComponent: false, componentName: "${deviceName}${deviceNumber}", componentLabel: "${deviceName}${deviceNumber}"])

You will need to delete the current parent device (which will delete all of the children as well) and then manually recreate it again. Afterwards, you will only have a single device in the Things view.

1 Like


I have not looked into adding the MQ2 Smoke, Gas, & CO2 sensor. I will happily add support for it if you send me one for testing. Please private message me so we can work out the details.


@ogiewon - Hey Dan,

I am beyond thankful for all the work you have done with ST Anything! I’m just now getting the time to implement everything around the house and it has been amazing and so much easier to do everything that I’ve wanted to do now that you have written all this code!

I do have a question that is related to the Alarm Panel, but it’s not specific to just the Alarm Panel.
I’m using NodeMCU and running the contact sensors through the digital pins and its working perfectly, but I have roughly 24 sensors to attach. The previous home owners when they built the house had all windows and doors wired, but only the main doors actually hooked up to the original Alarm Panel. So lucky for me I will have every conceivable entry into my home armed and monitored!

The question is, can I use a Shift Register with my set up and get all 24 sensors running on the NodeMCU or is there going to be a limitation with the RAM on the device?

Example of a Shift Register: https://www.arduino.cc/en/Tutorial/ShiftOut

I know I can just add more arduino’s, but if possible I always try to trim down my projects to the absolute minimum needed for it to function, but for aesthetics and practical purposes…I try to keep it as clean as possible.

I will be running some tests here shortly, but just thought I’d ask for some feedback that could possibly prevent some headache in the future.

Thank you again for developing all this!

P.S. - Alot of this is over my head, but I’m learning!

I haven’t tried this my self but you may be able to use this.

If you need more analog inputs.

What am I doing wrong?

I have had 2 thingshields for almost a year and not really done anything with them. Every project I came up with other than full window open/close monitor I found hardware for sale already.

Now I am working on triggering switches in my bathroom for vent fans based on humidity (showers) and have returned to my thingshield and arduino + DHT22 sensor collection.

I have followed the directions and added the GitHub repo in to the arduino IDE I opened the sample project for ST_Anything_Temperatures.ino as that is closest to what I want to replicate.

I compiled and uploaded the project to the UNO. I seem to have forgotten something like I can’t flash with the thingshield attached or I have to move the hard switch on the shield and reset to flash? Anyway I have gotten the project loaded on to the UNO and paired the thingshield up with smartthings. I changed its device handler to the parent ST_Anything type. I have let it go for a while and I see nothing when I open the item in my smartthings “Thing” collection other than Refresh and Configure. Neither of which seem to do anyting save one of the serial comms LED’s flashed on the arduino. Their are no sensors connected to the arduino as I only have the 3 DHT 22’s and not the thermocouples anyway.

As I understand it child objects should automatically be added by what is defined in the arduino project but I don’t see that happening. No tiles, I added buttons, nothing happens. I am wondering what i am missing?

The ST_Anything_Temperatures.ino sketch is located in the deprecated folder for a reason… :slight_smile: Those sketches are old examples that pre-date the new Parent/Child Device handlers.

Please start with the new ST_Anything_Multiples_Thingshield.ino sketch. Just comment out all of the extra sensors/devices in the setup() routine other than the DHT22 sensor.

This sketch will then work as expected and auto create the child Temperature and Humidity devices.

I understand the request, however I do not have any plans currently to extend the I/O capabilities of the NodeMCU ESP8266 boards beyond what they have onboard. Adding in an I/O expander might be a good future enhancement. Or perhaps, the newer ESP32 will provide a higher GPIO count?

For now, I’d recommend you wire the various window sensors in series to create a traditional alarm zone. If any of the sensors wired together in series are “opened” then that zone will report as such. This allows you to dramatically reduce your I/O pin requirements.

Another option would be to add multiple ESP8266’s to handle everything. They are inexpensive, but they could get a little crowded.

Or, if you could hard wire some Cat5 Ethernet to your panel, an Arduino MEGA + W5100 or W5500 shield would provide you with 54 Digital and 16 Analog IO pins to choose from.

Lol and there you go… Im doing it wrong :smiley: Will test out in a bit

1 Like


I fell victim to manually deleting child devices and having errors, basically breaking the entire parent/children devices. Google then led me back to this post warning us about this issue.

There may be a work around to this issue. I was able to avoid deleting the parent device by going to the “set-up” (gear in the upper right of ST app), then (without having to make any chances) just clicking “Done”. This ran an update and I was again seeing data flowing. In order to add the children devices back I hit “configure” and all was well.

Perhaps someone else can confirm this work. Not sure if its relevant, but before I did this I had already deleted all the children devices manually…


Update: I moved the slider on the thingshield to D2/D3 and I have data now? The really wierd part is I have tried this for over 2 hours and slid that switch a few times already so why it works now I don’t know.

ogiewon, Thanks for posting above. However, I’m still not having any luck.

Again, I have imported the github repository in to my arduino IDE (1.8.3)

I am now using the Multiples_Thingshield project. I commecnted ALL sensors save the first temp/humidity one. I commented all executors and sensor pins (except TEMP1).

I set TX and RX pins to 2 and 3 and the DHT22 at pin 7 for my Arduino UNO R3

This is the output in the serial monitor:
Everything: init started
Everything: Free RAM = 735
Everything: init ended
Everything: Free RAM = 735
Everything: adding sensor named temphumid1
Everything: Free RAM = 735
Everything: initDevices started
Everything: Free RAM = 735
Everything: Sending: temperature1 74
Everything: Sending: humidity1 47
Everything: initDevices ended
Everything: Free RAM = 735

So the code is running and pulling data from the sensor just fine. I paired it with smartthings and it shows up in the Thing list. I went to the Smartthings IDE website and changed the device handler for the new “Thing” to the Parent_ST_Anything_Thingshield.

When I l enter the “Thing” on the phone GUI I only see the refresh and configure buttons, nothing else. If there is a better doc to follow instructions on let me know. I read the repo instructions and followed them.