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

@ogiewon I did get it to work so now you know it works! There are still a few issues I think with showing the right color on mine for some of the RGB device commands (plain color works but the color wheel ones are inversed, I think - also Brightness doesn't seem to work well). but I'll debug that.

What would you use to add a command to the RGB device to start an animation? Add an executor and a command to the driver?

I have zero experience with the recent NeoPixelBus additions. They were added by a very helpful SmartThings user, named "@vseven". You may want to contact him over on the ST Forum.

I get that, let me rephrase, @ogiewon. If I wanted to add a command to a child device, how do I go about it? I guess the closest one to look at would be the relay device? Anything that doesn’t keep on/off state but just triggers an event to be executed in the arduino side?

So....you would just add a new command to the existing RGB or RGBW a child driver. Then, in that command, send whatever string you’d like to the Microcontroller. Look at the on() and off() commands in that child driver for an example of the exact syntax to transmit the data.

Finally, in the EX_RGB... cpp file on the Arduino side, look for the beSmart() function. Inside it, add whatever code you’d like to handle the string when it is received from you custom command.

This will be my first attempt at utilizing HubDuino integrations, apart from a few "test" sensors to familiarize myself with the basics.
I have read other members using ultrasonic and capacitance sensors to determine fluid levels, predominantly in swimming pools. I would like to do something similar.
I already have an automated chemical feeder supplied from a 15 l chlorine drum and a 10 l acid drum, as per photo.


My idea is to construct dual weight scales using two 20kg load cells.
I have two voltage amplifiers on order which can convert the load cell outputs to a 0-5v range. They also have zero and scale adjustments. I was thinking of feeding the outputs of these into the voltage sense pins and having one child device for each drum. At a basic level I could then trigger a notification when a voltage dropped to a specific level, indicating a low chemical level. Ideally I would like to create a custom driver which would convert voltage into litres.
Another method is using the HX711 A to D load cell amplifier and sending the data to a digital pin. I think this would require a lot more coding.
Using scales means there is no sensors attached to the drums themselves and swapping them out is quick and easy.

Can I have some feedback please on the viability of the design and any suggestions for improvements? I hope to have a prototype ready in the next couple of weeks, providing the amplifiers arrive soon.
Thanks.

Really no need for a custom driver...definitely an option, but not required. If you look at the documentation for the PS_Voltage device, as shown below, you will see that it includes the ability to scale the measured value from the microcontroller's analog input into whatever units you'd like. The example uses volts, but you could use liters just as easily.
These four arguments are what provides this flexibility to convert analog input values (typically 0-1024 or 0-4096) into engineering units.

//				- double s_l - OPTIONAL - first argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - minimum raw AI value
//				- double s_h - OPTIONAL - second argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - maximum raw AI value
//				- double m_l - OPTIONAL - third argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Min (or Max if inverting)
//				- double m_h - OPTIONAL - fourth argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Max (or Min if inverting)

Full documentation

//******************************************************************************************
//  File: PS_Voltage.cpp
//  Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
//  Summary:  PS_Voltage is a class which implements the SmartThings "Voltage Measurement" device capability.
//			  It inherits from the st::PollingSensor class.  The current version uses an analog input to measure the 
//			  voltage on an anlog input pin and then scale it to engineering units.
//
//			  The last four arguments of the constructor are used as arguments to an Arduino map() function which 
//			  is used to scale the analog input readings (e.g. 0 to 1024) to Engineering Units before sending to SmartThings. 
//
//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::PS_Voltage sensor1(F("voltage1"), 120, 0, PIN_VOLTAGE, 0, 1023, 0.0, 5.0);
//
//			  st::PS_Voltage() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- long interval - REQUIRED - the polling interval in seconds
//				- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//				- byte pin - REQUIRED - the Arduino Pin to be used as an analog input
//				- double s_l - OPTIONAL - first argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - minimum raw AI value
//				- double s_h - OPTIONAL - second argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - maximum raw AI value
//				- double m_l - OPTIONAL - third argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Min (or Max if inverting)
//				- double m_h - OPTIONAL - fourth argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Max (or Min if inverting)
//				- byte numSamples - OPTIONAL - defaults to 1, number of analog readings to average per scheduled reading of the analog input
//				- byte filterConstant - OPTIONAL - Value from 5% to 100% to determine how much filtering/averaging is performed 100 = none (default), 5 = maximum
//
//            Filtering/Averaging
//
//				Filtering the value sent to ST is performed per the following equation
//
//				filteredValue = (filterConstant/100 * currentValue) + ((1 - filterConstant/100) * filteredValue) 
//
//----------------------------------------------------------------------------------------------------------------------------------------------

So, as an example...using an ESP32 which has multiple analog inputs (versus the ESP8266 which only has one), you could do something like...

st::PS_Voltage sensor1(F("voltage1"), 300, 0, PIN_VOLTAGE_1, 0, 4096, 0.0, 23.0);
st::PS_Voltage sensor2(F("voltage2"), 300, 0, PIN_VOLTAGE_2, 0, 4096, 0.0, 15.0);

The first one would scale 0 to 4096 counts from the AI, into 0 to 23 liters.
The second one would scale 0 to 4096 counts from the AI, into 0 to 15 liters.

Both would poll their respective AI pins every 300 second (or 5 minutes).

Hope this makes sense...

On the Hubitat side, they would still appear as Voltage Child Devices, but would have the correct values.

That is absolute gold! thank you.
I can't wait for the components to arrive so I can start the construction/calibration process.
I'll provide updates and post photos along the way. If successful I can see this method being used for any number of applications.

1 Like

o man, thank you for this. i can't wait to get around and try some things out. i'm planning to retrofit an old dog feeder to be controlled through hubduino (since the service has been shut down and i can't change anything on the system now).

any advise for a newbie? obviously get in there and play with it, i already used a webserver to control the on board LED, but haven't messed with any of the pins yet

The biggest piece of advice is to spend some time familiarizing yourself with the Arduino IDE, how to use libraries, and how to wire these low voltage circuits. If you have questions along the way, feel free to ask as we are sure to be able to save you a lot of time. Also, do not add any 'delay()' statements in the loop() routine of the sketch. In fact, you most likely do not need to put any code in the loop() routine of the sketch, other than what the ST_Anything example sketches already have in them as a starting point. One more thing, please be sure to read the top of each ST_Anything device's .cpp file to see the documentation of all of the options for declaring these devices in the sketch's setup() routine. A lot of flexibility has been built into these devices to avoid the need to customize the code.

Oh...and please have fun! (and be safe! avoid the temptation to mess around with 120/240VAC stuff.)

1 Like

that's my plan. i did the builtin LED to refamiliarize myself (i did arduino stuff like 10+ years ago, so it's been a while), so definitely glad to get that bit working. next up is to test the pin stuff so i can control that through a web server, then integrate that into HE.

definitely gonna be fun and i'll reach out with any questions

thanks again for this project :slight_smile:

1 Like

Just getting my feet wet with Hubduino and I'm pretty green at Arduino stuff in general :slight_smile: .

I have a DHT11 connected to a ESP8266 board, using a generic sketch I found online, I can get temp and humidity readings on the serial monitor just fine. I am attempting to make the same setup on Hubduino. All child drivers and parent apps are installed and configured but I think my choice of test sketch is 'sketchy' lol.

I started off with ST_Anything_Multiples_ESP8266WiFi but not sure if I have it set up correctly for the device I am using.

Everything: Sending: temperature1 -196.60

Do you have a suggestion for another sketch I can use just for the basic temp/humidity?

Thank you!

Edit:

Yay! I got it to work after looking at the library files and did some fumbling around with the instructions and making the necessary edits enough to get the correct readings.

One more question though, how do I get rid of the other devices that I don't think I'll be using like contact, smoke, water, etc?

Everything: Sending: water1 dry
Everything: Sending: temperature1 75.20
Everything: Sending: humidity1 37.00
Everything: Sending: contact1 open
Everything: Sending: button1 init
Everything: Sending: button2 init
1 Like

Just simply comment out the declarations of the other devices in the setup() routine of the sketch. Also, be sure to comment out the corresponding entries a little further down in the setup() routine where the “sensors” and “executors” are added to the Everything class.

Once the sketch is updated, you can simply delete the 7 wanted child devices on the Hubitat side and they will not come back.

1 Like

Got it working properly, thank you. Now I'm trying to figure out placement of the sensor in the bathroom, remote with a longer wire or something... the something is tbd. :slight_smile:

1 Like

got this working to control a few LEDs...next up, wait for my device to get in so i can test triggering that then integrate it with the nodeMCU. gotta say, this is fun times. thanks again for this integration.

i'm just hoping the 3.3V from the pins is enough to trigger what i need

1 Like

So i finally implemented a water meter using the PulseCounter ...and my polling interval is 60 sec.
I'm trying to figure out how best to show water usage over time ... when I look at the attribute...with no water is zero, the history shows values.
If I want to show the total water usage on a given day....do I sum that up in the arduino and somehow add another attribute or do that in the device code ....or ....

I also want to from webcore detect large amounts of water usage ..and be able to announce ...your shower took 400 gallons of water..... any idea how to do that?

@tim.ocallag - It sounds like you may want to simply modify the Child device handler to keep the statistics you'd like as custom attributes. You could maintain a rolling 30min, 1 hour, 24 hour, weekly, and monthly set of average water usage attributes.

Strange issue with DHT22 devices. I have 4 of them connected to the Arduino. Somehow it appears that I have things mixed up. 2 seem to work just fine. The other two I am not sure what is going on. Between the two of them I ony have a single temp and a single humidity reading. and They appear in HE the same way. Sorta like Location A has the temp but not the humidity and ocation B has the humidity but not the Temp. When I disconnect wither one reporting is the same. Can somone look at my Sketch to make sure I have at least that written OK?

    //******************************************************************************************
// 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_DS18B20_Temperature.h>  //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries 
#include <PS_AdafruitBME280_TempHumidPress.h> //Implements a Polling Sensor (PS) to measure Temperature, humidity, and Pressure using BME280 via I2C
#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 <IS_Contact.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 <S_TimedRelay.h>    //Implements a Sensor to control a digital output pin with timing/cycle repeat capabilities
#include <IS_Smoke.h>        //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin
//**********************************************************************************************************
//Define which Arduino Pins will be used for each device
//  Notes: Arduino communicates with both the W5100 and SD card using the SPI bus (through the ICSP header). 
//         This is on digital pins 10, 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. 
//         On both boards, pin 10 is used to select the W5100 and pin 4 for the SD card. 
//         These pins cannot be used for general I/O. On the Mega, the hardware SS pin, 53, 
//         is not used to select either the W5100 or the SD card, but it must be kept as an output 
//         or the SPI interface won't work.
//         See https://www.arduino.cc/en/Main/ArduinoEthernetShieldV1 for details on the W5100 Sield
//**********************************************************************************************************
//"RESERVED" pins for W5100 Ethernet Shield - best to avoid
#define PIN_4_RESERVED            4   //reserved by W5100 Shield on both UNO and MEGA
#define PIN_1O_RESERVED           10  //reserved by W5100 Shield on both UNO and MEGA
#define PIN_50_RESERVED           50  //reserved by W5100 Shield on MEGA
#define PIN_51_RESERVED           51  //reserved by W5100 Shield on MEGA
#define PIN_52_RESERVED           52  //reserved by W5100 Shield on MEGA
#define PIN_53_RESERVED           53  //reserved by W5100 Shield on MEGA


//Analog Pins
//#define PIN_WATER_1               A0  //SmartThings Capability "Water Sensor"
//#define PIN_WATER_2               A1  //SmartThings Capability "Water Sensor"

//Digital Pins

#define PIN_CONTACT_1             38  //SmartThings Capability "Contact Sensor"
#define PIN_CONTACT_2             39  //SmartThings Capability "Contact Sensor"
#define PIN_CONTACT_3             40  //SmartThings Capability "Contact Sensor"
#define PIN_CONTACT_4             41  //SmartThings Capability "Contact Sensor"
#define PIN_CONTACT_5             42  //SmartThings Capability "Contact Sensor"
#define PIN_CONTACT_6             43  //SmartThings Capability "Contact Sensor"
#define PIN_TEMPERATUREHUMIDITY_1 5  // DHT22
#define PIN_TEMPERATUREHUMIDITY_2 6  // DHT22
#define PIN_TEMPERATUREHUMIDITY_3 7  // DHT22
#define PIN_TEMPERATUREHUMIDITY_4 20 // DHT22
#define PIN_SMOKE_1               13  //SmartThings Capability "MQ5 Gas Detector"

//Relay Outputs
#define PIN_SWITCH_1             22  //"Relay 1--Veg Lites"
#define PIN_SWITCH_2             23  //"Relay 2--Flower Lites"
#define PIN_SWITCH_3             24  // "Relay 3--Pool Pump"
#define PIN_SWITCH_4             31  // "Relay 10--Bedroom Heat"
#define PIN_SWITCH_5             32  // "Relay 11--Bathroom Heat"
#define PIN_SWITCH_6             33  // "Relay 12--Solar Valve""
#define PIN_SWITCH_7             35  // "Relay 13--Water Valve"
#define PIN_SWITCH_8             34  // "Relay 14--DHW Relay"
#define PIN_SWITCH_9             25 // "Relay 4 Flower Room Heater"
#define PIN_SWITCH_10            26 // "Relay 5 Smoker Fan"
#define PIN_SWITCH_11            27 
#define PIN_SWITCH_12            28 
#define PIN_SWITCH_13            29  
//#define PIN_SWITCH_14          30 

//Garage Door Pins 
#define PIN_DOORCONTROL_CONTACT_1 44  //"Door Sensor North Door" 
#define PIN_DOORCONTROL_RELAY_1   36  //"Door Control North Door" 
#define PIN_DOORCONTROL_CONTACT_2 45  //"Door Sensor South Door"  
#define PIN_DOORCONTROL_RELAY_2   30  //"Door Control South Door" Switched pin 30 & 37 because the relay connected to pin 37 is bad -- Relay 16

//******************************************************************************************
//W5100 Ethernet Shield Information
//****************************************************************************************** 
byte mac[] = {0x06,0x02,0x03,0x04,0x05,0x06}; //MAC address, leave first octet 0x06, change others to be unique //  <---You must edit this line!
IPAddress ip(192, 168, 1, 50);               //Arduino 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

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

//Hubitat Hub TCP/IP Address: UNCOMMENT line that corresponds to your hub, COMMENT the other
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 withotu having to rely on the ST Cloud for time-critical tasks.
//******************************************************************************************
void callback(const String &msg)
{
  //Uncomment if it would be desirable to using this function
  //Serial.print(F("ST_Anything_Miltiples 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(s) as you see fit)
  //st::receiveSmartString("Put your command here!");  //use same strings that the Device Handler would send
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
  //******************************************************************************************
  //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 
//st::PS_DS18B20_Temperature() constructor requires the following arguments
//- String &name - REQUIRED - the name of the object - either "temperature1" for a single sensor, or "temperature" for multiple sensors
//- long interval - REQUIRED - the polling interval in seconds
//- long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
//- byte pin - REQUIRED - the Arduino Pin to be used for the One-Wire DS18B20 sensor conenction
//- bool In_C - OPTIONAL - true = Report Celsius, false = Report Farenheit (Farentheit is the default)
//- byte resolution - OPTIONAL - DS18B20 sensor resolution in bits.  9, 10, 11, or 12.  Defaults to 10 for decent accuracy and performance
//- byte num_sensors - OPTIONAL - number of OneWire DS18B20 sensors attached to OneWire bus - Defaults to 1
//- byte sensorStartingNum - OPTIONAL - Starting number for sending temperature sensor data when using multiple sensors on one pin - Defaults to 1
 
  static st::PS_DS18B20_Temperature sensor1(F("temperature"), 60, 0, 11, false, 10, 6, 1);  //DS1820 Sensors 1 -6 
  //static st::PS_DS18B20_Temperature sensor2(F("temperature"), 60, 5, 12, false, 10, 6, 7); //DS1820 Sensors 7 -12 
  //static st::PS_DS18B20_Temperature sensor3(F("temperature"), 60, 10, 13, false, 10, 6, 13); //DS1820 Sensors 13 -18 
  //static st::PS_AdafruitBME280_TempHumidPress sensor4(F("BME280_1"), 60, 0, "temperature9", "humidity1", "pressure1", false, 100, 0x77);  
  static st::PS_TemperatureHumidity sensor2(F("temphumid1"), 90, 50, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature7","humidity1");
  static st::PS_TemperatureHumidity sensor3(F("temphumid2"), 90, 50, PIN_TEMPERATUREHUMIDITY_2, st::PS_TemperatureHumidity::DHT22,"temperature8","humidity2");
  static st::PS_TemperatureHumidity sensor4(F("temphumid3"), 90, 50, PIN_TEMPERATUREHUMIDITY_3, st::PS_TemperatureHumidity::DHT22,"temperature9","humidity3");
  static st::PS_TemperatureHumidity sensor9(F("temphumid4"), 90, 50, PIN_TEMPERATUREHUMIDITY_4, st::PS_TemperatureHumidity::DHT22,"temperature10","humidity4");
//Interrupt Sensors 
  static st::IS_Contact sensor5(F("contact1"), PIN_CONTACT_1, LOW, true, 500); //Back DoorBell
  static st::IS_Contact sensor6(F("contact2"), PIN_CONTACT_2, LOW, true, 500); //Front Doorbell
  static st::IS_Contact sensor11(F("contact3"), PIN_CONTACT_3, LOW, true, 500); //Solar Valve 
  static st::IS_Contact sensor12(F("contact4"), PIN_CONTACT_4, LOW, true, 500);
  static st::IS_Contact sensor13(F("contact5"), PIN_CONTACT_5, LOW, true, 500);  
  static st::IS_Contact sensor14(F("contact6"), PIN_CONTACT_6, LOW, true, 500);
  //static st::IS_Smoke sensor3(F("smoke1"), PIN_SMOKE_1, HIGH, true, 500);  
  static st::IS_DoorControl sensor7(F("doorControl1"), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, true, 1000);
  static st::IS_DoorControl sensor8(F("doorControl2"), PIN_DOORCONTROL_CONTACT_2, LOW, true, PIN_DOORCONTROL_RELAY_2, LOW, true, 1000);
    
//Executors
  static st::EX_Switch              executor1(F("switch1"), PIN_SWITCH_1, LOW, true);
  static st::EX_Switch              executor2(F("switch2"), PIN_SWITCH_2, LOW, true);
  static st::EX_Switch              executor3(F("switch3"), PIN_SWITCH_3, LOW, true);
  static st::EX_Switch              executor4(F("switch4"), PIN_SWITCH_4, LOW, true);
  static st::EX_Switch              executor5(F("switch5"), PIN_SWITCH_5, LOW, true);
  static st::EX_Switch              executor6(F("switch6"), PIN_SWITCH_6, LOW, true);
  static st::EX_Switch              executor7(F("switch7"), PIN_SWITCH_7, LOW, true);
  static st::EX_Switch              executor8(F("switch8"), PIN_SWITCH_8, LOW, true);
  static st::EX_Switch              executor9(F("switch9"), PIN_SWITCH_9, LOW, true);
  static st::EX_Switch              executor10(F("switch10"), PIN_SWITCH_10, LOW, true);
  static st::EX_Switch              executor11(F("switch11"), PIN_SWITCH_11, LOW, true);
  static st::EX_Switch              executor12(F("switch12"), PIN_SWITCH_12, LOW, true);
  static st::EX_Switch              executor13(F("switch13"), PIN_SWITCH_13, LOW, true);
  //static st::EX_Switch              executor14(F("switch14"), PIN_SWITCH_14, 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
  //*****************************************************************************
  
  //Initialize the optional local callback routine (safe to comment out if not desired)
  st::Everything::callOnMsgSend = callback;
  
  //Create the SmartThings EthernetW5100 Communications Object
    //STATIC IP Assignment - Recommended
    st::Everything::SmartThing = new st::SmartThingsEthernetW5100(mac, 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::SmartThingsEthernetW5100(mac, serverPort, hubIp, hubPort, st::receiveSmartString);

  //Run the Everything class' init() routine which establishes Ethernet communications with the SmartThings Hub
  st::Everything::init();
  
  //*****************************************************************************
  //Add each sensor to the "Everything" Class
  //*****************************************************************************
  st::Everything::addSensor(&sensor1);
  st::Everything::addSensor(&sensor2);
  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(&sensor11);
  st::Everything::addSensor(&sensor12);
  st::Everything::addSensor(&sensor13); 
  st::Everything::addSensor(&sensor14);
  
  

   
  //*****************************************************************************
  //Add each executor to the "Everything" Class
  //*****************************************************************************
  st::Everything::addExecutor(&executor1);
  st::Everything::addExecutor(&executor2);
  st::Everything::addExecutor(&executor3);
  st::Everything::addExecutor(&executor4);
  st::Everything::addExecutor(&executor5);
  st::Everything::addExecutor(&executor6);
  st::Everything::addExecutor(&executor7);
  st::Everything::addExecutor(&executor8);
  st::Everything::addExecutor(&executor9);
  st::Everything::addExecutor(&executor10);
  st::Everything::addExecutor(&executor11);
  st::Everything::addExecutor(&executor12);
  st::Everything::addExecutor(&executor13);
//  st::Everything::addExecutor(&executor14);
 
 
  //*****************************************************************************
  //Initialize each of the devices which were added to the Everything Class
  //*****************************************************************************
  st::Everything::initDevices();
}

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

Hope this formatting is better
Thanks

1 Like

Please edit your post above to display the sketch in a more readable style. To do so, edit the post, select and delete the code you've posted above (as formatting characters have messed some of the ASCII caharacters up). Then, copy the sketch code from your Arduino IDE, and paste it back in the post. Once pasted, select all of it and then click the "Preformatted Text" menu button in the edit window - it looks like "</>", which will make sure the code can be copied and pasted by other users.

1 Like

Perhaps try changing the above lines as shown below. This will prevent the Arduino from trying to poll all of the DHT a sensors at the exact same time. Instead, the readings will be spread out throughout the 90 second polling interval.

  static st::PS_TemperatureHumidity sensor2(F("temphumid1"), 90, 21, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature7","humidity1");
  static st::PS_TemperatureHumidity sensor3(F("temphumid2"), 90, 42, PIN_TEMPERATUREHUMIDITY_2, st::PS_TemperatureHumidity::DHT22,"temperature8","humidity2");
  static st::PS_TemperatureHumidity sensor4(F("temphumid3"), 90, 53, PIN_TEMPERATUREHUMIDITY_3, st::PS_TemperatureHumidity::DHT22,"temperature9","humidity3");
  static st::PS_TemperatureHumidity sensor9(F("temphumid4"), 90, 64, PIN_TEMPERATUREHUMIDITY_4, st::PS_TemperatureHumidity::DHT22,"temperature10","humidity4");