[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Here is a screenshot with the settings which should be configured for ESP01.

21

Also, you can upload a sketch to check the flash configuration

Config%201

Anyway, still no luck - NodeMCU, as well as ESP01 would stall after the boot. Tried to factory default, uploaded all zeros, ESP blank, etc.

I am still having zero luck with getting any of my ESP01 boards to run without throwing an exception. I can flash them fine, but they only run for a few seconds before crashing. I’ve tried a ton of programming settings combinations without any success. Perhaps my programming circuit is no longer working correctly? Maybe my FTDI board is flakey? I just don’t have the time to worry about these little guys when the NodeMCU’s work so much more easily.

Dan,
After 100s uploads, tests and factory defaults I can 99.99% say - there is something wrong with your DTHs, or/and libraries. All ST_Anything devices have a huge delay in response.
Tried Konnected, and it works fine with the ESP-12E ()ModeMCU), so nothing wrong with my network or the flashing procedure.
Also, successfully tried ESPurna https://github.com/xoseperez/espurna/tree/dev/code
no delays.
Thanks for your time!

I hear you, however you’re the only person who has ever reported this issue. I am glad you’ve found alternative solutions. As I mentioned, Konnected actually bypasses the ST Hub for half of the data transfers (from the MCU to the ST Cloud.)

I have a fair number of ESP8266 and even more ESP32 all running fine (plus a handful of Arduinos).

1 Like

it will not upload over my network.

Arduino: 1.8.8 (Windows 8.1), Board: “WeMos D1 R1, 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

Sketch uses 319188 bytes (30%) of program storage space. Maximum is 1044464 bytes.
Global variables use 29248 bytes (35%) of dynamic memory, leaving 52672 bytes for local variables. Maximum is 81920 bytes.
java.io.IOException: Cannot run program “python.exe”: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
at cc.arduino.packages.uploaders.GenericNetworkUploader.uploadUsingPreferences(GenericNetworkUploader.java:99)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
at processing.app.SketchController.upload(SketchController.java:732)
at processing.app.SketchController.exportApplet(SketchController.java:703)
at processing.app.Editor$UploadHandler.run(Editor.java:2042)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

 8 more
An error occurred while uploading the sketch

This report would have more information with
“Show verbose output during compilation”
option enabled in File -> Preferences.

John, Do have the latest DH groovy loaded or not updated? What versions Arduino 1.8.8 and Board manager 2.4.2? and Dan’s libraries you successfully use?
When you have last time has flashed the ESP?

I really loved your version of setup. Konnected does not work on ESP01 (at least I have not seen any mention of it. I have tried to flash it but no luck.)
Where I can get old groove DHs (Jan-Feb 2018)? I have saved libraries (Dec. 2017)

Bob,
Looks like python cannot be located.
Try this:
You need to add the folder that contains python.exe to your path:

* Determine the path to the folder that contains python.exe. You can use Windows File Explorer for this.
* In the search bar, type "System (Control Panel)"
* Click on the matching search result
* Click the "Advanced system settings" link.
* Click the "Environment Variables" button.
* In the section System Variables, find the PATH environment variable and select it.
* Click the "Edit" button.
* Click on the first blank line
* Type the path to the folder that contains python.exe.
* Click "OK"
* Click "OK"
* Click "OK"

Yes. All up to date. Flashed last week (2.4.2 and 2.5, both work).

I have noticed that some code causes the devices to crash and with a little tweaking I was able to work around the issues. Made no sense, but hey, it works (changes in heap, stack, etc). And before you ask, this is true even when ST Anything is not in the picture.

Edit: One more thing, the ESP32 works better than the ESP8266 IMO. Reason? I’ve run into fewer issues using the same code based.

Good luck!

You can pull an older Release from Github, instead of the Master.

I wonder if the issue is related to the addition of OTA update support? I bet the ESP01 does not have enough memory to handle an OTA update
 :thinking:

The only files I believe you’d to change is SmartThingsESP8266WiFi.cpp and .h from Release 2.8.

1 Like

ST_Anything)/Groovy/ Deprecated ?

Well, I have older NodeMCU which is still not reflashed, so nothing changed there, it must be the DHs.

