[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

This project has been so good for my garage door that I forget how it works…

I’ve updated my wifi SSID and need a quick refresher on how to update that info. I’m hoping that I can do it remotely, without having to pull it out of my garage?

That would depend on how long ago you set it up and whether the original sketch you wrote supports OTA updates from the Arduino IDE. Easiest way to find out would be to open your Arduino IDE and then go to Ports and see if it is picking up your board’s IP address. If you already updated the SSID and the old one isn’t broadcasting anymore, it might already be too late and you won’t be able to change it remotely.

1 Like

@Ryan780 has given you solid advice. At this point, the simplest method will probably be to rebuild the sketch using the new WiFi SSID and Password, and then connect the microcontroller to your PC via USB, and upload the new code.

Thanks guys.

Any possibility of doing what Konnected does, where if it can’t connect to the network, it starts broadcasting as an AP? Then you can do config changes from it’s webpage. Made it super easy to change wifi.

It’s definitely possible, but not a high priority for me. I believe you might be able to implement that feature directly in your sketch, without changes to ST_Anything. I seem to recall someone else posting a sketch demonstrating this.

how to add lcd to display ip then wait 30 and display CONNECTED.

So that way I know that it got a ip address and it CONNECTED to smartthings.

#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// ST_Anything Library
//******************************************************************************************
#include <Constants.h>       //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library
#include <Device.h>          //Generic Device Class, inherited by Sensor and Executor classes
#include <Sensor.h>          //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)
#include <Executor.h>        //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#include <InterruptSensor.h> //Generic Interrupt "Sensor" Class, waits for change of state on digital input 
#include <PollingSensor.h>   //Generic Polling "Sensor" Class, polls Arduino pins periodically
#include <Everything.h>      //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

#include <PS_Illuminance.h>  //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

//#include <PS_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <PS_DS18B20_Temperature.h>  //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries 
//*************************************************************************************************
//NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings)
//*************************************************************************************************
//#define LED_BUILTIN 16
//#define BUILTIN_LED 16
//
//#define D0 16  //no internal pullup resistor
//#define D1  5
//#define D2  4
//#define D3  0  //must not be pulled low during power on/reset, toggles value during boot
//#define D4  2  //must not be pulled low during power on/reset, toggles value during boot
//#define D5 14
//#define D6 12
//#define D7 13
//#define D8 15  //must not be pulled high during power on/reset

#define PIN_TEMPERATURE_1         13  //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)
#include <Wire.h> //add cld
#include <LiquidCrystal_PCF8574.h>

LiquidCrystal_PCF8574 lcd(0x27);  // set the LCD address to 0x27 for a 16 chars and 2 line display

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid     = "";                           //  <---You must edit this line!
String str_password = "";                   //  <---You must edit this line!
IPAddress ip(192, 168, 1, 170);       //Device IP Address       //  <---You must edit this line!
IPAddress gateway(192, 168, 1, 1);    //Router gateway          //  <---You must edit this line!
IPAddress subnet(255, 255, 255, 0);   //LAN subnet mask         //  <---You must edit this line!
IPAddress dnsserver(192, 168, 1, 1);  //DNS server              //  <---You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address
IPAddress hubIp(192, 168, 1, 127);    // smartthings/hubitat hub ip //  <---You must edit this line!

// SmartThings / Hubitat Hub TCP/IP Address: UNCOMMENT line that corresponds to your hub, COMMENT the other
const unsigned int hubPort = 39500;   // smartthings hub port
//const unsigned int hubPort = 39501;   // hubitat hub port

//******************************************************************************************
//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.
//******************************************************************************************
void callback(const String &msg)
{
  //  Serial.print(F("ST_Anything Callback: Sniffed data = "));
  //  Serial.println(msg);

  //TODO:  Add local logic here to take action when a device's value/state is changed

  //Masquerade as the ThingShield to send data to the Arduino, as if from the ST Cloud (uncomment and edit following line)
  //st::receiveSmartString("Put your command here!");  //use same strings that the Device Handler would send
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
  lcd.clear();
  static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

  st::Everything::debug = true;
  st::Executor::debug = true;
  st::Device::debug = true;
  st::PollingSensor::debug = true;
  st::InterruptSensor::debug = true;

  //*****************************************************************************
  //Initialize the "Everything" Class
  //*****************************************************************************

  //Initialize the optional local callback routine (safe to comment out if not desired)
  st::Everything::callOnMsgSend = callback;

  //Create the SmartThings ESP8266WiFi Communications Object
  //STATIC IP Assignment - Recommended
  st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
  st::Everything::init();

  //*****************************************************************************
  //Initialize each of the devices which were added to the Everything Class
  //*****************************************************************************
  st::Everything::initDevices();
  Wire.begin();
  int error;
  Wire.beginTransmission(0x27); //Your LCD Address
  lcd.setBacklight(255);
  lcd.clear();
  lcd.begin(16, 2);
  lcd.print("Netwrok ");
  lcd.print(str_ssid);
  lcd.setCursor(0, 1);
  lcd.print("IP ");
  lcd.println(WiFi.localIP());
  delay(5000);
  lcd.clear();
//  lcd.print(F("MAC "));
//  String strMAC(WiFi.macAddress());
//  strMAC.replace(":", "");
//  lcd.println(strMAC);
//  delay(5000);
  lcd.setCursor(0, 1);
  lcd.print("CONNECTED");
  lcd.clear();
}

//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
  //*****************************************************************************
  //Execute the Everything run method which takes care of "Everything"
  //*****************************************************************************
  st::Everything::run();
}
1 Like

