[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Is there a way to set the Hostname on an esp32 or 8266? When I go into my router the names are all the same like “espressif” and hard to tell which is which. Calling WiFi.setHostname(“myname”); after the setting the ssid and password doesn’t compile.

I have not tried to precompile the hostname, and to make it worse I have not programmed an esp for several months. What I did do, is once the device connected in my router, I can change the hostname there for ease of administration in the router

But looking into the library files, I believe the command looks like WiFi.hostname(st_devicename); as found in the Smartthings8266WiFi.cpp

Based upon that, I think your call should be WiFi.hostname(“myname”);

https://github.com/esp8266/Arduino/issues/2826 kind of confirms this for me. I don’t have any active projects to try this out to confirm.

Good luck

Just tried that, same compile error:
exit status 1
stray ‘\342’ in program

@kampto did you already post your code? I will try setting up an 8266 with that line added here shortly

Actually im using an esp32. Its and NTP clock with large 7-seg LED’s. My use of the ST anything code is a bit unconventional so I get more control.
Here’s the full code

 /* 
Tom K.  April 2015
WiFi Clock
BOARD INFO: "Adafruit esp32 feather" or TTGO Clone.  CPU freq 80Mhz, Flash 4M,  Upload Speed 921600
  Adafruit 7-seg backback https://learn.adafruit.com/adafruit-led-backpack/1-2-inch-7-segment-backpack
  For clock NTP grab use start with this example:  https://lastminuteengineers.com/esp32-ntp-server-date-time-tutorial/
ST_ANYTHING INFO: Github set up info  https://github.com/DanielOgorchock/ST_Anything/blob/master/README.md
  ST_Anything info:  https://community.smartthings.com/t/release-st-anything-v2-8-arduino-esp8266-esp32-to-st-via-thingshield-ethernet-or-wifi/77707
FUNCTION: Displays time down to msec on large LED's, periodically displays temp and humidity, send temp and humidity to smarthings hub, has button to set daylight saving time offsey.
          Periodically WiFi pools the real NTP time time to keep the millis accurate
REVISIONS:
Sept13-2016: Initial inception and build, small 7-seg LED, Uno board
July14-2017: Mega board, serial esp-01, and Big LED's. NTP clock using WiFiUDP.h
Oct20-2018: Set up ST_Anything on Mega
July12-2019: Converter to esp32 board for more reliable connectivity, switch to time.h library, add daylights savings change button
Mar24-2020: Add client to server communication for Arduino to Arduino,  added button to set the Dayllight savings offset
*/

//******************************* Adafruit i2c 7-Seg library requirements ***************************
#include <Wire.h> 
#include <Adafruit_GFX.h>
#include "Adafruit_LEDBackpack.h"
#include "time.h"

//********************************************  ST_Anything Librarys **********************************************
#include <SmartThingsESP32WiFi.h>  // SmartThings Library for ESP32 boards.  Use " " if library is custom and local 
#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_TemperatureHumidity.h>  //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
//#include <IS_Motion.h>       //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor on a digital input pin
//#include <IS_Contact.h>      //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin
//#include <IS_Button.h>       //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses
#include <EX_Switch.h>       //Implements an Executor (EX) via a digital output to a relay
#include <EX_Alarm.h>        //Implements Executor (EX)as an Alarm capability with Siren and Strobe via digital outputs to relays
#include <S_TimedRelay.h>    //Implements a Sensor to control a digital output pin with timing/cycle repeat capabilities

Adafruit_7segment matrix1 = Adafruit_7segment(); // For Adafruit 7-seg i2c
Adafruit_7segment matrix2 = Adafruit_7segment(); // For Adafruit 7-seg i2c

//***************************************** Adafruit Feather ESP32 Pins ***********************************************
//#define xxxxxx      A13 // GPI35 or A13, - Internal Fetaher pin, used for internal Bat voltage Divider, The voltage is divided by 2.
//#define Button1       34 // GPI #34 or A2, Note it is not an output-capable pin!
#define DHTpin        4 // GPIO #4 or A5, AI only
//#define xxxxxx      A0 // GPIO #26 or A0, AI & AO an analog output DAC2 
//#define xxxxxx      A1 // GPIO #25 or A1, AI & AO an analog output DAC1
//#define xxxxxx      A3 // GPI #39 or A3, Note it is not an output-capable pin!
//#define xxxxxx      A4 // GPI #36 or A4, Note it is not an output-capable pin!
#define Button1       21 // GPIO #21, General purpose IO
//#define xxxxxx      13 // GPIO #13 or A12, It's also connected to the red LED next to the USB port
//#define xxxxxx      12 // GPIO #12 or A11. has a pull-down resistor built int, recommend as output only, or sure that the pull-down is not affected during boot.
#define ST_Messege      27 // GPIO #27 or A10
//#define xxxxxx      33 // GPIO #33 or A9. It can also be used to connect a 32 KHz crystal.
//#define xxxxxx      15 // GPIO #15 or A8,  Use this as the STI trigger pin, not hooked up to anything
//#define xxxxxx      32 // GPIO #32 or A7. It can also be used to connect a 32 KHz crystal.
//#define xxxxxx    14 // GPIO #14 or A6
//#define xxxxxx      12 // GPIO #12, has an internal pulldown, Bootloading on Feather, or output only
//SDA                 23 // SDA I2C (Wire) data pin, Adafruit Feather Specific?
//SCL                 22 // SCL I2C (Wire) clock pin, Adafruit Feather Specific?
//MOSI                18 // MOSI SPI Master-Out-Slave-In, Adafruit Feather Specific?
//MISO                19 // MISO SPI Master-In-Slave-Out, Adafruit Feather Specific?
//RX                  16 // RX receive (input) pin, Adafruit Feather Specific?
//TX                  17 // TX transmit (output) pin, Adafruit Feather Specific?
//SCK                 5  // SCK SPI Clock, Adafruit Feather Specific?
//EN                  // this is the 3.3V regulator's enable pin. It's pulled up, so ground to disable the 3.3V regulator

//// DHT (non-i2c) Temp and Humidity, DHT Pin1 = Vcc, Pin2 = Data, Pin4 = gnd, Connect a 10K resistor from pin 2 (data) to pin 1 (power)
#include "DHTesp.h" // DHT Library specific for esp32 boards 
DHTesp dht;
float humid1; // Humidity
float DHT_TempC; // Temp in C
float temp1; // Temp in F

const char* ntpServer = "pool.ntp.org";
long  gmtOffset_sec = -28800; // California, -7hrs + Daylight savings    // < ------------- YOU MUST SET THIS
const int   daylightOffset_sec = 0; // 0 or -3600              // This didnt work!!
bool DaylightSavngs = false;
int RFrssi;
const byte SenderID = 5; //  ID of this station                                 <------You must edit this line!

// TIMERS and CLOCK
unsigned long TempTimeDelay = 60000; // For temp display
unsigned long TempTimer = 0;  // For temp display
unsigned long NTPpollDelay = 300000; // Set long to reduce polling internet traffic, millis will calc the minute in between
unsigned long NTPpollTimer = 0;  
unsigned long TempReadTimer = 0; 
unsigned long TempReadDelay = 120000; // Wait Time for local Temp reads
unsigned long STSendTimer = 0; 
unsigned long STSendDelay = 310000; // Wait Time for local Temp reads
unsigned long SerialTimeTimer = 0; // only serial print in intervals otherwise IDE seril monitor will overload
unsigned long SerialTimeDelay = 30000;
unsigned long ClientSendTimer = 0; // For wifi data sends, non-ST
unsigned long ClientSendDelay = 480000;

int Hour = 0;
int Minute = 0;
int Second = 0;
unsigned long DisplayMsec = 0;
int DisplayTime = 0;
int DisplaySeconds = 0;
unsigned long Msec = 0; 
byte DisplayState = 0;

char HourAndMinuteString[6]; //5 digits plus the null char
char SecondAndMsecString[6]; //5 digits plus the null char

//******************************** ESP8266 WiFi Information **********************************************
String str_ssid     = "xxxx";       //                                        <------You must edit this line!
String str_password = "xxxxxxxxxxxxx";  //                                        <------You must edit this line!
//WiFi.hostname(“NTPclock”);  // ************* Doesnt Work
IPAddress ip(192, 168, 0, 153);       //Device IP Address                       <------You must edit this line!
IPAddress gateway(192, 168, 0, 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, 0, 1);  //DNS server                              <------You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on
// Smartthings Hub Information
IPAddress hubIp(192, 168, 0, 150);    // smartthings hub ip                     <------You must edit this line!
const unsigned int hubPort = 39500;   // smartthings hub port
// Server info, where the non ST data goes
IPAddress server(192,168,0,155);      // fixed IP address of arduino server     <------You must edit this line!
WiFiClient client; // to connect to server

struct tm timeinfo; // Call out NTPclock get structure

//************************** ************  Arduino Setup() routine ************************************************
void setup(){
  Serial.begin(115200); 
  Serial.println("Setting Up!!!!!!!!!");
  
  dht.setup(DHTpin, DHTesp::DHT22);
  Serial.println("DHT initiated............");
  //Wire.begin(23,22); // Feather32 board SCL->22 and SDA->23 with a revised Wire.begin(SDA,SCL)
  Wire.begin(); // Feather32 board SCL->22 and SDA->23 with a revised Wire.begin(SDA,SCL)

  pinMode(Button1, INPUT_PULLUP); // 
  pinMode(ST_Messege, INPUT); 
  
//// ESP32 ADC Set-up
  analogReadResolution(11); // Set pin Resolution. Default of 12 is not very linear. 12 = 0-4095, 11 = 0-2047, 10 = 0-1024, 9 = 0-512 
  analogSetAttenuation(ADC_11db);  // Sets attenuation for all pins. 11db=0-3.3v, 6dB=0-2.2v, 2.5db=0-1.5v, 0db= 0-1v, Default is 11db which is noisy. 
    
//Initialize the Adafruit LED display i2c  device(s)
   matrix1.begin(0x70); // Address the Adafuit 7-seg i2c display, Default no jumper
   matrix1.setBrightness(2); // 0 is least bright, 15 is brightest 
   matrix2.begin(0x74); // Address the Adafuit 7-seg i2c display, Short A2 jumper
   matrix2.setBrightness(2); // 0 is least bright, 15 is brightest 

//SPECIAL sensors/executors (uses portions of both polling and executor classes)
  static st::S_TimedRelay           sensor2(F("relaySwitch1"),ST_Messege, LOW, false, 2000, 0, 1); // Low = init stae, false = no inverted logic, 10000 on time
  //static st::S_TimedRelay           sensor22(F("relaySwitch2"), PIN_TIMEDRELAY_2, LOW, true, 3000, 0, 1);

//EXECUTORS
  //static st::EX_Switch              executor1(F("switch1"), PURGEBUTTON, LOW, false);  // LOW = "initial state off", false = no inverted logic
  //static st::EX_Switch              executor2(F("switch2"), PIN_SWITCH_2, LOW, true);
 
//********************************** Configure debug print output from each main class  *******************************************
  st::Everything::debug=true;
  st::Executor::debug=true;
  st::Device::debug=true;
  st::PollingSensor::debug=true;
  st::InterruptSensor::debug=true;

//*************************************Initialize the "Everything" Class****************************************
   //Create the SmartThings ESP32 Communications Object,  STATIC IP Assignment - Recommended
   st::Everything::SmartThing = new st::SmartThingsESP32WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
  
   //DHCP IP Assigment - Must set your router's DHCP server to provice a static IP address for this device's MAC address
   //st::Everything::SmartThing = new st::SmartThingsESP32WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);
   
st::Everything::init();  //Run the Everything class' init() routine which establishes Ethernet communications with the SmartThings Hub
  
//********************************Add each sensor to the "Everything" Class*********************************************
  //st::Everything::addSensor(&sensor1);
  st::Everything::addSensor(&sensor2);
 
//******************* Add each executor to the "Everything" Class******************************************
  //st::Everything::addExecutor(&executor1);
  //st::Everything::addExecutor(&executor2);
  
st::Everything::initDevices(); //Initialize each of the devices which were added to the Everything Class

NTPclock(); // Start off with getther NTP time

}

//****************************************  Arduino Loop() routine **************************************************
void loop(){
  sensorReads(); //FUNCTION
  STsend(); // FUNCTION
  ClientSend();
 
//// Daylight Savings offset Button push
  if ((digitalRead(Button1) == LOW) && (DaylightSavngs == false)) {DaylightSavngs = true; gmtOffset_sec = -25200; Serial.println(F("...Button Pushed...")); delay(2000); NTPclock();}
  if ((digitalRead(Button1) == LOW) && (DaylightSavngs == true)) {DaylightSavngs = false; gmtOffset_sec = -28800; Serial.println(F("...Button Pushed...")); delay(2000); NTPclock();}
  
  st::Everything::run();  //Execute the Everything run method which takes care of "Everything"

//// NTP pooling and temp/humid display timers
  if (digitalRead(ST_Messege) == HIGH) {TempTimer = (millis() - TempTimeDelay); Serial.println(F("...ST Messege Recieved...")); }  // if switched from ST, Write temp to big display
   
    if (millis() - NTPpollTimer < NTPpollDelay && DisplayState == 0) {ClockDisplay(); }  // Display Time running on millis()
    else if (millis() - NTPpollTimer > NTPpollDelay) {NTPclock(); NTPpollTimer = millis();}  // Get new refernce from NTP
    
    if ((millis() - TempTimer >= TempTimeDelay) && DisplayState == 0) {refreshDisplay(); DisplayState = 1; }  
    else if ((millis() - TempTimer < TempTimeDelay + 5000) && DisplayState == 1) {BigTempHumid(); }  
    else if ((millis() - TempTimer > TempTimeDelay + 5000) && DisplayState == 1) {refreshDisplay(); TempTimer = millis(); DisplayState = 0; } 
              
  }

//****************************************** Read Sensors ********************************************  
void sensorReads() {
  if (millis() - TempReadTimer > TempReadDelay) {
     RFrssi = WiFi.RSSI();
//// DHT Temperature and Humidity Read
      delay(dht.getMinimumSamplingPeriod());
      float humidity = dht.getHumidity();
      float temperature = dht.getTemperature();
      Serial.print(F("DHT Humidity = "));Serial.print(humidity, 1); Serial.println(F(" %"));
      Serial.print(F("DHT Temp = "));Serial.print(temperature, 1); Serial.println(F(" *C"));
      Serial.print(F("DHT Temp = "));Serial.print(dht.toFahrenheit(temperature), 1); Serial.println(F(" *F"));
      humid1 = humidity; DHT_TempC = temperature; temp1 = (dht.toFahrenheit(temperature)); // Assign to global variables
   TempReadTimer = millis();
  }
}

//****************************************** Send Data to ST ********************************************  
void STsend() {
  if (millis() - STSendTimer > STSendDelay) {
    if ((temp1 > -30) && (temp1 < 160)) {String STtemperature1("temperature1 " + String(temp1)); st::Everything::sendSmartString(STtemperature1);} //
    if ((humid1 > 0) && (humid1 < 101)) {String SThumidity1("humidity1 " + String(humid1)); st::Everything::sendSmartString(SThumidity1);} //
  STSendTimer = millis();
  }
}

//****************************************** Send Data to Arduino Server ****************************************
void ClientSend() {
  if (millis() - ClientSendTimer > ClientSendDelay) {
  client.connect(server, 23); 
  String strSenderID("SenderID"); strSenderID.concat(" "); strSenderID.concat(SenderID);
  String strtemp1("temp1"); strtemp1.concat(" "); strtemp1.concat(temp1);
  String strhumid1("humid1"); strhumid1.concat(" "); strhumid1.concat(humid1);
  String strRFrssi("RFrssi"); strRFrssi.concat(" "); strRFrssi.concat(RFrssi);

  Serial.println(""); Serial.println("..........Sending Variables to Server");
  client.println("Starting Data Stream");
  client.println(strSenderID); Serial.println(strSenderID); // Need to send ID first
  client.println(strtemp1); Serial.println(strtemp1); 
  client.println(strhumid1); Serial.println(strhumid1); 
  client.println(strRFrssi); Serial.println(strRFrssi); 

  client.flush();
  client.stop(); 
  Serial.println("..........Disconnecting"); Serial.println("");
  delay(7); // add appropriate delay here before sending next data element
  ClientSendTimer = millis();
  }
}

//*********************************** Big Temperature Display ****************************
void BigTempHumid() {
///Temp
  matrix1.print(temp1); 
  matrix1.writeDigitRaw(4, 0b0000000001110001); // 0b0000000001110001 = F, 0b0000000011110110 = H, look in backpack.cpp file for others characters
  matrix1.writeDigitRaw(2, 0x02); // location 2 is for dots, 0x02 center colon (both dots), 0x04 left colon lower dot, 0x08 left colon upper dot, 0x10 decimal point 
  matrix1.writeDisplay(); // required to update display
///Humid  
  matrix2.print(humid1); 
  matrix2.writeDigitRaw(4, 0b0000000011110110); // 0b0000000001110001 = F, 0b0000000011110110 = H, look in backpack.cpp file for others characters
  matrix2.writeDigitRaw(2, 0x02); // location 2 is for dots, 0x02 center colon (both dots), 0x04 left colon lower dot, 0x08 left colon upper dot, 0x10 decimal point 
  matrix2.writeDisplay(); // required to update display
 }

//*************************************** Big Clock Display ***********************************
void ClockDisplay() {

  Msec = ((millis() - NTPpollTimer)/10); // get 100th of second in between NTP calls

  String strMsec(Msec);
  if (Msec - DisplayMsec  >99) {DisplayMsec = Msec; Second = Second + 1;}
  if (Msec < 1000) {strMsec.remove(0,1);}  // Strip out seconds as it incriments
  else if (Msec < 10000) {strMsec.remove(0,2);}
  else if (Msec < 100000) {strMsec.remove(0,3);}  
  Msec = strMsec.toInt();
  
  if (Second > 59) {Second = 0; Minute = Minute + 1;}
  if (Minute > 59) {Minute = 0; Hour = Hour + 1;}
  if (Hour >23) {Hour = 0;}

   sprintf(HourAndMinuteString, "%02d%02d", Hour, Minute); // Add leading zero if needed
   String strTime(HourAndMinuteString);
   DisplayTime = strTime.toInt();

   sprintf(SecondAndMsecString, "%02d%02d", Second, Msec); // Add leading zero if needed
   String strTimeSec(SecondAndMsecString);
   DisplaySeconds = strTimeSec.toInt();
  
  //// Display 1 Hr + Min
  matrix1.print(DisplayTime);
  matrix1.drawColon(true); // colon
  if (Hour < 10 ) {matrix1.writeDigitNum(0, 0); } //Write 0 in first digit
  matrix1.writeDisplay(); // required to update display

  //// Display 2 Sec + Msec
   matrix2.print(DisplaySeconds);
   matrix2.writeDigitRaw(2, 0x02 | 0x04 | 0x08); // center colon, left lower dot colon, left upper dot colon
   if (Second < 1 ) {matrix2.writeDigitNum(0, 0); matrix2.writeDigitNum(1, 0);} // Write 00
   if (Second < 10 ) {matrix2.writeDigitNum(0, 0); } //Write 0
   matrix2.writeDisplay(); // required to update display

//// Serial Prints of NTP time
  if (millis() - SerialTimeTimer > SerialTimeDelay) {
    Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
    Serial.println(&timeinfo, "%H:%M:%S");
    //Serial.println(strDisplayHour);
    Serial.print(HourAndMinuteString); Serial.println(" HourAndMinuteString");
    Serial.print(DisplaySeconds); Serial.println(" DisplaySeconds");
    //Serial.print(Second); Serial.println(" Second");
    Serial.print(Msec); Serial.println(" Msec");
    SerialTimeTimer = millis();
  }

}


//***************************************** Display Refesh *******************************************
void refreshDisplay() {
  
  for (int m=0; m<4; m++){
  for (int k=0; k<6; k++){
  matrix1.clear(); // Clear display
  if (k==2) {k++;} // incriment if 2 becuase 2 is the dots
  matrix1.writeDigitRaw(k, 0b0000000011000000); // write "-" to digit
  matrix1.writeDisplay(); // required to update display
  delay(20);
    }
  for (int k=0; k<6; k++){
  matrix2.clear(); // Clear display
  if (k==2) {k++;} // incriment if 2 becuase 2 is the dots
  matrix2.writeDigitRaw(k, 0b0000000011000000); // write "-" to digit
  matrix2.writeDisplay(); // required to update display
  delay(20);
  }
 }
}

//***************************************** UDP NTP Clock Recieve *******************************************
void NTPclock() {
  
  configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); //init and get the time
  
  if(!getLocalTime(&timeinfo)){Serial.println("Failed to obtain time"); return; }
  Serial.print(" Aquired NTP Time!! "); Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");

  //// Convert compenets to integers for later calculations
  char HourStringBuff[3];  strftime(HourStringBuff, sizeof(HourStringBuff), "%H", &timeinfo);
  char MinStringBuff[3];  strftime(MinStringBuff, sizeof(MinStringBuff), "%M", &timeinfo);
  char SecStringBuff[3];  strftime(SecStringBuff, sizeof(SecStringBuff), "%S", &timeinfo);
  String strHour(HourStringBuff);
  String strMinute(MinStringBuff);
  String strSecond(SecStringBuff);

  Second = strSecond.toInt();
  Minute = strMinute.toInt();
  Hour = strHour.toInt();

/*
%A  returns day of week
%B  returns month of year
%d  returns day of month
%Y  returns year
%H  returns hour
%M  returns minutes
%S  returns seconds
*/
  NTPpollTimer = millis(); // reset NTP polling timer so it doesnt constant poll 
 }