Here is one what I have -

//*******************************************************************************
//	SmartThings NodeMCU ESP8266 Wifi Library
//
//	License
//	(C) Copyright 2017 Dan Ogorchock
//
//	History
//	2017-02-10  Dan Ogorchock  Created
//*******************************************************************************

#include "SmartThingsESP8266WiFi.h"

namespace st
{
	//*******************************************************************************
	// SmartThingsESP8266WiFI Constructor - Static IP
	//*******************************************************************************
	SmartThingsESP8266WiFi::SmartThingsESP8266WiFi(String ssid, String password, IPAddress localIP, IPAddress localGateway, IPAddress localSubnetMask, IPAddress localDNSServer, uint16_t serverPort, IPAddress hubIP, uint16_t hubPort, SmartThingsCallout_t *callout, String shieldType, bool enableDebug, int transmitInterval) :
		SmartThingsEthernet(localIP, localGateway, localSubnetMask, localDNSServer, serverPort, hubIP, hubPort, callout, shieldType, enableDebug, transmitInterval, false),
		st_server(serverPort)
	{
		ssid.toCharArray(st_ssid, sizeof(st_ssid));
		password.toCharArray(st_password, sizeof(st_password));
	}

	//*******************************************************************************
	// SmartThingsESP8266WiFI Constructor - DHCP
	//*******************************************************************************
	SmartThingsESP8266WiFi::SmartThingsESP8266WiFi(String ssid, String password, uint16_t serverPort, IPAddress hubIP, uint16_t hubPort, SmartThingsCallout_t *callout, String shieldType, bool enableDebug, int transmitInterval) :
		SmartThingsEthernet(serverPort, hubIP, hubPort, callout, shieldType, enableDebug, transmitInterval, true),
		st_server(serverPort)
	{
		ssid.toCharArray(st_ssid, sizeof(st_ssid));
		password.toCharArray(st_password, sizeof(st_password));
	}

	//*******************************************************************************
	// SmartThingsESP8266WiFI Constructor - DHCP
	//*******************************************************************************
	SmartThingsESP8266WiFi::SmartThingsESP8266WiFi(uint16_t serverPort, IPAddress hubIP, uint16_t hubPort, SmartThingsCallout_t *callout, String shieldType, bool enableDebug, int transmitInterval) :
		SmartThingsEthernet(serverPort, hubIP, hubPort, callout, shieldType, enableDebug, transmitInterval, true),
		st_server(serverPort)
	{
		st_preExistingConnection = true;
	}

	//*****************************************************************************
	//SmartThingsESP8266WiFI::~SmartThingsESP8266WiFI()
	//*****************************************************************************
	SmartThingsESP8266WiFi::~SmartThingsESP8266WiFi()
	{

	}

	//*******************************************************************************
	/// Initialize SmartThingsESP8266WiFI Library
	//*******************************************************************************
	void SmartThingsESP8266WiFi::init(void)
	{
		if (!st_preExistingConnection) {
			Serial.println(F(""));
			Serial.println(F("Initializing ESP8266 WiFi network.  Please be patient..."));

			// attempt to connect to WiFi network
			WiFi.begin(st_ssid, st_password);
			Serial.print(F("Attempting to connect to WPA SSID: "));
			Serial.println(st_ssid);
		}

		while (WiFi.status() != WL_CONNECTED) {
			Serial.print(F("."));
			delay(500);	// wait for connection:
		}

		Serial.println();

		if (st_DHCP == false)
		{
			WiFi.config(st_localIP, st_localGateway, st_localSubnetMask, st_localDNSServer);
		}

		st_server.begin();

		Serial.println(F(""));
		Serial.println(F("Enter the following three lines of data into ST App on your phone!"));
		Serial.print(F("localIP = "));
		Serial.println(WiFi.localIP());
		Serial.print(F("serverPort = "));
		Serial.println(st_serverPort);
		Serial.print(F("MAC Address = "));
		Serial.println(WiFi.macAddress());
		Serial.println(F(""));
		Serial.print(F("SSID = "));
		Serial.println(st_ssid);
		Serial.print(F("PASSWORD = "));
		Serial.println(st_password);
		Serial.print(F("hubIP = "));
		Serial.println(st_hubIP);
		Serial.print(F("hubPort = "));
		Serial.println(st_hubPort);
		Serial.println(F(""));
		Serial.println(F("SmartThingsESP8266WiFI: Intialized"));
		Serial.println(F(""));

		//Turn off Wirelss Access Point
		Serial.println(F("Disabling ESP8266 WiFi Access Point"));
		Serial.println(F(""));
		WiFi.mode(WIFI_STA);
	}

