[Release] HubDuino v1.1.9 - Hubitat to Arduino / ESP8266 / ESP32 / ThingShield Integration (ST_Anything)

Basically, you connect the sonoff to your PC the same way you would for Tasmota. In the Arduino IDE, you just have to set your board type to Generic ESP8266 and then upload your Hubduino sketch. Just remember that you have to put the board in flash mode manually by holding down the button as you power it up.

Cool! Thanks for the info.

1 Like

@ogiewon
I have a couple dozen of nice momentary switches and somehow only some big ugly flip switches, so I'm wanting to use the mom-switches if possible. I'm asking is there a simple way of toggling the output that way? I've really not had time to look into the coding much, plus I'm really just a simple coder at that, frankly your code is way over my head.

In the past I've used something like the following to do this:

void loop(){
// ledState ^= HIGH; Works Not tested
currentState = digitalRead(buttonPin); //Get current state of button
if (currentState == HIGH && lastState == LOW){ //if button has just been pressed
//Serial.println("pressed"); //Print if button is pressed
delay(1); //crude form of button debouncing

//toggle the state of the LED
if (ledState == HIGH){            // If led is high then
  digitalWrite(ledPin, LOW);      // set led to low    
  ledState = LOW;                 // save state
} else {                          // else it's low
  digitalWrite(ledPin, HIGH);     //so set led to high
  ledState = HIGH;                //save state
}

}

lastState = currentState; //save surrent state
}

@ogiewon
I'm trying to have a backup method to turn a switch on/off. I'm thinking of having a Hubduino board running a relay to control the power supply for my hub. But obviously if the hub is locked up, I wouldn't be able to switch it in Hubitat. I've been trying to figure out how to do it from a curl command but I can't seem to get it to work. I'm trying:
http://Ip.Of.BOARD:8090/switch3%20on
But switch 3 isn't switching. I'm sure I'm missing something little. Thanks!

There is a preamble and postamble character, IIRC.

Use a ‘/‘ preamble (no quotes) and a ‘?’ postamble.

Here’s the Groovy code that does it...

def sendEthernet(message) {
    if (message.contains(" ")) {
        def parts = message.split(" ")
        def name  = parts.length>0?parts[0].trim():null
        def value = parts.length>0?parts[1].trim():null
        message = name + "%20" + value
    }
	if (logEnable) log.debug "Executing 'sendEthernet' ${message}"
	if (settings.ip != null && settings.port != null) {
    	new hubitat.device.HubAction(
    		method: "POST",
    		path: "/${message}?",
    		headers: [ HOST: "${getHostAddress()}" ]
		)
    }
    else {
    	log.warn "Parent HubDuino Ethernet Device: Please verify IP address and Port are configured."    
    }
}

Take a look at this example sketch...

1 Like

Yeah, I saw that part...I think I'm just missing the "?".

Yup! That was it. Just totally missed it when looking at the code in Hubitat.

1 Like

Greetings to all

Dan and all:

I have an appliance that has two touch panel switches for power ON/OFF and for the light ON/OFF. I am planning to utilize ST_Anything switches (either push button or relay) in parallel to these touch switches. These two switches are Capacitive Touch type.

So, I am planning to use a ST_Anything switch or push button with an appropriate valued ceramic capacitor in series, like less than 1 pf. This network will be parallel to the capacitive switch on the panel. So, please share me your thought, knowledge, experience and suggestions. Thank you.

@titoinus I can't help with the wiring/circuitry on this one, as I don't have any experience with capacitive touch devices.

However, I can recommend you use "S_TimedRelay" to handle the digital output. The nice thing about this ST_Anything device class is that while it looks like a normal 'switch' device within Hubitat, it automatically turns itself off within the Arduino code. This ensures that the output is not left 'on' for more than is required. It also keeps Hubitat fully up to date with the correct status of the 'switch' device. You can see an example of its use in the ST_Anything_Multiples_ESP8266WiFi.ino sketch.

Thanks Dan for your prompt reply. I will follow your suggestions. Hope to start this project in 2-3 weeks as long we handle current global health issue. Thanks again