I’m having trouble using the basic demo script for the ultrasound device… I have an HC-SR04…

Smartthings found it, but doesn’t respond to motion events… :man_facepalming:

@kampto try moving your code into the void setup() area

also, I think your original code was correctly syntaxed as

WiFi.setHostname(“NTPclock”);

@danielccm what do you mean by

Smartthings found it

Also, is the parent showing up as present in the app?

Yes, you can easily set the Microcontroller Hostname in the sketch, by simply adding a parameter to the following line of code…

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

make it look like…

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

change the “ESP32Wifi” to whatever name you’d like. That’s it! :slight_smile:

UPDATE: This may only work on the ESP8266, not the ESP32… Let me take a deeper look…

I just confirmed adding “devicename” to the end of the IP assignment doesn’t compile either with esp32. This isnt a big deal having the name but more of a convenience troubleshooting thing. Thanks.

I have updated my GitHub repo with new versions of the “SmartThingsESP32WiFi” library files. Please grab both the new .h and .cpp files. Modify your sketch’s setup() routine as shown above.

Currently, I have mixed results with this using my new Unifi Dream Machine network. If you comment out the static IP line, and uncomment the DHCP line, and add the Hostname as shown above, it works. My Unifi network shows the client with the correct host name. If I tried it with a static IP address, my Unifi system showed the name as the device MAC address.

