Thanks, that looks like you describe it now. But I'm still not able to get my temp probe to work. I tried commenting out the other sensors and I'm still getting -196.6 deg. I even swapped to another temperature probe to see if that one was bad and get the same result.
All I did was connect the yellow wire to pin 26 on the breakout board and the red wire to 3V3 and the black to GND.
Here's the sketch file I'm using, can you let me know if you see anything odd or can suggest any next steps?
//******************************************************************************************
// 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_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
//******************************************************************************************
//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 23 //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"
//******************************************************************************************
//ESP832 WiFi Information
//******************************************************************************************
String str_ssid = "Alderson"; // <---You must edit this line!
String str_password = "deadbeef64"; // <---You must edit this line!
IPAddress ip(192, 168, 86, 60); //Device IP Address // <---You must edit this line!
IPAddress gateway(192, 168, 86, 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, 86, 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, 86, 37); // 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)
{
// String strTemp = msg;
// Serial.print(F("ST_Anything Callback: Sniffed data = ")); //Standard serial port monitoring
// Serial.println(msg);
// SerialBT.print(F("ST_Anything Callback: Sniffed data = ")); // BlueTooth monitoring
// SerialBT.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);
// }
}
//******************************************************************************************
//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_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, LOW, 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, LOW, 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(&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(&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();
}
//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
//*****************************************************************************
//Execute the Everything run method which takes care of "Everything"
//*****************************************************************************
st::Everything::run();
}
// Callback routine for BlueTooth. Uncomment to enable
//void callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param){
// if(event == ESP_SPP_SRV_OPEN_EVT){
// Serial.println("Client Connected to BlueTooth!");
// Serial.print("Client address is: ");
// for (int i = 0; i < 6; i++) {
// Serial.printf("%02X", param->srv_open.rem_bda[i]);
// if (i < 6) {
// Serial.print(":");
// }
// }
// }
// if(event == ESP_SPP_CLOSE_EVT ){
// Serial.println("Client disconnected from BlueTooth");
// }
// }