That was the sketch I was using. Just figured it didn't do what I thought it was supposed to do. Traced the problem down to the D1 wemos that developed schizophrenia tendencies, replaced it and now it's working like I should.
Actually it was a bad power supply letting about 2 volts of AC in, the D1 didn't like that at all. That's what I get for not checking the junk box wall wart before using.

Thank you for making me check everything out

1 Like

I have zero experience with the 5200 shields. A quick search shows that you’re not alone in trying to figure out this odd-duck.. :wink:

https://forum.arduino.cc/index.php?topic=587771.0

@ogiewon

Problem today led me to a feature request if possible.

I have some in-wall wifi switches running Hubduino (simple on/off switch just like a sonoff basic). Today a few lost wifi connectivity for some reason. They were controllable locally but wouldn't respond via hubitat.

Would it be possible to code in a watchdog routine that would monitor the switch for a long press 5-10 seconds and reset the esp8266 rather than having to flip circuit breakers?

Mike

If you’re using these as in wall switches, you must have custom code in the sketch already to accept a momentary digital input, right? Or are you using a HubDuino “Button” device and having Hubitat toggle the switch state?

Either way, you should be able to code something into the sketch’s loop() to look for a really long press, and the issue some sort of reset (if possible.)

No just using your st anything relays buttons example sketch. I just made adjustments to the code for the proper GPIO pins for the button and relay.

Would you suggest putting an additional "IF" before or after this statement in the "push button execution section"?

if ((millis() - lngBtnLastMillis[nBtnIndex] >= MIN_DEBOUNCE_TIME) && (nBtnVals[nBtnIndex][0] != nCurrentVal))

Edit: Or somewhere else and it is possible to issue a reset with ESP.restart(); According to brief googling.

Mike

You should be able to add the code at the very beginning or end of the loop() routine. I would not embed it inside the button toggle code.

Just figure out a way to determine how long the button was pressed, and when the time exceeds your limit, execute a reset.

Ok thanks.

After a lot of reading and testing I figure out what need to be done. the problem is that the w5200 also have a sd card reader that need to be deselected in setup is on gpio 4 so don't use it.
first download: GitHub - Seeed-Studio/Ethernet_Shield_W5200: Seeed Studio Ethernet Shield V2.0 Library

second : change SmartThingsEthernetW5500.h to call the EthernetV2_0
//#include <Ethernet2.h>
#include <EthernetV2_0.h>

last: define the pin on the definition section of your code
#define SDCARD_CS 4
and add this in the setup function to Deselect the SD card
pinMode(SDCARD_CS,OUTPUT);
digitalWrite(SDCARD_CS,HIGH);//Deselect the SD card

I actually did a copy of your SmartThingsEthernetW5500 library to keep everything organized
so far it has been working well on a couple of occasions, the shield has hung after reboot, apparently the hardware need more time at on boot, but I do not know where to put the delay.

1 Like

Hi Dan.
Greetings, I am trying to implement a contact sensor on esp32 and making it as an external trigger to wake the processor from the sleep. For some reasons, without the wakeup routines,everything is working fine. When I Incorporate the sleep and wake up code, it is not sending the status of the contact sensor.If I try switch1 executor, It is not displaying the true value , but the switch is on always..
For your reference, I am including the sketch I am using. Really a big hair pulling excercise over the weekend and no solution is near. Me a Network engineer with little coding experience, this is really pulling me down.,

Thanks in advance . Please let me know , where i went wrong.

