[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

yeah its Android.
Its not a problem like i say it lets me edit it through the SmartThings website

1 Like

Iā€™m also looking for neopixel (ws2812b) support, the most basic would be color/brightness, but having a few buttons for preset modes (from the WS2812FX library as an example) would be awesome. Iā€™m willing to test anything you need, I tried looking a the code to work on it myself but got lost pretty quick!

Yeahā€¦still nothing thatā€™s compatible with SmartThings. The closest thing Iā€™ve been able to find is a program called McLighting. It has MQTT and Homeassistant support but I just canā€™t find the time to learn either of them to be able to use. What it does have though is control through a REST API. So, you can control it through simple web calls. Iā€™ve been using it in conjunction with webCoRE for a while now.

I worked for hours (30+) trying to get ST_Anything to work with programmable LEDs using the standard NeoPixel libraries. Long story short I couldnā€™t get it to work reliably on either a ESP32 or ESP8266. For small strands (less then 30 leds) it was ok but more and the controller would reboot due to a watchdog timer issue caused by the library blocking calls until it was done. Turns out programmable LEDs are extremely time sensitive so they block the controller from doing anything else until they are done which most controllers donā€™t appreciate. I tried using the FastLed library which purposely has programming to get around this limitation but I couldnā€™t get it integrated into ST_Anything like I could with the NeoPixels library.

I started work on a simple DTH that just makes HTTP calls to a ESP8266 running McLighting or FastLed but didnā€™t get very far. I still have the framework DTH if someone more experienced wants to give it a try. It would be nice to have it built into ST_Anything so you can use the same controller for other stuff but with the cost of a ESP8266 being like $10 it might be easier to just have one dedicated to this.

If anyone wants to play with the code I have the .cpp, .h, and DTH saved to my GitHub.

Itā€™s not so much having another board. I just want to be able to turn a switch off and turn off the LEDs rather than having to have a rule tied to a virtual switch andā€¦ You know all thatā€™s entailed. Itā€™s just a pain. Plus, when I use them for notifications (fading in a certain color), I have to run a webcall to find out what the current settings are, store that, then do the notification, then set it back again. Itā€™s a REAL pain. I got it to work well with McLighting but I need one piston per strip. And it doesnā€™t work at all from Hubitat. So, a native DTH would be much nicer. I saw your DTHā€¦ I couldnā€™t find the sketch for the ESP that went with it though.

My libraries are in here. EX_RGBAddressable_dim.cpp and .h: https://github.com/vseven/SmartThings_VSeven/tree/master/Modified_ST_Anything_Libraries. There is also a 8266 sketch in the same directory that I sent to a couple people to test which all had the same results as me. Need to have the ā€œNeoPixelā€ library installed for it to compile.

Thanks a bunch.

NP, last I remember it should compile and ā€œworkā€. For testing I told the sketch its just a standard RGBSwitch so it would use the existing DTH (so the ST_Anything parent device wouldnā€™t need to be modified for testing). Test it with LEDs set to like 15 and see if it works and increase until it fails.

Like I said the ā€œFastLEDā€ library should get around the issues but I couldnā€™t get the code formatted properly to include that library. The NeoPixel library was relatively easy to include.

Also: https://github.com/DanielOgorchock/ST_Anything/issues/103 and you might want to try this NeoPixel library in place of the stock one: https://github.com/Makuna/NeoPixelBus Iā€™m hoping nothing in my code would have to change to test that as youā€™d just change the reference.

1 Like

That should actually work perfectly actually. Iā€™m trying to encoporate a 16 light strip to do some under cabinet lighting but could easily shorten it to 15. Iā€™ll let you know if Iā€™m able to get it to work.
Thanks!

2 Likes

Hiya.
I did this sketch last week which worked great (DHT21)
But I wanted to test the board with 2 sensors attached on another sketch and that seemed to work fine but I decided to go back to how it was.
So I reloaded your sketch and like last time it created 6 child devices 3 for temp and 3 for humidity with one from each being the working one so I renamed them.
But as soon as I delete any of the other extra child devices the working ones stop working for some reason.
Have you had this issue before ?
Its didnā€™t do this last week when I deleted the extra devices, Do you know why its creating 6 devices for 2 sensors ?
Thanks

Iā€™ve had the same issue with my DTH22 sensors. It seems it only started happening in the last month or two. I just waited about 10 minutes and then went into each one and looked for ones that hadnā€™t updated since 10 minutes ago and deleted those. The remaining actual sensors all have been working fine.

Yeah thatā€™s what Iā€™ve done , I set it back up again yesterday and left them running all night and deleted the ones not working but still nothing :thinking:
Iā€™ll try it again.
Cheers

I might be over thinking this but how do you trigger the Interrupt contact sensor using logic from within the Arduino?

Say every 5 seconds contact sensor 1 reports closed, then the next 10 seconds it reports open, continuously.

If I understand your question correctlyā€¦ If you have a digital input (i.e. a contact sensor) that is changing states every 15 seconds (open for 5 seconds, closed for 10 seconds) repeatedly, ST_Anything will send an update to the ST Cloud for every ā€˜openā€™ and ā€˜closedā€™ event that occurs.

This is a very high frequency of data, compared to a normal door or window sensor. May I ask what device you are connecting that will be generating this kind of data? How do you plan to use these events within SmartThings? Knowing this, I might be able to provide you with a recommended application design that generates a lot less traffic.

Hi @ogiewon or anyone else who may know.
Iā€™m struggling here with the child devices working.
I started last week with a DHT21 that worked fine for a while but then suddenly stopped working.
So today I flashed with a different Nodemcu board and a new DHT22 sensor and on the serial monitor it is reporting T&H great and then when I add the parent device 8 child devices appear 4 for Temp 4 for Humidity.
And out of the 8 two sensors carry on reporting readings fine.
But the second I make any changes to any of them like deleting or changing F to C all of them stop reporting within smartthings.
But they still carry on reporting through the serial monitor thatā€™s connected.
Do you have any ideas what might be causing it?
Thanks

You should be able to see Errors in the Live Logging tab of the ST Web IDE.

Unfortunately, this appears to be some sort of SmartThings Cloud Backend issue. How frequently do you have the polling for the DHT22 set to? It seems like the ST Cloud is not telling the parent that a child already exists, so the parent creates it again, and again, and againā€¦ In the past, I have seen this occur, but only one duplicate. You can usually delete the child device(s) that is not receiving updates, and the other one still works. If not, then you have to delete the parent and manually add it again. I would change the polling interval to something like every 300 seconds in to order to let ST try to catch up and prevent the race condition. Once you get just one temperature and one humidity child created, you can modify the sketch to change the polling interval to something like 120 or 60 seconds for faster responsiveness.

I have moved all of my home over to run on Hubitat, where I have never seen this issue occur. Definitely seems to be an issue with the ST backend servers/database.

Thanks again @ogiewon
sometimes its the simplest things,
i deleted the parent app like you suggested and re created it and it worked normally then.
before i was just deleting the mac address and re saving.
Glad to have it back working
cheers

1 Like

New ST Anything user here. Awesome stuff BTW. ESP32 with pressure sensor on ADC. I am getting voltage readings just fine in ST and all working. However, I am trying to set thresholds for those readings and then send push notifications (for now). My initial thought was to create some sort of virtual switch that references no actual digital pin and is just turned on/off with if statements based on the range. This in turn would drive standard ST SmartApp Safety and Security - Notify Me When Button Pushed alerts. Is this the best way? How can I get the logic set up in the sketch? Iā€™ve got WebCore installed in ST, and I guess I could just revert to writing code there, but Iā€™d rather not unless thatā€™s best. TIA!

So, I would just change
#include <Adafruit_NeoPixel.h>
to be
#include <NeoPixelBus.h>
correct?
Because I get an error while compiling after making that change. And the Adafruit neopixel library didnā€™t work either.

Dan,

I would like to do a little project that would involve an ESP8266 with a PIR sensor and battery. Very similar to this project Deep Sleep mode with PIR wake up
In order to do this, the esp would have to wake up for any movement, connect to wifi (If the connection fails the module should try to connect 10 times.) report, than back to sleep to avoid draining the battery.

Would this be possible with ST_Anything?