[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Unfortunately, there is nothing like that in ST_Anything. You could build your own using an EX_Switch as an example. Just change the normal GPIO calls for your serial communication calls.

Nothing like this on ST_Anything (yet at least), but I just took the generic ST_Everything code and built a basic sensor out of it.

Shouldnā€™t be too hard. Just define how you are inputting the serial, interpret on the device (if needed), and then do actions based on that to your device.

Wellā€¦ as usual it was something really dumb. A stray stranded wire made an intermittent connection between GND and one of the digital ins on a shield. The behavior is not directly explainable, but the problem is gone. [for now] Thanks for verifying that there was not some other kind of outage or change. Helped me to narrow the problem down to hardware.

1 Like

Glad to hear itā€™s working!

I have an application that requires 6 digital inputs and 6 digital outputs. For implementing this on an ESP32 which pins can I use? Does anyone have a link to a drawing that shows this.? How many extra pins would I have left over for future expansion?

No Idea what board you have. But google does.
https://www.google.com/search?q=esp32+pinout&newwindow=1&rlz=1C1GGRV_enUS751US752&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjms4PcuOrvAhWOr54KHRZRCtUQ_AUoAXoECAEQAw&biw=1600&bih=757

1 Like

Thank you kampto.

I recently converted one of my ST_Anything projects from an Arduino MEGA to an ESP32 DevKit C board. Here are some notes I made regarding which pins are usable. YMMV, of course, especially depending on which specific hardware board youā€™re using.

//Safe Digital Inputs & Outputs
#define PIN_GPIO2     2  //Connected to onboard LED
#define PIN_GPIO4     4 
#define PIN_GPIO16   16  //Only available on WROOM module, not WROVER
#define PIN_GPIO17   17  //Only available on WROOM module, not WROVER
#define PIN_GPIO18   18
#define PIN_GPIO19   19
#define PIN_GPIO21   21
#define PIN_GPIO22   22
#define PIN_GPIO23   23
#define PIN_GPIO25   25
#define PIN_GPIO26   26
#define PIN_GPIO27   27
#define PIN_GPIO32   32
#define PIN_GPIO33   33

//See https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ for other pins

//Digital Input Only (no Digital Output support) - Note: No internal pullup or pulldown resistors
#define PIN_GPIO34   34
#define PIN_GPIO35   35
#define PIN_GPIO36   36
#define PIN_GPIO39   39

Thank you ogiewon

1 Like

I would highly suggest switching over to an esp32 if youā€™re going to do rgbw strips. The RGBW libraries I wrote will let you do up to 8 programmable strips per controller

Thanks for the tip. Iā€™ll go look into this. Biggest issue right now is trying to figure out how to power 12v stripsā€¦ Had to order some 12v connectors and such to play with.

Yeah, I spent a lot of time getting the NeoPixelBus library implemented. It will let you do multiple different types of strips on the same controller. You can use a 8266 also, it will work, but you can only use one programmable strip per controller.

ESP8266 example: ST_Anything/ST_Anything_NeoPixelBus_ESP8266WiFi.ino at master Ā· DanielOgorchock/ST_Anything Ā· GitHub

ESP32 example: ST_Anything/ST_Anything_NeoPixelBus_ESP32WiFi.ino at master Ā· DanielOgorchock/ST_Anything Ā· GitHub

NeoPixels are 5v but the same best practices apply to 12v programmable LED strips: Best Practices | Adafruit NeoPixel Ɯberguide | Adafruit Learning System

But donā€™t use the NeoPixel librariesā€¦they are garbage and crash the controller when using more then about 25 LEDā€™s with ST_Anything. NeoPixelBus is a lot more stable, Iā€™ve used it for a 300 LED strip and a 150 LED strip on the same ESP32 without issues.

1 Like

Iā€™m trying to get a NodeMCU ESP8266 working using a Mac with BigSur. Iā€™m a newbee so I started with an Arduino sketch to blink an LED. Eventually I wanted to connect my ADT alarm system to SmartThings using ST_Anything. However I was not able to get this blinking light sketch working. I have the latest Arduino IDE. I think I have other software that I need but Iā€™m not sure they are located in the right directories. Any help or links would be appreciated.

Iā€™m using an ESP32 as a current sensor and Iā€™m getting this error

[E][WiFiClient.cpp:258] connect(): socket error on fd 56, errno: 113, ā€œSoftware caused connection abortā€

Everything seems to be working though, should I be concerned about this error, or does anyone have any idea how to get rid of it

Hello - I have colored pool lights that the color is selected by ā€œpulsingā€ a normal switch a set number of times (up to 12). For example to get green - you would turn off and on the 120V source 9 times, for red it is 10 times, etc. The old controller failed many years ago and I replaced with a zwave switch that I turned on and off with an automation. That worked great with Homeseer, I have since left homeseer for smarthings (for a number of other reasons) which I like more, BUT I cannot get the same level of reliability with a similar automation in Smartthings or Webcore, not sure why, but Iā€™m moving on to a possible arduino solution - where the timing is set by the arduino and I just need a simple numerical command sent to the arduino from smartthings. I have experience with arduinos and would probably use an ESP8266 and a relay to pulse the 120. Is there a simple solution with ST_Anything?

The one quick and easy way I can think to accomplish this is to use the ST_Anything S_TimedRelay device, which is designed to pulse an output.

Here is the documentation for this particular device

//******************************************************************************************
//  File: S_TimedRelay.cpp
//  Authors: Dan G Ogorchock
//
//  Summary:  S_TimedRelay is a class which implements the SmartThings "Relay" device capability.  It features
//			  an automatic-turn-off time delay for a relay to emulate a button press.
//
//			  It inherits from the st::Sensor class and clones much from the st::Executor Class
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::S_TimedRelay sensor1(F("relaySwitch1"), PIN_RELAY, LOW, true, 1000, 0, 1, 0);
//
//			  st::S_TimedRelay() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- byte pinOutput - REQUIRED - the Arduino Pin to be used as a digital output
//				- bool startingState - REQUIRED - the value desired for the initial state of the switch.  LOW = "off", HIGH = "on"
//				- bool invertLogic - REQUIRED - determines whether the Arduino Digital Ouput should use inverted logic
//				- long onTime - REQUIRED - the number of milliseconds to keep the output on, DEFAULTS to 1000 milliseconds
//				- long offTime - OPTIONAL - the number of milliseconds to keep the output off, DEFAULTS to 0
//				- int numCycles - OPTIONAL - the number of times to repeat the on/off cycle, DEFAULTS to 1
//              - byte finalState - OPTIONAL - leave in X state after finishing sequence 0 = off, 1 = on , Defaults to 0

So, if you wanted to, you could pretty easily create 12 of these devices, all of which control the same digital output/relay, but each with their own specific number of cycles as shown below. These will each show up in ST as a separate device, which you should be able to rename from within the ST Mobile App to represent each color. Do not change the naming scheme shown in the code below, as that is critical to how ST_Anythingā€™s Parent DTH groovy code works. :wink:

As you can see, the output is held high for 500ms and then low for 500ms (please change as you see fit), for a specific number of cycles, based on the arguments for each object declaration.

static st::S_TimedRelay           sensor1(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 500, 0, 1);
static st::S_TimedRelay           sensor2(F("relaySwitch2"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 2);
static st::S_TimedRelay           sensor3(F("relaySwitch3"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 3);
static st::S_TimedRelay           sensor4(F("relaySwitch4"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 4);
static st::S_TimedRelay           sensor5(F("relaySwitch5"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 5);
static st::S_TimedRelay           sensor6(F("relaySwitch6"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 6);
static st::S_TimedRelay           sensor7(F("relaySwitch7"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 7);
static st::S_TimedRelay           sensor8(F("relaySwitch8"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 8);
static st::S_TimedRelay           sensor9(F("relaySwitch9"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 9);
static st::S_TimedRelay           sensor10(F("relaySwitch10"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 10);
static st::S_TimedRelay           sensor11(F("relaySwitch11"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 11);
static st::S_TimedRelay           sensor12(F("relaySwitch12"), PIN_TIMEDRELAY_1, LOW, false, 500, 500, 12);

Hope this helps! Good luck!

Sounds perfect and thanks for the quick reply, going to bench test this week!!!

1 Like

Hi there everyone.

I am trying to get a ESP8266 ESP-12F Board to control a strip of about 69 LEDs. May be more or less in the future if I can get this going.

Currently, the device is running an old LED Strip program using FastLED libraries which is controlled through a test instance of Home Assistant. I recently found this and would love to learn it to create DIY automation devices. I am not a dev but I can tinker.

OK. I am really good at following directions so I went to GitHub and walked through the steps. I made sure all the libraries and board support was in place before starting as per the instructions here: Setup.

Seems like it was going well until I tried the final step and compiled the ST_Anything_Multiples_ESP8266WiFi.INO.

It blew up with a bunch of string errors. I am assuming I wasnā€™t supposed to edit anything just yet in the INO? Iā€™ll list the mess below if that helps.

So I decided to start clean because I thought my environment was wonky and hadnā€™t used it in a while. Did a complete uninstall of Arduino off my system after I made a back up of all my libraries and deleted all the folders from everywhere. I then reinstalled 1.8.15 and the ESP8266 v3 from Github. Copied all the files as before, updated everything and made all the correct changes to compile to the board and then tried it again. Same thing.

Not sure what I am doing wrong. Here is the output regardless. Hope it helps you help me! :slight_smile:

C:\Users\BMWK1\Documents\Arduino\libraries\ST_Anything\EX_Alarm.cpp: In member function 'virtual void st::EX_Alarm::refresh()':
C:\Users\BMWK1\Documents\Arduino\libraries\ST_Anything\EX_Alarm.cpp:108:42: error: cannot bind non-const lvalue reference of type 'String&' to an rvalue of type 'String'
  108 |    Everything::sendSmartString(getName() + F(" both"));
In file included from C:\Users\BMWK1\Documents\Arduino\libraries\ST_Anything\EX_Alarm.cpp:36:
C:\Users\BMWK1\Documents\Arduino\libraries\ST_Anything\Everything.h:79:40: note:   initializing argument 1 of 'static bool st::Everything::sendSmartString(String&)'
   79 |    static bool sendSmartString(String &str); //sendSmartString() may edit the string reference passed to it - queues messages - preferable
      |                                ~~~~~~~~^~~

Solved this myself. Deleted everything and started again. Using the 1.8.9 version of Arduino and the 2.5.2 version of ESP8266 board manager. Everything compiles.

Seems like there are new ā€œrulesā€ affecting the compiling of these .ino files in newer versions of the IDE perhaps?

1 Like

I just tested Arduino IDE 1.8.15 with the ESP8266 2.7.4 board manager, and it compiles fine.

When I upgraded the ESP8266 support from 2.7.4 to 3.0.0, I received the flurry of errors that you saw previously. Definitely something in the ESP8266 3.0.0 version that has broken things.

If anyone figure it out, please let us all know. For now, I recommend using ESP8266 2.7.4.

1 Like