//******************************************************************************************
// File: ST_Anything_Multiples_ESP32WiFi.ino
// Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
// Summary: This Arduino Sketch, along with the ST_Anything library and the revised SmartThings
// library, demonstrates the ability of one ESP32 to implement
// a multi input/output custom device for integration into SmartThings.
// The ST_Anything library takes care of all of the work to schedule device updates
// as well as all communications with the ESP32's WiFi.
//
// ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single ESP32
// - 2 x Water Sensor devices (using an analog input pin to measure voltage from a water detector board)
// - 2 x Illuminance Measurement devices (using a photoresitor attached to ananlog input)
// - 1 x Voltage Measurement devices (using a photoresitor attached to ananlog input)
// - 1 x Door Control devices (used typically for Garage Doors - input pin (contact sensor) and output pin (relay switch)
// - 2 x Contact Sensor devices (used to monitor magnetic door sensors)
// - 1 x Switch devices (used to turn on a digital output (e.g. LED, relay, etc...)
// - 1 x Smoke Detector device (using simple digital input)
// - 1 x MQ-2 Smoke Detector devices (using simple analog input compared to user defined limit)
// - 1 x Carbon Monoxide Detector device (using simple digital input)
// - 2 x Motion devices (used to detect motion)
// - 1 x Temperature Measurement device (Temperature from DHT22 device)
// - 1 x Humidity Measurement device (Humidity from DHT22 device)
// - 1 x Temperature Measurement device (Temperature from Dallas Semi 1-Wire DS18B20 device)
// - 1 x Relay Switch device (used to turn on a digital output for a set number of cycles And On/Off times (e.g.relay, etc...))
// - 2 x Button devices (sends "pushed" if held for less than 1 second, else sends "held"
// - 2 x Alarm devices - 1 siren only, 1 siren and strobe (using simple digital outputs)
//
//
// Change History:
//
// Date Who What
// ---- --- ----
// 2017-08-14 Dan Ogorchock Original Creation - Adapted from ESP8266 to work with ESP32 board
// 2018-02-09 Dan Ogorchock Added support for Hubitat Elevation Hub
//
// Special thanks to Joshua Spain for his contributions in porting ST_Anything to the ESP32!
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP32WiFi
//******************************************************************************************
#include <SmartThingsESP32WiFi.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_Ultrasonic.h> //Ultrasonic Distance Measurement Sensor, being used to monitor water level in cylindrical tank
//#include <PS_DS18B20_Temperature.h> //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries
//#include <PS_Illuminance.h> //Implements a Polling Sensor (PS) to measure light levels via a photo resistor on an analog input pin
//#include <PS_Voltage.h> //Implements a Polling Sensor (PS) to measure voltage on an analog input pin
//#include <PS_TemperatureHumidity.h> //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
//#include <PS_Water.h> //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector) on an analog input pin
//#include <PS_MQ2_Smoke.h> //Implements an Polling Sensor (PS) to monitor the status of an analog input pin from a MQ2 sensor
//#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_Smoke.h> //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin
//#include <IS_CarbonMonoxide.h> //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin
//#include <IS_DoorControl.h> //Implements an Interrupt Sensor (IS) and Executor to monitor the status of a digital input pin and control a digital output 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
//#include <EX_Switch_Dim.h> //Implements an Executor (EX) for a switch (on/off) and pwm output (level) uses 2 digital output pins

//****************************************************************************************************************************
//NodeMCU-32s ESP32 Pin Definitions (just for reference from ..hardware\espressif\esp32\variants\nodemcu-32s\pins_arduino.h)
//****************************************************************************************************************************
#define LED_BUILTIN 2
#define BUILTIN_LED 2
//
//#define A0 = 36;
//#define A3 = 39;
//#define A4 = 32;
//#define A5 = 33;
//#define A6 = 34;
//#define A7 = 35;
//#define A10 = 4;
//#define A11 = 0;
//#define A12 = 2;
//#define A13 = 15;
//#define A14 = 13;
//#define A15 = 12;
//#define A16 = 14;
//#define A17 = 27;
//#define A18 = 25;
//#define A19 = 26;

//******************************************************************************************
//Define which Arduino Pins will be used for each device
//******************************************************************************************
//"RESERVED" pins for ESP32 - best to avoid
#define PIN_0_RESERVED 0 //reserved ESP32 boot/program upload
#define PIN_1_RESERVED 1 //reserved ESP32 for TX0
#define PIN_3_RESERVED 3 //reserved ESP32 for RX0
#define PIN_6_RESERVED 6 //reserved ESP32 for flash
#define PIN_7_RESERVED 7 //reserved ESP32 for flash
#define PIN_8_RESERVED 8 //reserved ESP32 for flash
#define PIN_9_RESERVED 9 //reserved ESP32 for flash
#define PIN_10_RESERVED 10 //reserved ESP32 for flash
#define PIN_11_RESERVED 11 //reserved ESP32 for flash