Give it a try and let me know what you see, please.

Thanks… I loaded your new library, closed IDE and reopened. It compiled this time. Uploaded new sketch with the name at the end of IP assignment. Rebooted router. Powered up the device. Unfortunately still showing up as “espressif”. Could be the router hanging onto old names. Will play with it some.

Did you switch to DHCP in the sketch? It will require A DHCP Address Reservation in order to guarantee the IP address of the ESP32 does not change. Just a test to see if it makes a difference for you, like it did for me.

Hells Yes! DHCP mode worked. Name shows up on router even without a reboot! Thanks.

1 Like

After reading a ton… I have to ask…

Right now I’m controlling my Somfy RTS shades with Domoticz and importing them into ST… I am banging my head against a brick wall to do the same with my newly installed 433MHz controlled Faro Barcelona Lantau ceiling fan…

I’ve read this development (of which I’m already a huge fan and have started using it, THANKS) could control 433MHz devices somehow?

I have done a quick search in Amazon and found this:

https://www.amazon.es/s?k=arduino+433mhz&__mk_es_ES=ÅMÅŽÕÑ&crid=2OGQXEQIOAP83&sprefix=arduino+433%2Caps%2C212&ref=nb_sb_ss_ac-o-p_1_11

What reference should I get to pair it with an arduino uno, nano or ESP8266-01S? (The ones I have laying around at the moment)

