[RELEASE] ST_Anything - Arduino/ESP8266/ESP32

I’m having issues getting ST_Anything set up. Specifically I can’t seem to get any of the child devices to “automagically” set up.

I’ve got two devices I’ve been playing with, and I’m getting stuck at the same spot with either device. I’ve got a NodeMCU v1.0, and a LinkNode R4. I’ve programmed each with the Arduino IDE (I’m using IDE version 1.8.8, and the 2.4.2 ESP8966 board manager). For the NodeMCU I used the “ST_Anything_Multiples_ESP8266WiFi” sketch and for the LinkNode I used the “ST_Anything_LinkNodeR4_ESP8266WiFi” sketch. Both sketches were modified with the appropriate IP addresses and WIFI info.

Through my router I can now see each device on my network at their IP address that I set in each sketch. I added each device in the ST IDE using the instructions at the beginning of this thread. In the ST IDE events log I noticed that for each device, about 2 seconds after I created one, there is an alert for childDeviceCreation = failed. I’m assuming that’s normal because I haven’t yet set up the device on the phone app.

I then opened up the classic iOS smartthings app on my phone, and went to edit the device. After entering the required information, I press “save” and then nothing happens.

This is the point at which I’m stuck. Any advice for what to do next to find out why the child devices aren’t being created? There are no errors in the IDE events log for creating child devices. It looks like it doesn’t even attempt to create them after I edit the device on my phone. I see a “DeviceUpdated” log entry, but then nothing after that.

FYI, all DH show as “published” in the ST IDE.

If child devices are not automatically created, you need to double check that you edited the ST Hub’s IP address in the sketch. And, that you also have used the correct MAC address when configuring the Parent Device.

The LinkNode R4’s MAC address for me was not displayed correctly in the Arduino IDE. I had to use my router to figure out the correct MAC address.

I have 2 hubs on my network (v3 and the ADT Security Panel). I have been trying to connect everything to the v3 hub, and this morning I again verified I had everything set up correctly. It still did not work. I decided to attempt connecting to the ADT Security Panel, so I modified the sketch with the appropriate hub IP address and re-flashed it. Then I added the parent device in the ST IDE and chose the ADT hub this time. Then on my phone I modified the parent device with the appropriate settings as I have dozens of times before. And what do you know? All the child devices were created!

I’ll play around with this tonight, but I am certain that I have done nothing different this time other than connecting to the other different hub. I used all the same device IP and MAC settings that I had used previously. At least for now I know that I’m doing this correctly, but I am thoroughly confused why it won’t let me connect to my v3 hub. I did verify I had the correct v3 hub IP address (both thru my router and thru the IP listed in the ST IDE page).

If I figure this out I’ll let you know.

1 Like

Nafis,

Would you be willing to share your code for your sprinkler system?

Well I did exactly what I instruct other people not to do when troubleshooting something: I changed multiple things at once. Long story short, I have it working now but I can’t pinpoint exactly what did it.

I started with both devices (linknode and nodeMCU) connected to the ADT hub and working. I then deleted both. I updated the sketches on both changing only the hub IP address and then reflashed them. I added them one at a time back in the ST IDE. Then after editing the parent device on my phone, neither would work. At this point I was convinced I pinpointed the issue to the hub. But for grins, I tried to move one device back to the ADT hub IP to get it working again. And instead, it failed. At this point, for some reason, my v3 hub went offline. Up until this point it was running via WiFi and I had been intending to run a patch cable to it, so I decided this was the time. After running that cable, and then rebooting my router, I also changed the IP address of the nodeMCU withing the sketch. I also removed the reserved IP within my router. Then I tried to put it on the v3 hub, and this time it worked. So there were 4 changes associated with my fix and I don’t know which one was the key:

  1. Put the v3 hub on ethernet instead of wifi. I made the hub’s ethernet IP the same as it’s (former) wireless IP, so this didn’t affect any of my .ino sketches. I really doubt this had any effect on my issue.

  2. Rebooted my router. This definitely could have affected my issue.

  3. Removed IP address reservation for the NodeMCU within my router. This shouldn’t have made a difference if I didn’t also do item #4:

  4. Changed the device IP address in the NodeMCU sketch.

My guess is that there was something funky going on with IP address reservations. When I tried connecting the devices to the ADT hub this morning, it might not have been changing the connection to the ADT hub which magically made everything work; maybe instead it was simply waiting to try again overnight after some DHCP stuff got refreshed/cleaned up in my router?

Obviously I’m throwing darts. Anyway I should be able to take this from here. I apologize to anyone who has this same issue in the future that I didn’t do a better job of identifying root cause. My only advice at this point would be to reboot the router, and don’t reserve IP addresses for your new device until you’ve finished playing around with everything.

1 Like