//Analog Pins
//#define PIN_WATER_1 A0 //(GPIO 36) SmartThings Capability "Water Sensor"
//#define PIN_WATER_2 A3 //(GPIO 39) SmartThings Capability "Water Sensor"
//#define PIN_ILLUMINANCE_1 A6 //(GPIO 34) SmartThings Capability "Illuminance Measurement"
//#define PIN_ILLUMINANCE_2 A7 //(GPIO 35) SmartThings Capability "Illuminance Measurement"
//#define PIN_VOLTAGE_1 A4 //(GPIO 32) SmartThings Capability "Voltage Measurement"
//#define PIN_SMOKE_1 A5 //(GPIO 33) SmartThings Capability "Smoke Detector" (MQ-2)

//Digital Pins
//#define PIN_TEMPERATUREHUMIDITY_1 25 //SmartThings Capabilities "Temperature Measurement" and "Relative Humidity Measurement"
//#define PIN_TEMPERATURE_2 26 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

//#define PIN_MOTION_1 27 //SmartThings Capability "Motion Sensor"
//#define PIN_MOTION_2 14 //SmartThings Capability "Motion Sensor"
#define PIN_CONTACT_1 12 //SmartThings Capability "Contact Sensor"
//#define PIN_CONTACT_2 13 //SmartThings Capability "Contact Sensor"
//#define PIN_SWITCH_1 12 //SmartThings Capability "Switch"
//#define PIN_SMOKE_2 22 //SmartThings Capability "Smoke Detector"
//#define PIN_ALARM_1 21 //SmartThings Capability "Alarm"
//#define PIN_ALARM_2 19 //SmartThings Capability "Alarm"
//#define PIN_STROBE_2 18 //SmartThings Capability "Alarm"
//#define PIN_DOORCONTROL_CONTACT_1 5 //SmartThings Capabilty "Door Control"
//#define PIN_DOORCONTROL_RELAY_1 17 //SmartThings Capabilty "Door Control"
//#define PIN_BUTTON_1 16 //SmartThings Capabilty Button / Holdable Button
//#define PIN_BUTTON_2 4 //SmartThings Capabilty Button / Holdable Button
//#define PIN_TIMEDRELAY_1 2 //SmartThings Capability "Relay Switch"
//#define PIN_CO_1 15 //SmartThings Capability "Carbon Monoxide Detector"
//#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds /
//#define TIME_TO_SLEEP 30 /
Time ESP32 will go to sleep (in seconds) /
//
*****************************************************************************************
//ESP832 WiFi Information
//******************************************************************************************
String str_ssid = ""; // <---You must edit this line!
String str_password = "
**"; // <---You must edit this line!
IPAddress ip(10, 0, x, 39); //Device IP Address // <---You must edit this line!
IPAddress gateway(10, 0, x, 1); //Router gateway // <---You must edit this line!
IPAddress subnet(255, 255, 255, 0); //LAN subnet mask // <---You must edit this line!
IPAddress dnsserver(10, 0, x, 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(10, 0, x, 11); // 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

/*
Method to print the reason by which ESP32
has been awaken from sleep
*/

//******************************************************************************************
//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)
{
// String strTemp = 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
// if (strTemp.startsWith("temperature1"))
// {
// strTemp.remove(0,13);
// Serial.println(strTemp);
// }
// if (strTemp.startsWith("humidity1"))
// {
// strTemp.remove(0,10);
// Serial.println(strTemp);
// }
}
/*
Method to print the reason by which ESP32
has been awaken from sleep
*/
void print_wakeup_reason(){
esp_sleep_wakeup_cause_t wakeup_reason;

wakeup_reason = esp_sleep_get_wakeup_cause();

switch(wakeup_reason)
{
case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;
case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;
case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;
}
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
//******************************************************************************************
// Setup the default values for the ADC. Used for analog voltage reads.
// Notes: analogReadResolution(12) sets the resolution for all pins. 12 = 0-4095, 11 = 0-2047, 10 = 0-1024, 9 = 0-512
// analogSetAttenuation(ADC_11db) sets the attenuation for all pins. 11db = 0-3.3v, 6dB range = 0-2.2v, 2.5db = 0-1.5v, 0db = 0-1v
// analogSetPinAttenuation(A7, ADC_11db) sets the attenuation for individual pins.
//******************************************************************************************

// analogReadResolution(11); // Default of 12 is not very linear. Recommended to use 10 or 11 depending on needed resolution.
// analogSetAttenuation(ADC_6db); // Default is 11db which is very noisy. Recommended to use 2.5 or 6.

//******************************************************************************************
//Declare each Device that is attached to the Arduino
// Notes: - For each device, there is typically a corresponding "tile" defined in your
// SmartThings Device Hanlder Groovy code, except when using new COMPOSITE Device Handler
// - For details on each device's constructor arguments below, please refer to the
// corresponding header (.h) and program (.cpp) files.
// - The name assigned to each device (1st argument below) must match the Groovy
// Device Handler names. (Note: "temphumid" below is the exception to this rule
// as the DHT sensors produce both "temperature" and "humidity". Data from that
// particular sensor is sent to the ST Hub in two separate updates, one for
// "temperature" and one for "humidity")
// - The new Composite Device Handler is comprised of a Parent DH and various Child
// DH's. The names used below MUST not be changed for the Automatic Creation of
// child devices to work properly. Simply increment the number by +1 for each duplicate
// device (e.g. contact1, contact2, contact3, etc...) You can rename the Child Devices
// to match your specific use case in the ST Phone Application.
//******************************************************************************************
//Polling Sensors
// static st::PS_Ultrasonic sensor1(F("ultrasonic1"), 60, 0, PIN_ULTRASONIC_T, PIN_ULTRASONIC_E);
// static st::PS_Water sensor1(F("water1"), 60, 0, PIN_WATER_1, 500);
// static st::PS_Water sensor2(F("water2"), 60, 10, PIN_WATER_2, 500);
// static st::PS_Illuminance sensor3(F("illuminance1"), 60, 20, PIN_ILLUMINANCE_1, 0, 4095, 0, 10000);
// static st::PS_Illuminance sensor4(F("illuminance2"), 60, 30, PIN_ILLUMINANCE_2, 0, 4095, 0, 10000);
// static st::PS_Voltage sensor5(F("voltage1"), 60, 40, PIN_VOLTAGE_1, 0, 4095, 0, 3300, 1, 100);
// static st::PS_Voltage sensor5(F("voltage1"), 5, 1, PIN_VOLTAGE_1, 0, 4095, 0, 4095, 20, 75, -0.000000025934, 0.0001049656215, 0.9032840665333, 204.642825355678);
// static st::PS_MQ2_Smoke sensor6(F("smoke1"), 10, 3, PIN_SMOKE_1, 1000);
// static st::PS_TemperatureHumidity sensor7(F("temphumid1"), 15, 5, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature1","humidity1");
// static st::PS_DS18B20_Temperature sensor8(F("temperature2"), 60, 55, PIN_TEMPERATURE_2, false, 10, 1);

//Interrupt Sensors
// static st::IS_Motion sensor9(F("motion1"), PIN_MOTION_1, HIGH, false, 500);
// static st::IS_Motion sensor10(F("motion2"), PIN_MOTION_2, HIGH, false, 500);
static st::IS_Contact sensor11(F("contact1"), PIN_CONTACT_1, HIGH, true, 500);
// static st::IS_Contact sensor12(F("contact2"), PIN_CONTACT_2, LOW, true, 500);
// static st::IS_Smoke sensor13(F("smoke2"), PIN_SMOKE_2, HIGH, true, 500);
// static st::IS_Button sensor14(F("button1"), PIN_BUTTON_1, 1000, LOW, true, 500);
// static st::IS_Button sensor15(F("button2"), PIN_BUTTON_2, 1000, LOW, true, 500);
// static st::IS_CarbonMonoxide sensor16(F("carbonMonoxide1"), PIN_CO_1, HIGH, true, 500);

//Special sensors/executors (uses portions of both polling and executor classes)
// static st::IS_DoorControl sensor17(F("doorControl1"), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, true, 1000);
// static st::S_TimedRelay sensor18(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 3000, 0, 1);

//Executors
// static st::EX_Switch executor1(F("switch1"), PIN_SWITCH_1, HIGH, true);
// static st::EX_Alarm executor2(F("alarm1"), PIN_ALARM_1, LOW, true);
// static st::EX_Alarm executor3(F("alarm2"), PIN_ALARM_2, LOW, true, PIN_STROBE_2);

//*****************************************************************************
// Configure debug print output from each main class
// -Note: Set these to "false" if using Hardware Serial on pins 0 & 1
// to prevent communication conflicts with the ST Shield communications
//*****************************************************************************
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 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);

//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);

//Run the Everything class' init() routine which establishes WiFi communications with SmartThings Hub
st::Everything::init();

//*****************************************************************************
//Add each sensor to the "Everything" Class
//*****************************************************************************
// st::Everything::addSensor(&sensor1);
st::Everything::addSensor(&sensor11);
/* st::Everything::addSensor(&sensor3);
st::Everything::addSensor(&sensor4);
st::Everything::addSensor(&sensor5);
st::Everything::addSensor(&sensor6);
st::Everything::addSensor(&sensor7);
st::Everything::addSensor(&sensor8);
st::Everything::addSensor(&sensor9);
st::Everything::addSensor(&sensor10);
st::Everything::addSensor(&sensor11);
st::Everything::addSensor(&sensor12);
st::Everything::addSensor(&sensor13);
st::Everything::addSensor(&sensor14);
st::Everything::addSensor(&sensor15);
st::Everything::addSensor(&sensor16);
st::Everything::addSensor(&sensor17);
st::Everything::addSensor(&sensor18);
/
//
****************************************************************************
//Add each executor to the "Everything" Class
//*****************************************************************************
// st::Everything::addExecutor(&executor1);
// st::Everything::addExecutor(&executor2);
// st::Everything::addExecutor(&executor3);

//*****************************************************************************
//Initialize each of the devices which were added to the Everything Class
//*****************************************************************************
st::Everything::initDevices();
//st::Everything::run();

//Print the wakeup reason for ESP32
print_wakeup_reason();

/*
First we configure the wake up source
We set our ESP32 to wake up every 5 seconds
*/
//esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_12,1); //1 = High, 0 = Low
//Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) +
//" Seconds");

/*
Next we decide what all peripherals to shut down/keep on
By default, ESP32 will automatically power down the peripherals
not needed by the wakeup source, but if you want to be a poweruser
this is for you. Read in detail at the API docs
http://esp-idf.readthedocs.io/en/latest/api-reference/system/deep_sleep.html
Left the line commented as an example of how to configure peripherals.
The line below turns off all RTC peripherals in deep sleep.
*/
//esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
//Serial.println("Configured all RTC Peripherals to be powered down in sleep");

/*
Now that we have setup a wake cause and if needed setup the
peripherals state in deep sleep, we can now start going to
deep sleep.
In the case that no wake up sources were provided but deep
sleep was started, it will sleep forever unless hardware
reset occurs.
*/
// Serial.println("Wait a Minute");
// Serial.println("Going to sleep now");
// delay(1000);
// Serial.flush();
// delay(60000);
// esp_deep_sleep_start();
// Serial.println("This will never be printed");
}

//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
//*****************************************************************************
//Execute the Everything run method which takes care of "Everything"
//*****************************************************************************
st::Everything::run();
delay(60000);
Serial.println("Going to sleep now");
delay(1000);
Serial.flush();
esp_deep_sleep_start();
Serial.println("This will never be printed");

}

On the serial monitor, I am seeing this on other esp32 which does not have the deep sleep wake up routine. i added this info thinking this might help you @ogiewon
Everything: Sending: switch1 on

Kindly let me know if I need to provide more info.

Thanks a lot.
Pugazhendhi M