[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

That was it - thanks!

Silly me - I was assuming it will auto-detect the number of sensors :grin:

1 Like

Hi and thanks for the good work being done here. I am new to arduino, but i was able to follow the instructions here and compiled and uploaded the sketch for the MKR1010. I am looking to use it to automate all of my pool equipment and controll it with smartthings.

I uploaded the sketch to the mkr1010. The only thing i edited was all the networking info (Lines with “edit this line next to it” on the sketch). The thing is when i connect power to my MKR1010 it doesn’t connect to my wifi? Am i missing anything? is there any more editing i need to do? I am assuming as soon as i connect power to it the module should connect to my wifi. Am i correct? thanks in advance for any help.

Yes, it should connect to your WiFi assuming your network supports 2.4GHz WiFi, and that you’ve typed in the correct SSID and password (case sensitive.)

I noticed that in the new SmartThings app, all the ST temperature sensors (multipurpose, water leak) display a graph of the readings for the past 7 days or so. This graph does not not seem to be available in the classic ST app even for the ST sensors.

The Device created using ST_Anything shows up correctly as a temperature sensor in the new app, but on the graph it only shows one data point, which is the last reading.

Is it possible to extend Devices created using ST_Anything to display the graph in the new app?

I have no idea, as I do not use the new app. If someone figures out how to support the new app’s graphing functionality from the old-school groovy DTH framework, I’d be happy to entertain adding this.

Note: Since I am using Hubitat these days as my primary hub, I really don’t have much incentive to add new functionality in support of the New ST App.

I have created my ESP8266-based pool temperature sensor. In an effort to save power consumption of my battery powered ESP8266, I want to deep sleep for 30 seconds if the pool pump switch is “on”, otherwise deep sleep for 5 minutes. (I don’t care about the minute-by-minute temperature readings if the pool is not on)

This pool pump switch is a z-wave switch connected to the same ST hub as my ESP8266 - so the question is: is it possible to read the data or the current state of any of the sensors attached to the ST hub? I would like to do this in the setup() routine.

The problem with deepSleep is that there is never an opportunity for ST to send data to the ESP8266 board. That only can occur in the loop() routine, which is constantly checking for incoming data from the ST hub.

I’m having a problem when trying to use the Temp/Humidity Library.

st::PS_TemperatureHumidity sensor1(F("temphumid1"), 120, 1, PIN_TEMPERATURE_1, st::PS_TemperatureHumidity::DHT22, "temperature1", "humidity1", false);

When I use that device constructor it compiles fine but when I upload it to the board, I get stuck in a perpetual boot reboot. I have tried using a brand new board and nothing helps.

SmartThingsESP8266WiFI: Intialized

Disabling ESP8266 WiFi Access Point

ArduinoOTA Ready
IP address: 192.168.1.151
ArduionOTA Host Name: ESP8266-2CF43266649F

Everything: init ended
Everything: Free RAM = 49344
Everything: adding sensor named temphumid1
Everything: Free RAM = 49344
Everything: initDevices started
Everything: Free RAM = 49344
PS_TemperatureHumidity: DHT Time out error
Everything: Sending: temperature1 -1.00
Everything: Sending: humidity1 -1.00
Everything: initDevices ended
Everything: Free RAM = 48936
Device: Destroyed Device ID: temphumid1

Panic C:\Users\Ryan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\cores\esp8266\abi.cpp:36 __cxa_pure_virtual

>>>stack>>>

ctx: cont
sp: 3ffffdb0 end: 3fffffc0 offset: 01b0
3fffff60:  00ffffff 4020f4b8 0101a8c0 4020cb5c  
3fffff70:  9701a8c0 feefeffe feefeffe 40204af0  
3fffff80:  3fffff4c 3fffff54 3ffee908 40204f6c  
3fffff90:  feefeffe feefeffe 3ffee908 4020101c  
3fffffa0:  3fffdad0 00000000 3ffee908 4020cd84  
3fffffb0:  feefeffe feefeffe 3ffe8508 4010088d  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v8b899c12
~ld
Everything: init started
Everything: Free RAM = 50976

Initializing ESP8266 WiFi network.  Please be patient...

I reloaded all the libraries from GitHub before opening the Arduino IDE. I am using D7 on a Wemos D1 mini as my Digital input pin.

Any ideas?

No clue about that error. I have personally been moving away from the DHT series of sensors due to my experience with them having a higher failure rate than other sensors. I am really liking the I2C sensors, like the BME280 and AM2320.

thanks for the response. I was able to play with it a little bit today and finally got it online. I can see it on my network, static ip’s have been set for the hub and for the arduino, but after I create the parent device i do not see any child devices being created. I am still trying to use the sample sketch, Do i need 21 buttonds for it? thanks

I have no idea what this means
:thinking:

Follow the ReadMe, step by step, double checking everything. Make sure you PUBLISHED all of the Device Handlers.

Okay
so, what are you saying? This is no longer supported? Or you just don’t want to help me? This is your software
you don’t know what’s going on? It happened before I even hooked the sensor up so I fail to see what the sensor has to do with anything.

PS_TemperatureHumidity: DHT Time out error
Everything: Sending: temperature1 -1.00
Everything: Sending: humidity1 -1.00
Everything: initDevices ended
Everything: Free RAM = 48936
Device: Destroyed Device ID: temphumid1

You have no idea what that means?

Make sure you’re using the static keyword when you declare the object. It looks like it’s just being declared on the stack, so it’s destroyed when returning from the setup function.

1 Like

Come on Ryan! Really? I don’t offer official support for what is a hobby. I have helped you so many times over the years, and this is how you treat me? Really? SMH

My son’s answer above makes perfect sense, now that he mentions it. Thanks @leinax!

1 Like

I have absolutely no idea what that means. Just forget it. I will NEVER ask you for anything ever again. Goodbye.

Put the word ‘static’ at the beginning of this line:
st::PS_TemperatureHumidity sensor1(F(“temphumid1”), 120, 1, PIN_TEMPERATURE_1, st::PS_TemperatureHumidity::DHT22, “temperature1”, “humidity1”, false);

It makes sure the object will exist for the duration of the program rather than just the duration of the function.

2 Likes

I bought a voltage sensor that I plan to attach to my smoke detector’s siren (Nest Protect) so I can communicate to ST (as Works with Nest is no longer functional).

I am fairly new to Arduino and ST_Anything (previously programmed logic and API on a Pi with Python and just used the Arduino for SPI/I2C communication).

Any tips on what kind of approach would work best (using a ESP8226 board)? I am thinking about having a certain voltage threshold trigger a button press and send that back to ST but I am open to other implementations.

If you can tap into the Nest Protect to get a constant DC voltage when the alarm is active, then I would simply use the ST_Anything IS_Smoke device. It uses a digital input pin, so all you need to do is use a voltage divider pair of resistors, to make sure the voltage from the Nest Protect is below the Digital Input trigger threshold when there is no alarm, and above the digital input threshold when there is an alarm.

This way ST_Anything will simply create a Smoke Alarm device within SmartThings that you can use just like any other Smoke Alarm device.

1 Like

The voltage is not constant (it fluctuates as the siren beeps). Is there a simple way to use a bool to tell ST if the smoke detector went off?

int analogInput = A0; //Change if not connected to pin A0
float vout = 0.0; //do not change
float vin = 0.0; //do not change
float R1 = 30000.0; //onboard resistor 1 value
float R2 = 7500.0; //onboard resistor 2 value
int svalue = 0; //do not change

bool smoke_detected = false;
unsigned long smoke_detected_time;

void setup(){
  pinMode(analogInput, INPUT);
  Serial.begin(9600);
}

void loop(){
  svalue = analogRead(analogInput); //this reads the value from the sensor
  vout = (svalue * 5.0) / 1024.0;
  vin = vout / (R2/(R1+R2));
  if (vin >= 4.0){
    smoke_detected = true;
    smoke_detected_time = millis();
  }
  else if (millis() - smoke_detected_time > 60000)  // if it has been more than 60 seconds since last chime.
    smoke_detected = false;
  )
  Serial.print(vin,2); // prints the voltage
  Serial.println(" volts DC"); // prints the words "volts DC"
  delay(100); //delay loop for 0.1 sec

  if (smoke_detected == true){
    // TELL SMARTHINGS THAT SMOKE IS DETECTED
  }
  else{
    // TELL SMARTTHINGS THAT SMOKE IS CLEAR
  }
  
}

So at the “if (smoke_detected = true){” statement can I send the is_smoke alert to SmartThings without having a physical connection to one of the pins?

Thanks

OK, that helps


Is this sketch going to only be used for detecting the status of the smoke detector? If so, we can simply add SmartThings communications support to your existing sketch.

Thoughts?

1 Like