[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Well, I don’t really have an explanation for this. I uploaded the wifi test sketch, and confirmed wifi was working. Then when I uploaded the (same) ST_Anything sketch afterwards, it worked.

1 Like

…and now it’s not working again. It’s gotta be something with the board, right?

Maybe the hardware???

What version of Arduino IDE and ESP8266 Board Manager are you using?

IDE: 1.8.9
ESP8266: 2.5.0

I really hope it’s not the board. The thought of having to solder something again with my hand tremors is not fun.

edit: I just realized that you now have a sketch specifically for garage doors. I’m going to see if that helps.

I have not tested those versions. Try using Arduino IDE v1.8.8 + ESP8266 v2.4.2.

So, I just tried your code… I still got a duplicate child device created… Grrrr! I appreciate your collaboration on trying to resolve this issue. It definitely feels like some sort of a race condition… :thinking:

Are you still seeing duplicate child devices?

1 Like

Ahh, that’s frustrating! Thanks for giving it a try, though! I’m not currently getting duplicates, but–knock on wood–it could just be luck.

It’s a long shot, but maybe try the whole file. I made a few other changes to parse() and createChildDevice(). Most importantly, I changed the return type of createChildDevice to “object” so it returns the new device it just created. With that, parse() just uses the new device instead of looking for it in the childDevices property. It didn’t work on its own, but maybe it’ll work in combination with the other measures.

https://ideone.com/3hTg8n

The only other thing I can think to try is to maybe use atomicState instead of state. I haven’t tried it yet because the docs say you shouldn’t use both in the same app and you’re already using state elsewhere in the code.

So, I have tried using your full Parent Ethernet device handler…and I am still getting pretty poor results. I just don’t know what ST has done to their cloud servers to screw this up so badly!

I am thinking atomic state might be a good idea to try. Can’t hurt. AS you mentioned, we’ll need to change all state. vlariables to use atomicState instead.

Not tonight though… gotta get some sleep!

Again, thank you for your assistance!

It’s my pleasure. I’m grateful for all the hard work you put into creating such an awesome project. This is really the least I can do in return.

After re-reading the docs, I’m unclear about what they’re suggesting. I don’t if they’re warning against working with state.foo and atomicState.foo in the same app, which makes sense, or using state.foo and atomicState.bar in the same app, which makes less sense. Some background research indicates the latter scenario might be okay, so that’s what I did.

This is untested code, but I’m hopeful it’ll work. If we can track child devices in a synchronous way, without waiting for things to finish executing, etc., I think we can fix this.

https://ideone.com/EVcjLO

I tried your new version tonight. It is throwing an error and thus isn’t working quite correctly yet. I don’t have time tonight to debug it…

Let me know when you get a chance and I’ll help debug it. I’m not getting any errors in the IDE.

Is there a way of reading differential pressure using this method?

I want to be able to know if my house is running a negative OR positive pressure and controls an ERV based on that information.

The voltage class could do it as long as you has a differential pressure switch that fed back voltage. I know of lots of them that are out there that could do this. You’d then use a custom child DTH to convert your voltage into a actual pressure reading. Very doable.

Thanks for your response. I’m not sure what a “voltage class” is refers to. I am going to read through the full write up on this and try to get my mind wrapped around how these devices work. I would assume a voltage class refers to a device that just reads voltage and somewhere in the smartapp (or else where) thats where the traslation of voltage to pressure takes place.

I have a differential pressure sensor that outputs voltage so I just need to get my mind wrapped around the communication piece to ST.

I work in the commercial HVAC controls and automation so there are piles of devices that could potentially be brought into a ST environment that there currently is no solution for.

Differential Pressure
Temperature sensor probes
Humidity Probes

I’m excited about this.

I work in IT for a commercial HVAC company and I spent a year as a installing tech in our controls department to gain experience. :slight_smile: Now I’m full time IT but have all the experience and understnad how all the sensors work. Personally I have a Vaisala outdoor temp & humidity sensor feeding voltage to ST_Anything and then I’m using a temperature DTH and a humidity DTH to spit out the outdoor air conditions at a stupidly accurate value. So I know exactly what you’re trying to do and how to do it. Let me know if you have trouble.

With the above said thing will process slower then the DDC equipment you are used to. Stuff that you could control with a PID loop and run every second isn’t going to be possible. But if you just care about reading the pressure every 30 seconds and turning on a fan or opening a exhaust you’ll be fine.

Hello Dan and happy weekend
Onto my next little project already …and I came across the following built, looking for a way to automate my front door lock. https://electropeak.com/learn/smart-door-lock-w-wifi-login-page-by-arduino-esp8266/

It uses a ESP-01 and Arduino UNO (i have both those components) but for the life of me, with my limited knowledge that i have learned from you here in this thread, i don’t understand why he is not just using the ESP-01 and its GPIO pin (to trigger the lock or the relay on my case) but it introduces the UNO in the equation??

It also has this 2 pieces of code:
For the ESP-01

#include <ESP8266WebServer.h>
// WiFi network
const char* ssid     = "YourSSID";
const char* password = "YourPASSWORD";
ESP8266WebServer server ( 80 );
char htmlResponse[3000];
void handleRoot() {
 snprintf ( htmlResponse, 3000,
"<!DOCTYPE html>\
<html lang=\"en\">\
 <head>\
 <style>\
body {background-color: rgb(160, 0, 53);}\
h3   {color: white;text-align:center;}\
p    {color: white; text-align:center;}\
div  {color: white; text-align:center;}\
ID {text-align:center;}\
input {text-align:center;}\
</style>\
   <meta charset=\"utf-8\">\
   <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\
 </head>\
 <body>\
         <h3>\<canter>Electropeak Smart Security Door</canter>\</h3>\
         <p>\<canter>Please type your ID</canter>\</p>\
         <div>ID: <input type='text' name='pass_word' id='pass_word' align='center' size=10 autofocus></div> \
         <div>\
         <br><button id=\"save_button\">Log In</button>\
         </div>\
   <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>\    
   <script>\
     var pass;\
     $('#save_button').click(function(e){\
       e.preventDefault();\
       pass = $('#pass_word').val();\        
       $.get('/save?pass=' + pass, function(data){\
         console.log(data);\
       });\
     });\      
   </script>\
 </body>\
</html>"); 
  server.send ( 200, "text/html", htmlResponse );  
}
void handleSave() {
 if (server.arg("pass")!= ""){
   Serial.println(server.arg("pass"));
 }
}
void setup() {
 // Start serial
 Serial.begin(115200);
 delay(10);
 // Connecting to a WiFi network
 Serial.println();
 Serial.println();
 Serial.print("Connecting to ");
 Serial.println(ssid);
 WiFi.begin(ssid, password);
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
 }
 Serial.println("");
 Serial.println("WiFi connected");  
 Serial.println("IP address: ");
 Serial.println(WiFi.localIP());
 server.on ( "/", handleRoot );
 server.on ("/save", handleSave);
 server.begin();
 Serial.println ( "HTTP server started" );
}
void loop() {
 server.handleClient();
} 

For the arduino

bool stringComplete = false;  // whether the string is complete
 
void setup() {
  // initialize serial:
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
 
  pinMode(9,OUTPUT);
}
 
void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    if (inputString=="your_password")
   {
       digitalWrite(9,HIGH);
       delay(300);
       digitalWrite(9,LOW);
 
       Serial.println(inputString);
       // clear the string:
       inputString = "";
      stringComplete = false;
    }
  }
}
 
 
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag so the main loop can
    // do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