Hey Dan i got your script to work beautifully with a Arduino Mega 2560.
I am reading temperature and humidity from the DHT22 and controling both relays as it is supposed to. So thank you a million times for this cant wait to deploy it in my attic and i hope that DHT22 survives the Texas heat :slight_smile:
My last question is however; How can i control those relays if the temperature hits a certain level?? Is there an app for something like that or do i have to do it in webCore??

Thank you again
Denis

in case you have forgotten here is the above sketch i am talking about [RELEASE] ST_Anything v2.9.2 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi

Hey Alec,

Did you ever figure out why the ESP8266 stopped working in your case?

I believe I’m having the exact same issue as you.

On SmartThings, that sounds like a job for webCoRE. On Hubitat you’d use Rule Machine.

Yes, the culprit was a Sprinkler 4 Zone groovy DHT, read the tread.

Thanks,
Alec.

Dan,

I see you recently incorporated the emon lib into st_anything for power monitoring. I am using it, and it works great. I appreciate your work on this. I am now trying to see if there is a way to modify the DTH to calculate KWH. Would it be possible to look at each report from the CT and then compare to the time of the previous KW reading and make a calculation based on either the KW reading at the begin or the end of period, or average the two and multiple by the time between readings? I know this would not be terribly accurate but should provide a reasonable estimate.

I agree that the calculation could most easily be implemented in the Child Power Device Handler. Feel free to give it a try and let me know if you any assistance. Hint: you’ll need to add the Energy Capability in addition to the existing Power Capability. You’ll also probably need to use some state variables, and provide a mechanism for resetting the value based on some sort of time period (e.g. start of each month?)

My WeMos garage door controller recently stopped working. I pulled it down, plugged it into my computer, and reuploaded the sketch. I can see it sending data, but I can’t connect to it over wifi (nor is the data actually showing up in ST).

My wifi stuff hasn’t changed, but I’m not sure where to start troubleshooting.

I would recommend retracing your steps through the ST_Anything ReadMe document to make sure you have the latest code for both the Arduino IDE and SmartThings IDE.

Hi Dan,

Is there any news about that duplicate child device issue?

I built a simple temp/humidity sensor using Adafruit’s HUZZAH and their SHT31 module, but recently switched to the Wemos D1 Mini and their SHT30 module. Everything worked great with the HUZZAH/SHT31, but with the D1 Mini/SHT30, I’m getting a duplicate child every time I create the parent. I’ve tried deleting and recreating the parent device at least half a dozen times, and each time, I get two temperature sensor child devices. The code actually hasn’t changed at all.

Thanks!

I am using ST_Anything with three DS18B20s to monitor freezer and fridge temps. It is reporting temperatures too well. I get more than one update per minute. Is there a way to get the temperatures every 5 to 10 minutes.

Thanks

I have my ESP8266-based device go to sleep after each reading then wake up every two minutes. What kind of device are you using?

NodeMCU 1.0

I have this line as the last thing in my setup() method:

ESP.deepSleep(120e6); 

RST and #16 are also connected with a solder jumper, but I’m not sure if the NodeMCU has that, so you might have to use wire. Just change “120e6” to “300e6” and you should be good to go.

Thanks. Will try that.

Using deep sleep will prevent your microcontroller from receiving updates from ST. It can be useful for a battery operated device, but not for one that is powered by a DC power supply.

The normal way to adjust the polling interval is to modify your sketch.

Here is the documentation for the DS18B20 class for ST_Anything.

//  Summary:  PS_DS18B20_Temperature is a class which implements both the SmartThings "Temperature Measurement" capability.
//			  It inherits from the st::PollingSensor class.  The current version uses a digital pin to measure the 
//			  temperature from a Dallas Semiconductor One Wire DS18B20 series sensor. 
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_DS18B20_Temperature sensor1(F("temperature1"), 120, 0, PIN_TEMPERATURE, false); (for a single sensor)
//                          st::PS_DS18B20_Temperature sensor1(F("temperature"), 120, 0, PIN_TEMPERATURE, false, 10, 3); (for 3 sensors)
//
//			  st::PS_DS18B20_Temperature() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - either "temperature1" for a single sensor, or "temperature" for multiple sensors
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- byte pin - REQUIRED - the Arduino Pin to be used for the One-Wire DS18B20 sensor conenction
//				- bool In_C - OPTIONAL - true = Report Celsius, false = Report Farenheit (Farentheit is the default)
//				- byte resolution - OPTIONAL - DS18B20 sensor resolution in bits.  9, 10, 11, or 12.  Defaults to 10 for decent accuracy and performance
//				- byte num_sensors - OPTIONAL - number of OneWire DS18B20 sensors attached to OneWire bus - Defaults to 1
//				- byte sensorStartingNum - OPTIONAL - Starting number for sending temperature sensor data when using multiple sensors on one pin - Defaults to 1