[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

I didnt read all the details, but regarding pins 7 and 8 it could be for two reasons as far as i know:

  1. They are 24hs zones
  2. They are emergency zones (Normal Open)

I think you have them as emergency zones, so you should invert the states on the arduino side.

Again, im not fully sure, but you can try that.

The emergency part makes sense; zone 7 was listed on the control panel as ‘wireless panic button’ and 8 was ‘smoke detectors/fire’

I was able to get them wired in and with some google-fu and determination got the capabilitySmoke part figured out and coded in properly. Even made my own virtual device using the virtual contact sensor as a template… then I found that my smoke detectors A: have no test function, B: are so old that the only way to shut them up is to remove power after they go off. Since they are hard wired and the arduino isn’t plugged into that, there’s no way to do it - so I’m just going to skip those parts. I’m still interested in the glass shatter sensors though.

I finally finished my other ST project, so I got an ESP-12 up and running. I have come across a couple issues. The first was that I could not enter the configuration using the ST App under configuration. I entered the IP, Port, MAC, but the ST App kept giving me any error that not all required fields had data. Just in case anyone else has this issue: I just went into ST development development area for the Device, and chose Edit were one can manually enter the fields. This worked.
The second issue I’m still looking at is that the motion sensor continues to toggle from Motion to Non-Motion:
Everything: Sending: motion inactive
ST_Anything Callback: Sniffed data = motion inactive
Everything: Sending: motion active
ST_Anything Callback: Sniffed data = motion active
This never stops and happens ever few seconds. I have swapped out motion sensors with no change. I’m going to look at some debug to see if motion is really detecting something. When I unplug the Pin, I still get “Everything: Sending: motion active.” Everything appears to be setting motion active before actually looking at the status of sensor. Just wondering if anyone has successfully used the Motion sensor with the ESP8266?


Glad to hear you’re making progress using the ESP-12. As for the motion detector, please rfer to the documentation in the head of both the IS_Motion.h and .cpp files for the explanation of the constructor arguments used you your sketch’s setup() routine. You may need to reverse logic depending on your type of motion detector. I was using a typical Arduino PIR motion sensor which provides either a GND or +5V signal on the digital input pin. Therefore, in my example sketches, I do not use the Internal Pull-Up resistor. Also, my IS_Motion device assumes your motion detector outputs a continuous voltage for “active” or “inactive”, not a pulsing square wave when active. Some PIR sensors (like the ones I have used) have a jumper on them that adjusts this behavior.

Here is the comment section with the constructor arguments specifics.

//			  st::IS_Motion() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- byte pin - REQUIRED - the Arduino Pin to be used as a digital output
//				- bool iState - OPTIONAL - LOW or HIGH - determines which value indicates the interrupt is true
//				- bool internalPullup - OPTIONAL - true == INTERNAL_PULLUP
//				- long numReqCounts - OPTIONAL - number of counts before changing state of input (prevent false alarms)

Thanks! I will look into these areas. (I still have to get my head around it sending motion when the PIR is not even connected.) I forgot to mention that this is a typical Arduino PIR motion sensor with the second one pulled off an Arduino running the original ST_Anything.
I also got the OneWire thermometer working and am now testing how the contact sensor works as a crude H20 flood sensor (running the two wires to the ground should short/close when water is present.)

Since I need to use the Arduino (Mega) for another project, I’m going to get it running with the ESP-01 and then see how that configuration works with the PIR which should help in the debug process.

Thank you so much! Your ST_Anything v2.1 update is a lifesaver!

I was just boarding a plane from San Francisco to New Zealand when I got a text from my ST_Anything v1.x Proximity switch that my garage door was unlocked! Luckily I had time to call a neighbor to check that the door was actually locked before I had to put my phone on Airplane Mode, but boy, what a worry! Apparently the latest SmartThings Hub update caused my custom ST_Anything device to fail, and only on return to USA did I discover that hardware and software support for the ThingShield had been removed, incredibly with no warning from SmartThings :frowning:

Today I updated my ThingShield device code using the new ST_Anything v2.1 library and sample code, and my garage door lock indicator is working again. SmartThings should recognize your outstanding work and the value of open-source development for their platform.

Scott - Glad to hear v2.1 was able to help get your system back up and running!

Hello I’m a real novice at this could someone help me please Could someone please advise me on how to set this up I have the St hub so do I need a bridge still for arduino I am planning to control some sonoff dual devices with tasmota on github ? Will I need a device handler setup etc.
Please be gentle on me many thanks

I have never tried to load my ST_Anything project on a SONOFF Dual relay device (because I do not have any SONOFF devices!) Since it is just an ESP8266 based board that can be flashed with your own firmware, ST_Anything_ESP8266WiFi.ino (with modifications to only create 2 ‘switch’ devices, of course) should run on it, but no guarantees.

Here is a tutorial put together by another ST user which shows exactly how to integrate a SONOFF with ST (albeit without ST_Anything :frowning: ) Still, he does a nice job with a detailed Youtube video. This may be the easiest route.

Since you mention you’re a novice, I recommend you buy a NodeMCU V1.0 ESP8266-12e board, a large breadboard, jumpers, some LEDs, and some buttons to create a small system to play around with. This will help you get a good understanding or basic circuits with no soldering required.

Here is the board I use, which can be programmed with just a standard USB cable…

1 Like

Thanks for that I don’t think I explained myself properly I have already flashed sonoff devices with Eric’s tutorial which work great by the why.The problem I have is I want to be able to control sonoff dual and 4 channel devices but Eric’s tutorial doesn’t cover these devices. What I needed to know if I flash my dual with the arduino hack I will be able to alter the tasmodo program for each device I’m just not sure how to link it to ST ? So I will be able to control it in action tiles dash as well .


It is probably possible to use my ST_Anything library to reflash a Sonoff device, since they are simply just an ESP8266 chip attached to a relay form factor circuit board. However, my library is completely standalone and will not work the tasmodo program.

If you implement it as a complete ST_Anything solution, it should work fine. Please know that you’ll be in for some fun coding work to make it work per your requirements. My solution is designed to be an example that you use as a starting point to build your own custom Arduino/ESP8266 solution integrated with SmartThings.

In the past, others have successfully implemented 16 channel relay solutions using my ST_Anything library. It can be done!

I do not have any Sonoff devices to test with, otherwise I’d consider developing a sketch, device handler, and multiplexer smartapp for these devices.


ogiewon, did you ever have any luck in adding neopixel support to ST_Anything?? I’m so excited to see someone else with interest in adding neopixel support to smartthings. I’ve been looking into this for months, but unfortunately I don’t have the programming experience needed to write code for smartthings.

The esp8266 is certainly able to control neopixels/ws2812b LEDs. I’ve used the two together in many projects, but sadly, I’ve found no way to incorporate them into smartthings without someone with more coding experience doing the heavy lifting. The uses for controlled neopixels around the house are endless!

From my experience, code for neopixels on arduinos is run perfectly fine on an esp8266 without any modifications. If you have experience with those neopixels being run off of an arduino, the same code and library use would apply. It would seem that you would need a device handler/smartthings code that would interpret tiles/color settings/on or off/brightness inputs from the smartthings app into the corresponding library call of the neopixels library on the esp8266.

I’m pretty well versed in neopixels, so if you need someone to test your projects, let me know!

I have not spent any time working on Neopixels integration with ST_Anything yet. I’ll eventually get around to it. Can you explain what features you’d like see? Obviously On/Off/Dim/RGB… right? What about cool effects? These effects would need to be preprogrammed into the Arduino/ESP8266.

Hello again as you now this is all very new to me so I have a question would this arduino program work directly with your any thing ST program if I flash my dual with this
http://github.com/marvinroger/arduino-sonoff-dual many thanks

No, that is a completely standalone app/firmware for the SONOFF Dual Relay device. It looks like the author intends for it to be used as a starting point/library for programming a Dual Sonoff device via the Arduino IDE.

It is not compatible, in its current state, with my ST_Anything library/examples.

Again, you’re going to need to learn to do some programming if you want ST_Anything to work on the Sonoff.

Or, ship me a Sonoff Dual relay and I’ll see what I can do. :slight_smile:

Ok dan thanks again looks like a big learning curve coming on

Why not ask @erocm1231 Eric to simply add support for the Dual/Quad Relay Sonoff devices? That would probably be the quickest solution and you’d have a decent support group of users who are all using Eric’s solution.

I actually just got the 4 channel and have had a dual for a while. I just need a good hour or two to whip something up.

Edit: and by “a good hour or two” I mean a free good hour or two. :slight_smile: But seriously I will try to get them done this week.

1 Like


Thanks for the quick reply! Glad to hear you’re working on these devices as I really don’t have the time to try to help @Mickw currently.


Does this sounds like a workable solution?


Yes guys thankyou just a bit impatient as I have a project on that requires the dual and 4 channel sonoff units to automate the full house but being a novice doesn’t help again sorry for the hurry keep up the great work you guys do