Or is there a device I should look out for that has wifi/Ethernet + 433 + anything else I could need for this task?

Thanks again!!!

First, I really have no idea if it is possible to control your new 433MHz ceiling fan with ST_Anything. The only support I have added was to control a simple On/Off 433MHz outlet using the RCSwitch Arduino library.

Here are the details of that work from many. many years ago. I do not use it nor do I know of anyone who is till using it.

and this is the Arduino library

Personally, I would look at some of the commercial off-the-shelf devices that are designed to bridge smart home platforms with RF devices. Have you looked at Bond?

1 Like

I’ll take a look!

Thanks for all that info!!!

I did look at bond… Too expensive for what it does… :sweat_smile::sweat_smile:

1 Like

Hi Dan (and all), I’m wondering if it is possible to combine multiple relays (and possibly sensors) into a single device. I have 2 use cases, both for a new house designed and wired especially for ST_Anything!

Wired Window Shades: Each shade uses two switches (or Timed Relays), one for Up and one for Down. Instead of showing up as two different switches, it would of course be fantastic if it were to be interpreted by ST and HE (I’m using both in two different locations) as a single Window Shade with “Up” and “Down” functions instead of two “On” and “Off” switches.

Latching relays: Latching/bistable relays have 2 coils in them: one that is pulsed to turn on, and one that is pulsed to turn off. Right now the only way to do this from ST_Anything is to treat them as two different switches. Once again, that’s very confusing on the hub interface side of things. It would be much better if they showed up as a single switch, where toggling it to the “On” state sent a momentary activation to one relay/coil and toggling it to the “Off” state sent a momentary activation to the second relay/coil. Because DPDT latching relays could also be used to send back confirmation to the Arduino of the state it’s in (which can currently be done by adding a third device in ST_Anything, a contact sensor), it would be even better if it were possible to incorporate a contact sensor into a single device.

