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

arduino
alarm
dth_misc
esp8266
esp32

(Dan) #2307

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.


(Steve ) #2308

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


(Dan) #2309

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.


(Steve ) #2310

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


(Brandon) #2311

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!


#2312

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.


(Viktor) #2313

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?


(Allan) #2314

Adafruit didn’t work as in a compiled but you couldn’t get the RGB to change? Or it didn’t compile at all?

As for switching the library I’m not sure as they might define things differently. I can try it and see what I get. Or you can PM me the error messages so we’re not making a mess of this thread.

Edit: I was able to take the EX_RGBAddressable_Dim library files and the ST_Anything_AddressableRGB_ESP8266WiFi.ino from my GitHub and compile successfully against a NodeMCU 1.0 (ESP-12E Module) as is. Haven’t tried the other library yet.


(Dan) #2315

Why not just buy a purpose-built, ready to use zigbee motion sensor? You will get way better responsiveness, battery life, and reliability. Lowes has a clearance sale going on right now for their Iris Motion sensors for $15.

It is possible to do what you’ve suggested, but you would really want to simple use the “SmartThings…” communications libraries (in my ST_Anything GitHub repo) instead of the whole ST_Anything package. It would be a lot simpler and smaller code-wise.

If you really want to try this with ST_Anything, you will need to modify the IS_Motion.cpp file to remove the 30 second warm-up time that I included to prevent false motion events from being sent during power up.


(Dan) #2316

If you want to do this in the sketch, look at using the ‘callback()’ function that is included on all of the ST_Anything example sketches. This function is called any time data is sent to SmartThings. You can parse the data and perform any type of analysis you’d like. Then, based on your analysis, you can send Button Events, like Pushed and Held, to ST…emulating a button controller device.

If you need help, let me know… You can look into the IS_Button.cpp file to see how it formats the data to be sent to ST. I believe it is simply “button1 pushed” or “button1 held”… Of course, your could also pretend to have a “button2” or “button3”… You do NOT need to create IS_Button devices to make this work. You just need to send the correct strings to ST, the same as if you had defined IS_Button devices. You also need to make sure you define the correct number of buttons in the Parent Device’s settings. Doing so allows other SmartApps to know how many ‘buttons’ your device has, to allow you to select those buttons as triggers for events.

Here is an example of what I am talking about… The IF statements are PSEUDO CODE, meaning you will need to parse the ‘msg’ string to get the numeric portion of the ‘voltage1 23.45’ messages being sent to ST to use in the comparison.

//******************************************************************************************
//st::Everything::callOnMsgSend() optional callback routine.  This is a sniffer to monitor 
//    data being sent to ST.  This allows a user to act on data changes locally within the 
//    Arduino sktech withotu having to rely on the ST Cloud for time-critical tasks.
//******************************************************************************************
void callback(const String &msg)
{
  //Uncomment if it weould be desirable to using this function
  Serial.print(F("ST_Anything_Miltiples Callback: Sniffed data = "));
  Serial.println(msg);
  
  //TODO:  Add local logic here to take action when a device's value/state is changed
  
  //PSEUDO CODE
  if  (parsed voltage message < 10) {
     st::Everything::sendSmartString(“button1 pushed”);
   }
   else if (parsed voltage message >= 10) {
     st::Everything::sendSmartString(“button1 held”);
   }

}

(Viktor) #2317

Thank you for your reply. I have couple of them with battery shield and I thought that it would be useful to build a motion sensor. I will look for an other project than where i can use them. I am not expert in coding. Thank you.


(Denis Grabocka) #2318

@ogiewon Ok i am a total beginner with Arduino IDE and Arduino /esp in general but a fast learner :slight_smile:
I am trying to program a NodeMCU esp8266 v0.9 to cntrol 2 relays but when i am trying to compile the code it gives me this error message:
“compilation terminated.
exit status 1
SmartThingsESP8266WiFi.h: No such file or directory”
I don’t know what i am doing wrong i am sure it is something dumb but i do have that file that the rror is referencing in that folder as per instructions. I have tried to do some research on line and see how can i fix this issue but i am posting here as well
any help will be greatly appreciated
Denis


(Dan) #2319

Can you tell me the exact full path to that file on your computer? It sounds like the libraries might not be installed correctly.


(Sean Rudden) #2320

I am having issues creating child devices. I first started testing with an unmodified sketch but when I reached the end of the whole process I got the error: “Child device creation failed. Please make sure that the ‘null’ is installed and published.” I did a lot of research to figure out why this was happening, I tried recreating the parent device 10 or so times, completely reinstalled all parent and child DTHs to no avail. After looking at the parent DTH code, I choose to remove the number by the name of the device in the Arduino sketch, going from sensor1(F("doorControl1") to sensor1(F("doorControl"). The error went away but no child devices were created. I think something in the parent DTH is not working right for me.

Using:
Smartthings Hub V2
ESP8266-01

P.S. Live Logging has never worked on my hub despite many attempts to fix it, so I won’t be able to troubleshoot this problem that way.

Sean


(Dan) #2321

You must have the number appended to each device name in the sketch. My guess is that you forgot to publish all of the child devices?

Also, please contact ST Support to resolve the live logging issue. You really need it working for troubleshooting code.


(Denis Grabocka) #2322

Thank you Dan for your prompt replies
here are their paths for both folders:
C:\Users\Denis Grabocka\sketchbook\ST_Anything_Multiples_ESP8266WiFi

and

C:\Users\Denis Grabocka\sketchbook\SmartThingsESP8266WiFi

Initially i just ran it from the locations above just as they were copied over from the zip file and got that error;

I also went and copied all contents of both those folders into one new folder and opened and ran Arduino IDE from that folder and still the same error persisted

what am i doing wrong?

and thank you again

Denis


(Sean Rudden) #2323

I checked and made sure all of the child devices were published. Also I couldn’t get the error to go away with the numbers, the parent DTH just won’t create the child devices.


(Dan) #2324

That doesn’t appear to be the correct path for standard Arduino code.

As described in the ReadMe, it should be

C:\Users\Denis Grabocka\Documents\Arduino\libraries\

And

C:\Users\Denis Grabocka\Documents\Arduino\Sketches\


(Dan) #2325

Sean,

Not sure what to tell you. It sounds like you’ve got some ST IDE issues if you still cannot get Live Logging to work. Does GitHub integration work for you?

Can you show me a screen shot of your parent device from within the ST Web IDE?


(Sean Rudden) #2326

The first screenshot is the parent DTH and the second is the child DTH I am trying to use.