The device doesn’t know if it’s connected to ST. It only knows that it’s connected to your wifi router. Take a look a the serial debug…it’s not saying that it is connected to ST. In fact, you don’t even have to have internet for it to connect to your wifi.

how to add lcd to display ip then wait 30 and display CONNECTED. win it CONNECTED to wifi.

Your bulletin_led will flash until it is connected to Wifi and then flash for each message that is sent to ST. There is no native support for an LCD display in ST_Anything. You could certainly add it yourself…but I’m not expert on LCDs in the Arduino IDE.

1 Like

but I can not get it to wait 30 then clear

Sorry…can’t help you. Maybe try an Arduino forum. Seems your problem is ESP8266 related and not ST_Anything related. Sorry.

how to I resetup my wemos d1 to smartthings.
my setup crashed.
smartthings is not keeping a record of activity.

but how to I add IR Infrared Motion Detector Sensor?

I’m sorry, I’m not really following your questions. How do you set up a Wemos D1 mini to use ST_Anything? Well, you follow the tutorial at the top of this thread.

I got it setup but smartthings is not keeping a record of activity.
how to I add IR Infrared Motion Detector Sensor?

Sorry, there’s a tutorial at the top of the thread. I am not going to re-hash what is already posted. Try reading through some of the 2400 posts on this thread. You’ll find your answer, I promise.

#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// ST_Anything Library
//******************************************************************************************
#include <Constants.h>       //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library
#include <Device.h>          //Generic Device Class, inherited by Sensor and Executor classes
#include <Sensor.h>          //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)
#include <Executor.h>        //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#include <InterruptSensor.h> //Generic Interrupt "Sensor" Class, waits for change of state on digital input 
#include <PollingSensor.h>   //Generic Polling "Sensor" Class, polls Arduino pins periodically
#include <Everything.h>      //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

#include <PS_Illuminance.h>  //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

//#include <PS_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <PS_DS18B20_Temperature.h>  //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries 
//*************************************************************************************************
//NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings)
//*************************************************************************************************
//#define LED_BUILTIN 16
//#define BUILTIN_LED 16
//
//#define D0 16  //no internal pullup resistor
//#define D1  5
//#define D2  4
//#define D3  0  //must not be pulled low during power on/reset, toggles value during boot
//#define D4  2  //must not be pulled low during power on/reset, toggles value during boot
//#define D5 14
//#define D6 12
//#define D7 13
//#define D8 15  //must not be pulled high during power on/reset

#define PIN_TEMPERATURE_1         13  //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)
#include <Wire.h> //add cld
#include <LiquidCrystal_PCF8574.h>

LiquidCrystal_PCF8574 lcd(0x27);  // set the LCD address to 0x27 for a 16 chars and 2 line display

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid     = "";                           //  <---You must edit this line!
String str_password = "";                   //  <---You must edit this line!
IPAddress ip(192, 168, 1, 170);       //Device IP Address       //  <---You must edit this line!
IPAddress gateway(192, 168, 1, 1);    //Router gateway          //  <---You must edit this line!
IPAddress subnet(255, 255, 255, 0);   //LAN subnet mask         //  <---You must edit this line!
IPAddress dnsserver(192, 168, 1, 1);  //DNS server              //  <---You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address
IPAddress hubIp(192, 168, 1, 127);    // smartthings/hubitat hub ip //  <---You must edit this line!