	//*****************************************************************************
	// Run SmartThingsESP8266WiFI Library
	//*****************************************************************************
	void SmartThingsESP8266WiFi::run(void)
	{
		String readString;
		String tempString;

		if (WiFi.isConnected() == false)
		{
			if (_isDebugEnabled)
			{
				Serial.println(F("**********************************************************"));
				Serial.println(F("**** WiFi Disconnected.  ESP8266 should auto-reconnect ***"));
				Serial.println(F("**********************************************************"));
			}

			//init();
		}

		WiFiClient client = st_server.available();
		if (client) {
			boolean currentLineIsBlank = true;
			while (client.connected()) {
				if (client.available()) {
					char c = client.read();
					//read char by char HTTP request
					if (readString.length() < 200) {
						//store characters to string
						readString += c;
					}
					else
					{
						if (_isDebugEnabled)
						{
							Serial.println(F(""));
							Serial.println(F("SmartThings.run() - Exceeded 200 character limit"));
							Serial.println(F(""));
						}
					}
					// if you've gotten to the end of the line (received a newline
					// character) and the line is blank, the http request has ended,
					// so you can send a reply
					if (c == '\n' && currentLineIsBlank) {
						//now output HTML data header
						tempString = readString.substring(readString.indexOf('/') + 1, readString.indexOf('?'));

						if (tempString.length() > 0) {
							client.println(F("HTTP/1.1 200 OK")); //send new page
							client.println();
						}
						else {
							client.println(F("HTTP/1.1 204 No Content"));
							client.println();
							client.println();
							if (_isDebugEnabled)
							{
								Serial.println(F("No Valid Data Received"));
							}
						}
						break;
					}
					if (c == '\n') {
						// you're starting a new line
						currentLineIsBlank = true;
					}
					else if (c != '\r') {
						// you've gotten a character on the current line
						currentLineIsBlank = false;
					}
				}
			}

			delay(1);
			//stopping client
			client.stop();

			//Handle the received data after cleaning up the network connection
			if (tempString.length() > 0) {
				if (_isDebugEnabled)
				{
					Serial.print(F("Handling request from ST. tempString = "));
					Serial.println(tempString);
				}
				//Pass the message to user's SmartThings callout function
				_calloutFunction(tempString);
			}

			readString = "";
			tempString = "";
		}
	}