I know you are way to busy to look and troubleshoot other peoples code but i need all the help i can get to get it to run on the ESP alone for compactness. Also i was thinking that if we somehow incorporate ST_Anything with it and than we will have relay control through SmartThings as well.
So ST control plus this sort of additional smart capability for other people that don’t have ST to access it via a shared passkey will be the ultimate coolness LOL.

Another semi-related issue that i need your or anyone’s expertise and it is bothering me with this install is that… When i connect and power the ESP-01 though the Arduino Uno or Mega’s that i have, it does not “boot” up but when i connect the ESP through this usb adapter https://www.amazon.com/gp/product/B07D49MSTM/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1 it works just fine and i can access the mini web-server that it is hosting which means that it signs up on my network and the ESP’s hardware works …What can cause this behavior?? Is it not enough voltage?? I have tried both the usb connection and a separate 5 volt adapter for the Arduino boards and of course using the 3v3 pin to power the ESP

Please let me know your thoughts i would love to tackle this project with your help of course LOL
Denis

An Arduino’s 3.3v voltage regulator is not really capable of supplying enough power for reliable operation of the ESP01.

As for why that project used both devices? No clue. As you mentioned the ESP01 could have used one of its two GPIO pins to control the relay directly. All you have to do is remove its serial.print command and replace it with a few digitalWrite commands.

Hello Dan,

I have beening using a NodeMCU v1.0 to control two relay switches. It was working pretty well but stopped responding recently. I connected the controller to PC and monitored the serial messages. Here is what I found.

  1. It connects to wifi correctly. I can ping the IP without problem.
  2. It seems to hang up during the initialization. Below is the message printout. Sometimes it stopped at relaySwitch1 off, sometimes it stopped after relaySwitch2; and sometimes it printed a couple of more lines saying initDevices ended or sth like but it rarely got to this point.

Everything: init ended
Everything: Free RAM = 47496
Everything: adding sensor named relaySwitch1
Everything: Free RAM = 47496
Everything: adding sensor named relaySwitch2
Everything: Free RAM = 47496
Everything: initDevices started
Everything: Free RAM = 47496
Everything: Sending: relaySwitch1 off
Everything: Sending: relaySwitch2 off

  1. I monitored the Live Logging in ST_IDE, and it only shows “Parsing: relaySwitch1 off” but not for relaySwitch2. When I tried to turn on the relay switch, the controller did not respond. Nothing was updated in the serial monitor.

  2. I tried a second nodemcu and it was the same symptom.

  3. I updated ST_Anything to 2.9.4, Arduino IDE to 1.8.8 and ESP8266 to 2.4.2, but nothing helped.

Any ideas on what the problem might be?

Thanks!

Unfortunately, I really don’t know what’s going on. Some others have recently had similar experiences. Since I’m using Hubitat now, I don’t have any firsthand experience with current SmartThings issues.

Any changes to home network recently? Have you tried rebooting your home router/access point? Just a guess.

If SmartThings kills its support for Groovy and custom device handlers and smart apps, do you think Hubitat will still support those things indefinitely?