// SmartThings / Hubitat Hub TCP/IP Address: UNCOMMENT line that corresponds to your hub, COMMENT the other
const unsigned int hubPort = 39500;   // smartthings hub port
//const unsigned int hubPort = 39501;   // hubitat hub port

//******************************************************************************************
//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.
//******************************************************************************************
void callback(const String &msg)
{
  //  Serial.print(F("ST_Anything Callback: Sniffed data = "));
  //  Serial.println(msg);

  //TODO:  Add local logic here to take action when a device's value/state is changed

  //Masquerade as the ThingShield to send data to the Arduino, as if from the ST Cloud (uncomment and edit following line)
  //st::receiveSmartString("Put your command here!");  //use same strings that the Device Handler would send
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
  lcd.clear();
  static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

  st::Everything::debug = true;
  st::Executor::debug = true;
  st::Device::debug = true;
  st::PollingSensor::debug = true;
  st::InterruptSensor::debug = true;

  //*****************************************************************************
  //Initialize the "Everything" Class
  //*****************************************************************************

  //Initialize the optional local callback routine (safe to comment out if not desired)
  st::Everything::callOnMsgSend = callback;

  //Create the SmartThings ESP8266WiFi Communications Object
  //STATIC IP Assignment - Recommended
  st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
  st::Everything::init();

  //*****************************************************************************
  //Initialize each of the devices which were added to the Everything Class
  //*****************************************************************************
  st::Everything::initDevices();
  Wire.begin();
  int error;
  Wire.beginTransmission(0x27); //Your LCD Address
  lcd.setBacklight(255);
  lcd.clear();
  lcd.begin(16, 2);
  lcd.print("Netwrok ");
  lcd.print(str_ssid);
  lcd.setCursor(0, 1);
  lcd.print("IP ");
  lcd.println(WiFi.localIP());
  delay(5000);
  lcd.clear();
//  lcd.print(F("MAC "));
//  String strMAC(WiFi.macAddress());
//  strMAC.replace(":", "");
//  lcd.println(strMAC);
//  delay(5000);
  lcd.setCursor(0, 1);
  lcd.print("CONNECTED");
  lcd.clear();
}

ware do add Motion code?

Ahhhh, @bob5731 is back! :slight_smile:

Bob - literally EVERY one of my example 'ST_Anything_Multiples…" sketches includes an example of using a motion detector device. Just take a look at the ST_Anything_Multiples_ESP8266WiFi.ino sketch as a starting point. Your sketch does not #include some of the libraries needed to use the IS_Motion device. You’ll need to make sure you add those lines to your sketch as well. In fact, the more I look at it, the sketch you posted is actually missing quite a few required sections of code. Just start with the example sketch and modify from there. For LCD additions, I offer no support. Other users have successfully added LCD screens. You’ll need to search through the ST_Anything threads here in the community for examples of those.

Good Luck and Happy Holidays!

1 Like

Dan,

Thanks for helping me to get my Arduino Mega working with ST_Anything a while back. I’m using it to monitor all the existing contact wires on my built-in alarm system. After I installed it, I tested that all the doors and windows were being reported to SmartThings.

Today, I opened a window and noticed that it wasn’t reported as open to SmartThings! After checking wiring and voltages were okay, I finally reset the Arduino and everything went back to normal and window reported as open.

My question is, how would you suggest monitoring that the Arduino is running ST_Anything correctly?

I would have never known my Arduino needed to be reset if I hadn’t opened a window and noticed it wasn’t being reported to ST.

Fortunately, we’re still using our built-in alarm system and we weren’t relying on the Smart Home Monitor.

Perhaps some sort of virtual watchdog device which sends a text or notification if it’s not updated by ST_Anything for an hour?

You should be able to create a webCoRE piston to monitor your devices and then send a text message if their values don’t change. I don’t use webCoRE, but there is a forum dedicated to its use. I’m sure someone could help you create a quick piston if you’re not a webCoRE user.

This is the app I use for that. Worked every time one of my ST_Anything boards got locked up for some reason.

1 Like