	//*******************************************************************************
	/// Send Message out over Ethernet to the Hub
	//*******************************************************************************
	void SmartThingsESP8266WiFi::send(String message)
	{
		if (WiFi.isConnected() == false)
		{
			if (_isDebugEnabled)
			{
				Serial.println(F("**********************************************************"));
				Serial.println(F("**** WiFi Disconnected.  ESP8266 should auto-reconnect ***"));
				Serial.println(F("**********************************************************"));
			}

			//init();
		}

		//Make sure the client is stopped, to free up socket for new conenction
		st_client.stop();

		if (st_client.connect(st_hubIP, st_hubPort))
		{
			st_client.println(F("POST / HTTP/1.1"));
			st_client.print(F("HOST: "));
			st_client.print(st_hubIP);
			st_client.print(F(":"));
			st_client.println(st_hubPort);
			st_client.println(F("CONTENT-TYPE: text"));
			st_client.print(F("CONTENT-LENGTH: "));
			st_client.println(message.length());
			st_client.println();
			st_client.println(message);
		}
		else
		{
			//connection failed;
			if (_isDebugEnabled)
			{
				Serial.println(F("***********************************************************"));
				Serial.println(F("***** SmartThings.send() - Ethernet Connection Failed *****"));
				Serial.println(F("***********************************************************"));
				Serial.print(F("hubIP = "));
				Serial.print(st_hubIP);
				Serial.print(F(" "));
				Serial.print(F("hubPort = "));
				Serial.println(st_hubPort);

				Serial.println(F("***********************************************************"));
				Serial.println(F("**** WiFi Disconnected.  ESP8266 should auto-reconnect ****"));
				Serial.println(F("***********************************************************"));
			}

			//init();      //Re-Init connection to get things working again

			if (_isDebugEnabled)
			{
				Serial.println(F("***********************************************************"));
				Serial.println(F("******        Attempting to resend missed data      *******"));
				Serial.println(F("***********************************************************"));
			}


			st_client.flush();
			st_client.stop();
			if (st_client.connect(st_hubIP, st_hubPort))
			{
				st_client.println(F("POST / HTTP/1.1"));
				st_client.print(F("HOST: "));
				st_client.print(st_hubIP);
				st_client.print(F(":"));
				st_client.println(st_hubPort);
				st_client.println(F("CONTENT-TYPE: text"));
				st_client.print(F("CONTENT-LENGTH: "));
				st_client.println(message.length());
				st_client.println();
				st_client.println(message);
			}

		}

		//if (_isDebugEnabled) { Serial.println(F("WiFi.send(): Reading for reply data "));}
		// read any data returned from the POST
		while (st_client.connected()) {
			//while (st_client.available()) {
			char c = st_client.read(); //gets byte from ethernet buffer
									   //if (_isDebugEnabled) { Serial.print(c); } //prints byte to serial monitor
									   //}
		}

		delay(1);
		st_client.stop();
	}

}

Thanks!

That is a VERY old version
 It does not appear that you’ve refreshed all of the ST_Anything Arduino Libraries in a very long time


Here is the current version of the same file. Note how many changes have been made compared to yours.

I would recommend that you rename your existing C:\Users\username\Documents\Arduino\libraries" folder for safekeeping. Then, download the current ST_Anything .zip file from GitHub and grab the entire Arduino\libraries folder and put a copy in your C:\Users\username\Documents\Arduino\libraries folder. Then try again.

Hey Dan sorry it took me 2 days to reply 
pregnant wife :slight_smile:
Here is what i have on the logs

Now that you mention Child Switch DTH 
i dont remember installing that
 how do i do that ??

Always grateful for your help and for you going out of your way to help everyone 
 i don’t know how you do that but you are an inspiration to us all
 when i now read a questions in different forums about stuff that i know i am now always taking the time to answer as well :slight_smile:

Denis

Thanks for the Live Logs data. Unfortunately, the microcontroller did not send an update for for switch device during the timeframe of this windows of data. Try again - have the Live Logs window open, and then reboot the microcontroller. During its startup it we should see an attempt to create child device. Your sketch does not appear to handle the ‘refresh’ command by sending the current status of your switch device. Normally, in ST_Anything this is handled for you. Since you’re using a custom sketch, you’ll need to add code to do that if you want that to work. However, simply powering the MCU off and then back on should cause the status to be sent to ST so we can capture the results in the Live Logs.

Are you using GitHub Integration in the ST Web IDE to install and maintain the ST_Anything DTHs? That is the simplest way to install AND publish all of the DTHs. Instructions are in the ReadMe.

1 Like

I upgrade you to wemos D1 with the pin out in your sketch that you sent me be the same to turn my relays on and off

Bob - I am not sure if you’re saying that it is working properly? Or if there is an issue? Please explain in more detail.

If there is an issue, you are going to have to provide a lot more information and details of what the issue is.

It turns on the onboard LED and the LEDs for the pull-up resistors. I just now got the relays to energize now how do I get 12 volts to my to my fans for example?

WHAAAATTT!!! More secrets you’re hiding from me?!? I’m shocked
shocked I say to see that there is gambling going on in this establishment. :stuck_out_tongue_winking_eye: :clown_face:

Where is this other callback function?

This is what I did. - renamed old libraries and installed new ones. I just wanted to let you show which library was working for me until Feb 18th.
Back to my original question - how do I get old DHs/ What settings should I enter for GitHub integration?
DanielOgorchock/ST_Anything/???
as always, Thanks Dan!