SmartThings Community

[RELEASE] ST_Anything v2.9.2 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi

arduino
alarm
dth_misc
esp8266
esp32
#2773

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.

0 Likes

(Dan) #2774

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

0 Likes

(Alec) #2775

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

Thanks,
Alec.

0 Likes

(Richard Gross) #2776

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.

0 Likes

(Dan) #2777

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?)

0 Likes

(TOO FLY FOR A FLY GUY) #2778

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.

0 Likes

(Dan) #2779

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.

0 Likes

#2780

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!

0 Likes

(Thomas Kelso) #2781

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

0 Likes

#2782

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?

0 Likes

(Thomas Kelso) #2783

NodeMCU 1.0

0 Likes

#2784

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.

0 Likes

(Thomas Kelso) #2785

Thanks. Will try that.

0 Likes

(Dan) #2786

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
0 Likes

#2787

Is that a problem if the device only has sensors and no executors?

0 Likes

(Dan) #2788

Sorry, no news. It works perfectly on Hubitat. :wink:.

0 Likes

#2789

Darn…

It’s such a bizarre issue. The problem is perfectly repeatable.

0 Likes

(Dan) #2790

Not really a problem, necessarily…however every time it wakes from deep sleep it has to reconnect to WiFi, which takes additional time. Also, deep sleep only works for a Polling sensor, like temperature. For something like an Interrupt sensor, the response time would be horrible (even assuming you configure a pin to wake it up) due to the long WiFi reconnect time.

0 Likes

#2791

Yeah, that’s what I thought–just making sure I wasn’t overlooking something. For my temp/humidity sensor, I found the ESP8266 produces enough heat to influence the sensor readings. I don’t really need updates more than every few minutes, so putting the device in deep sleep works well, even though it’s not battery powered.

1 Like

#2792

I don’t know if this fixes the issue, but I rewrote part of the createChildDevice() method and I could use some help testing the potential fix. It works for me, but I can only delete and re-install the parent device so many times.

Dan, I noticed you were keeping a copy of the last created child device’s ID in state memory, so I figured we ought to take it a step further and store all child device ID’s. Even if a device has 500 children (the maximum), it shouldn’t use more than 20% of the alloted space in the state variable. I’m also looking for the new child device ID in the childDevices property. Here’s the pertinent code:

if(state.childIds == null){
    state.childIds = [];
}

def stChildIds = [];
childDevices.each{                                                  // Iterate through each known child device
    stChildIds.add(it.deviceNetworkId);
}

if(
    (deviceHandlerName != "") &&
    (!state.childIds.contains(
        "${device.deviceNetworkId}-${deviceName}${deviceNumber}")
    ) &&
    (!stChildIds.contains(
        "${device.deviceNetworkId}-${deviceName}${deviceNumber}")
    )
){
    def newChild = addChildDevice(
        deviceHandlerName,
        "${device.deviceNetworkId}-${deviceName}${deviceNumber}",
        null,
       [
            completedSetup: true,
            label: "${device.displayName} " +
                "(${deviceName}${deviceNumber})", 
            isComponent: false,
            componentName: "${deviceName}${deviceNumber}",
            componentLabel: "${deviceName} ${deviceNumber}"
        ]
    );

    state.childIds.add("${device.deviceNetworkId}-" +               // Store a copy of this child device ID since we can't rely on ST
        "${deviceName}${deviceNumber}");
}

What are your thoughts? Whatever’s going on to cause this problem, it’s really weird. Dan, I’m really grateful for all your hard work!

0 Likes