I have no idea if this is possible to accomplish or not, but I have a number of both devices in the new house, and am looking for a cleaner way to integrate them than using multiple ST_Anything devices for what are essentially single devices. Thanks in advance!

Yes, these requests are possible…but would require quite a bit of code to implement on both the Arduino side, as well as possibly the ST DTH side. With all of the recent announcements regarding SmartThings direction regarding their Legacy Platform (upon which ST_Anything is built), I really do not have any motivation to put a lot of effort into something that will need a massive rewrite over the next 12 months.

Since I have my house running 100% on Hubitat these days, there is not a lot of incentive for me to rewrite ST_Anything to work with the New ST Platform API. I may take a look at it out of pure curiosity, but I make no promises to anyone that ST_Anything will continue to work after the Legacy Groovy Platform is shut down.

Of course, I will continue to maintain it on Hubitat as that is what I depend on. I have been happy to keep things working on SmartThings for over 2 years since I moved to Hubitat. However, this change may be the ‘straw that breaks the camel’s back’, so to speak.

Thank you for your reply, Dan. The new house I speak of is on Hubitat, so I should have posted this on that thread. I will do so! I’ll make the switch at my current place over to Hubitat at some point as well, so really, if this is possible to implement on Hubduino (only), I’d be immensely grateful!

1 Like