DanielOgorchock / ST_Anything

ST_Anything is an Arduino library, sketch, and Device Type that works with your SmartThings ThingShield to create an all-in-one SmartThings device.
GNU General Public License v3.0
438 stars 448 forks source link

Child device creation failed. Please make sure that the 'null' is installed and published. #134

Closed mattyow1 closed 6 years ago

mattyow1 commented 6 years ago

Hello everyone,

This is my very first attempt at DIYing anything to work with my Samsung Smartthings Hub and I've hit, what appears to me to be, a giant wall and planes soaring miles above my head. I'm hoping that I can provide some information of what my error is and what I've done so far and see if that is enough to get the community involved to help me crawl my way into more of these projects.

I've purchased a NodeMCU ESP8266 and followed the instructions to import the libraries/sketches/boards into the Arduino IDE (This all seems to be working fine as I can compile and upload the sketch and I get feedback in the serial monitor that my device is connected and begins "Sending: motion1 active/inactive messages).

I've also linked my Github account to Smartthings and added the ST Anything Repo and published/executed everything that was available.

I then created a device using the Parent_ST_Anything_Ethernet (Type) and assigned it to my location and hub.

Then I entered the Smartthings App on my phone and it said I needed to configure it so I added the IP of the ESP8266, the port stated in the sketch and in the serial monitor below the text "Enter the following three lines of data into ST Ap on your phone!", and the mac address of the ESP8266.

Once I do this I receive the error "Child device creation failed. Please make sure that the 'null' is installed and published." I also get an RSSI -17 on one of the tiles which also shows up in Smartthings IDE.

I'm not quite sure where to go from here. I've attempted to delete and readd the Device Handlers, restarted the ST Hub, started fresh with a new sketch from Github, deleting and readding the device "Parent".

Any help or direction in where to start looking for issues would be greatly appreciated. I'm more than willing to upload screenshots upon request.

Thank you again for trying to help me learn this! It will be soooo cool when it is working!

ogiewon commented 6 years ago

Are all of your Device Handlers ‘Published” in the ST Web IDE?

Thileeppan commented 6 years ago

Since yesterday, I am have same issue, I have started using ST_Anything_Multiples_ESP8266WiFi since two weeks, but I had to add some sensors yesterday, so I deleted the device in SmartThings and when I add it again, I got "Child device creation failed. Please make sure that the 'null' is installed and published." error message. And I have noticed my ESP8266 stop responding after 6 or 7 hours, I have to restart the ESP8266, then it's started to communicate. I have tried three different NodeMcu ESP8266, all of them have having same problem since yesterday, but they were working two weeks no issue, everything started since yesterday . Last night I even factory reset my ST hub, I still same issue, today morning my all NodeMcu ESP8266 stopped responding until I reboot.

vseven commented 6 years ago

Are you sure the lockups arn't from this known issue: https://github.com/DanielOgorchock/ST_Anything/issues/118#issuecomment-375957093

As for child device creation make sure all the child DTH's you need are added to your IDE and also marked as Published. If you are deleting/readding devices delete out the parent and all child devices, re-add the parent making sure to set the hub location (per the readme file), and make sure you enter the MAC address correctly once its added.

Thileeppan commented 6 years ago

thanks vseven, I will check the version of the IDE library today evening.

Yes I did deleted the parent and all child devices, then I readd parent, and even I got same error message after I factory reset the ST hub and I started fresh with device handler, library and sketch. and all my device handler are published.

vseven commented 6 years ago

Post a copy of your sketch using the "insert code" tags.

ogiewon commented 6 years ago

As mentioned already, please use v2.3 of the ESP8266 Board Manager in the Arduino IDE.

mattyow1 commented 6 years ago

Thanks for all the responses so far. I've uploaded my code and added a couple pictures of the things to check that you've already mentioned so we can be sure I've done those steps correctly.

Headed to work but I'll check the thread periodically!

`//** // File: ST_Anything_Multiples_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266's WiFi. // // ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266 // - 1 x Alarm device (using a simple digital output) // - 1 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 Motion devices (used to detect motion) // - 1 x Smoke Detector devices (using simple digital input) // - 1 x Temperature Measurement devices (Temperature from Dallas Semi 1-Wire DS18B20 device) // - 1 x Relay Switch devices (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" // - 1 x Water Sensor devices (using the 1 analog input pin to measure voltage from a water detector board) //
// Change History: // // Date Who What // ---- --- ---- // 2015-01-03 Dan & Daniel Original Creation // 2017-02-12 Dan Ogorchock Revised to use the new SMartThings v2.0 library // 2017-04-17 Dan Ogorchock New example showing use of Multiple device of same ST Capability // used with new Parent/Child Device Handlers (i.e. Composite DH) // 2017-05-25 Dan Ogorchock Revised example sketch, taking into account limitations of NodeMCU GPIO pins // 2018-02-09 Dan Ogorchock Added support for Hubitat Elevation Hub // //** //** // SmartThings Library for ESP8266WiFi //**

include

//** // ST_Anything Library //**

include //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library

include //Generic Device Class, inherited by Sensor and Executor classes

include //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)

include //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)

include //Generic Interrupt "Sensor" Class, waits for change of state on digital input

include //Generic Polling "Sensor" Class, polls Arduino pins periodically

include //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

include //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

include //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library

include //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries

include //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)

include //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

include //Implements an Interrupt Sensor (IS) and Executor to monitor the status of a digital input pin and control a digital output pin

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses

include //Implements an Executor (EX) via a digital output to a relay

include //Implements Executor (EX)as an Alarm Siren capability via a digital output to a relay

include //Implements a Sensor to control a digital output pin with timing capabilities

// //NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings) // //#define LED_BUILTIN 16 //#define BUILTIN_LED 16 // //#define D0 16 //no internal pullup resistor //#define D1 5 //#define D2 4 //#define D3 0 //must not be pulled low during power on/reset, toggles value during boot //#define D4 2 //must not be pulled low during power on/reset, toggles value during boot //#define D5 14 //#define D6 12 //#define D7 13 //#define D8 15 //must not be pulled high during power on/reset

//** //Define which Arduino Pins will be used for each device //**

define PIN_WATER_1 A0 //NodeMCU ESP8266 only has one Analog Input Pin 'A0'

define PIN_ALARM_1 D0 //SmartThings Capabilty "Alarm"

define PIN_SWITCH_1 D1 //SmartThings Capability "Switch"

define PIN_CONTACT_1 D2 //SmartThings Capabilty "Contact Sensor"

define PIN_BUTTON_1 D3 //SmartThings Capabilty Button / Holdable Button (Normally Open!)

define PIN_BUTTON_2 D4 //SmartThings Capabilty Button / Holdable Button (Normally Open!)

define PIN_MOTION_1 D5 //SmartThings Capabilty "Motion Sensor" (HC-SR501 PIR Sensor)

define PIN_SMOKE_1 D6 //SmartThings Capabilty "Smoke Detector"

define PIN_TEMPERATURE_1 D7 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

define PIN_TIMEDRELAY_1 D8 //SmartThings Capability "Relay Switch"

//** //ESP8266 WiFi Information //** String str_ssid = "removed"; // <---You must edit this line! String str_password = "removed"; // <---You must edit this line! IPAddress ip(10, 0, 1, 90); //Device IP Address // <---You must edit this line! IPAddress gateway(10, 0, 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(10, 0, 1, 1); //DNS server // <---You must edit this line! const unsigned int serverPort = 8090; // port to run the http server on

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

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

//** //st::Everything::callOnMsgSend() optional callback routine. This is a sniffer to monitor // data being sent to ST. This allows a user to act on data changes locally within the // Arduino sktech. //** void callback(const String &msg) { // Serial.print(F("ST_Anything Callback: Sniffed data = ")); // Serial.println(msg);

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

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

//** //Arduino Setup() routine //** void setup() { //** //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, 20, PIN_WATER_1, 200); //static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

//Interrupt Sensors //static st::IS_Contact sensor3(F("contact1"), PIN_CONTACT_1, LOW, true); //static st::IS_Button sensor4(F("button1"), PIN_BUTTON_1, 1000, LOW, true, 500); //static st::IS_Button sensor5(F("button2"), PIN_BUTTON_2, 1000, LOW, true, 500); static st::IS_Motion sensor6(F("motion1"), PIN_MOTION_1, HIGH, false); //static st::IS_Smoke sensor7(F("smoke1"), PIN_SMOKE_1, HIGH, true, 500);

//Special sensors/executors (uses portions of both polling and executor classes) //static st::S_TimedRelay sensor8(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 3000, 0, 1);

//Executors //static st::EX_Alarm executor1(F("alarm1"), PIN_ALARM_1, LOW, true); //static st::EX_Switch executor2(F("switch1"), PIN_SWITCH_1, LOW, true); //Inverted logic for "Active Low" Relay Board

// // 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 ESP8266WiFi Communications Object //STATIC IP Assignment - Recommended st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

//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::SmartThingsESP8266WiFi(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);

// //Add each executor to the "Everything" Class // //st::Everything::addExecutor(&executor1); //st::Everything::addExecutor(&executor2);

// //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(); }`

device_handlers esp8266_board_manager_version

vseven commented 6 years ago

Try this. Same code just cut down to bare minimum of one motion sensor:

` //** // File: ST_Anything_Multiples_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266's WiFi. // // ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266 // - 1 x Motion devices (used to detect motion) // // Change History: // // Date Who What // ---- --- ---- // 2015-01-03 Dan & Daniel Original Creation // 2017-02-12 Dan Ogorchock Revised to use the new SMartThings v2.0 library // 2017-04-17 Dan Ogorchock New example showing use of Multiple device of same ST Capability // used with new Parent/Child Device Handlers (i.e. Composite DH) // 2017-05-25 Dan Ogorchock Revised example sketch, taking into account limitations of NodeMCU GPIO pins // 2018-02-09 Dan Ogorchock Added support for Hubitat Elevation Hub // //** //** // SmartThings Library for ESP8266WiFi //**

include

//** // ST_Anything Library //**

include //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library

include //Generic Device Class, inherited by Sensor and Executor classes

include //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)

include //Generic Interrupt "Sensor" Class, waits for change of state on digital input

include //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

include //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor

// //NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings) // //#define LED_BUILTIN 16 //#define BUILTIN_LED 16 // //#define D0 16 //no internal pullup resistor //#define D1 5 //#define D2 4 //#define D3 0 //must not be pulled low during power on/reset, toggles value during boot //#define D4 2 //must not be pulled low during power on/reset, toggles value during boot //#define D5 14 //#define D6 12 //#define D7 13 //#define D8 15 //must not be pulled high during power on/reset

//** //Define which Arduino Pins will be used for each device //**

define PIN_MOTION_1 D5 //SmartThings Capabilty "Motion Sensor" (HC-SR501 PIR Sensor)

//** //ESP8266 WiFi Information //** String str_ssid = "removed"; // <---You must edit this line! String str_password = "removed"; // <---You must edit this line! IPAddress ip(10, 0, 1, 90); //Device IP Address // <---You must edit this line! IPAddress gateway(10, 0, 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(10, 0, 1, 1); //DNS server // <---You must edit this line! const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address IPAddress hubIp(10, 0, 1, 2); // 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

//** //st::Everything::callOnMsgSend() optional callback routine. This is a sniffer to monitor // data being sent to ST. This allows a user to act on data changes locally within the // Arduino sktech. //** void callback(const String &msg) { // Serial.print(F("ST_Anything Callback: Sniffed data = ")); // Serial.println(msg);

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

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

//** //Arduino Setup() routine //** void setup() { //** //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. //**

static st::IS_Motion sensor1(F("motion1"), PIN_MOTION_1, HIGH, false);

// // 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::Device::debug=true; st::InterruptSensor::debug=true;

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

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

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

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

// //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(); } `

Thileeppan commented 6 years ago

thanks vseven and ogiewon, I downgrade to 2.4.1 to 2.3 and I upload it again. Still I am seeing the Child device creation failed error message, however the child devices are created and working. I have attached the screen shots and one of the sketch file I am using. device event logs 1 event logs device handlers

//** // File: ST_Anything_Multiples_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266's WiFi. // // ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266 // - 1 x Alarm device (using a simple digital output) // - 1 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 Motion devices (used to detect motion) // - 1 x Smoke Detector devices (using simple digital input) // - 1 x Temperature Measurement devices (Temperature from Dallas Semi 1-Wire DS18B20 device) // - 1 x Relay Switch devices (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" // - 1 x Water Sensor devices (using the 1 analog input pin to measure voltage from a water detector board) //
// Change History: // // Date Who What // ---- --- ---- // 2015-01-03 Dan & Daniel Original Creation // 2017-02-12 Dan Ogorchock Revised to use the new SMartThings v2.0 library // 2017-04-17 Dan Ogorchock New example showing use of Multiple device of same ST Capability // used with new Parent/Child Device Handlers (i.e. Composite DH) // 2017-05-25 Dan Ogorchock Revised example sketch, taking into account limitations of NodeMCU GPIO pins // 2018-02-09 Dan Ogorchock Added support for Hubitat Elevation Hub // //** //** // SmartThings Library for ESP8266WiFi //**

include

//** // ST_Anything Library //**

include //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library

include //Generic Device Class, inherited by Sensor and Executor classes

include //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)

include //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)

include //Generic Interrupt "Sensor" Class, waits for change of state on digital input

include //Generic Polling "Sensor" Class, polls Arduino pins periodically

include //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

//#include //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

//#include //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library

include //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries

//#include //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector) //#include //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

//#include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin //#include //Implements an Interrupt Sensor (IS) and Executor to monitor the status of a digital input pin and control a digital output pin //#include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses //#include //Implements an Executor (EX) via a digital output to a relay //#include //Implements Executor (EX)as an Alarm Siren capability via a digital output to a relay

include //Implements a Sensor to control a digital output pin with timing capabilities

// //NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings) // //#define LED_BUILTIN 16 //#define BUILTIN_LED 16 // //#define D0 16 //no internal pullup resistor //#define D1 5 //#define D2 4 //#define D3 0 //must not be pulled low during power on/reset, toggles value during boot //#define D4 2 //must not be pulled low during power on/reset, toggles value during boot //#define D5 14 //#define D6 12 //#define D7 13 //#define D8 15 //must not be pulled high during power on/reset

//** //Define which Arduino Pins will be used for each device //** //#define PIN_WATER_1 A0 //NodeMCU ESP8266 only has one Analog Input Pin 'A0'

//#define PIN_ALARM_1 D0 //SmartThings Capabilty "Alarm" //#define PIN_SWITCH_1 D1 //SmartThings Capability "Switch"

define PIN_CONTACT_1 D2 //SmartThings Capabilty "Contact Sensor"

//#define PIN_BUTTON_1 D3 //SmartThings Capabilty Button / Holdable Button (Normally Open!) //#define PIN_BUTTON_2 D4 //SmartThings Capabilty Button / Holdable Button (Normally Open!) //#define PIN_MOTION_1 D5 //SmartThings Capabilty "Motion Sensor" (HC-SR501 PIR Sensor) //#define PIN_SMOKE_1 D6 //SmartThings Capabilty "Smoke Detector"

define PIN_TEMPERATURE_1 D7 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

define PIN_TIMEDRELAY_1 D8 //SmartThings Capability "Relay Switch"

//** //ESP8266 WiFi Information //** String str_ssid = "XXXXXXX"; // <---You must edit this line! String str_password = "XXXXXXX"; // <---You must edit this line! IPAddress ip(10, 8, 1, 31); //Device IP Address // <---You must edit this line! IPAddress gateway(10, 8, 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(10, 8, 1, 1); //DNS server // <---You must edit this line! const unsigned int serverPort = 8090; // port to run the http server on

// Smartthings / Hubitat Hub TCP/IP Address IPAddress hubIp(10, 8, 1, 20); // smartthings/hubitat hub ip // <---You must edit this line! const unsigned int hubPort = 39500; // smartthings hub port

//** //st::Everything::callOnMsgSend() optional callback routine. This is a sniffer to monitor // data being sent to ST. This allows a user to act on data changes locally within the // Arduino sktech. //** void callback(const String &msg) { // Serial.print(F("ST_Anything Callback: Sniffed data = ")); // Serial.println(msg);

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

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

//** //Arduino Setup() routine //** void setup() { //** //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, 20, PIN_WATER_1, 200); static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

//Interrupt Sensors static st::IS_Contact sensor3(F("contact1"), PIN_CONTACT_1, LOW, true); //static st::IS_Button sensor4(F("button1"), PIN_BUTTON_1, 1000, LOW, true, 500); //static st::IS_Button sensor5(F("button2"), PIN_BUTTON_2, 1000, LOW, true, 500); //static st::IS_Motion sensor6(F("motion1"), PIN_MOTION_1, HIGH, false); //static st::IS_Smoke sensor7(F("smoke1"), PIN_SMOKE_1, HIGH, true, 500);

//Special sensors/executors (uses portions of both polling and executor classes) static st::S_TimedRelay sensor8(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 1000, 0, 1);

//Executors //static st::EX_Alarm executor1(F("alarm1"), PIN_ALARM_1, LOW, true); //static st::EX_Switch executor2(F("switch1"), PIN_SWITCH_1, LOW, true); //Inverted logic for "Active Low" Relay Board

// // 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 ESP8266WiFi Communications Object //STATIC IP Assignment - Recommended st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

//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::SmartThingsESP8266WiFi(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);

// //Add each executor to the "Everything" Class // //st::Everything::addExecutor(&executor1); //st::Everything::addExecutor(&executor2);

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

mattyow1 commented 6 years ago

So I'm not quite sure what happened but I logged back into ST IDE and was checking everything again and all of my Device Handlers were gone (Page was empty). I readded all the Device Handlers and Eureka! it all magically started working by design.

I did not end up having to use the shorter code provided however I do want to report that yesterday I did do the link to Samsung account that ST App prompted for. I wonder if perhaps something in the background was going on with my account and I was being migrated to a different server or something?

Anyway, I'm going to make a couple more of these and make sure I don't run into the same problem.

I noticed Thileeppan was getting some help here as well, should I leave this open or use the "Close and comment" button?

vseven commented 6 years ago

I'd say close it....his issue is probably the board version issue or the same as yours. He can open a new issue if his problems persist.

@Thileeppan - Delete your parent and child devices, wait 10 minutes, and readd the parent. If it doesn't create the child devices open a new issue with the output from the IDE logging screen.

ogiewon commented 6 years ago

@Thileeppan, If your child devices all exist and are working, then the parent must be receiving some unhandled random data, thereby causing the error you’re seeing. Can you paste the data from the parent device’s live logging?

Thileeppan commented 6 years ago

I have attached the live logs.

Is it anyway the Door control work with NodeMCU ESP2866. however I have modified the ST_Anything_Multiples_ESP8266WiFi sketch file, would you able to check it for me.

basement events 1 basement events live logs 1 live logs

//** // File: ST_Anything_Multiples_ESP8266WiFi.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 NodeMCU ESP8266 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 NodeMCU ESP8266's WiFi. // // ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266 // - 1 x Alarm device (using a simple digital output) // - 1 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 Motion devices (used to detect motion) // - 1 x Smoke Detector devices (using simple digital input) // - 1 x Temperature Measurement devices (Temperature from Dallas Semi 1-Wire DS18B20 device) // - 1 x Relay Switch devices (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" // - 1 x Water Sensor devices (using the 1 analog input pin to measure voltage from a water detector board) //
// Change History: // // Date Who What // ---- --- ---- // 2015-01-03 Dan & Daniel Original Creation // 2017-02-12 Dan Ogorchock Revised to use the new SMartThings v2.0 library // 2017-04-17 Dan Ogorchock New example showing use of Multiple device of same ST Capability // used with new Parent/Child Device Handlers (i.e. Composite DH) // 2017-05-25 Dan Ogorchock Revised example sketch, taking into account limitations of NodeMCU GPIO pins // 2018-02-09 Dan Ogorchock Added support for Hubitat Elevation Hub // //** //** // SmartThings Library for ESP8266WiFi //**

include

//** // ST_Anything Library //**

include //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library

include //Generic Device Class, inherited by Sensor and Executor classes

include //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)

include //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)

include //Generic Interrupt "Sensor" Class, waits for change of state on digital input

include //Generic Polling "Sensor" Class, polls Arduino pins periodically

include //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

include //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

include //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library

include //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries

include //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)

include //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

include //Implements an Interrupt Sensor (IS) and Executor to monitor the status of a digital input pin and control a digital output pin

include //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin for button presses

include //Implements an Executor (EX) via a digital output to a relay

include //Implements Executor (EX)as an Alarm Siren capability via a digital output to a relay

include //Implements a Sensor to control a digital output pin with timing capabilities

// //NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings) // //#define LED_BUILTIN 16 //#define BUILTIN_LED 16 // //#define D0 16 //no internal pullup resistor //#define D1 5 //#define D2 4 //#define D3 0 //must not be pulled low during power on/reset, toggles value during boot //#define D4 2 //must not be pulled low during power on/reset, toggles value during boot //#define D5 14 //#define D6 12 //#define D7 13 //#define D8 15 //must not be pulled high during power on/reset

//** //Define which Arduino Pins will be used for each device //** //#define PIN_WATER_1 A0 //NodeMCU ESP8266 only has one Analog Input Pin 'A0'

//#define PIN_ALARM_1 D0 //SmartThings Capabilty "Alarm"

define PIN_SWITCH_1 D1 //SmartThings Capability "Switch"

//#define PIN_CONTACT_1 D2 //SmartThings Capabilty "Contact Sensor" //#define PIN_BUTTON_1 D3 //SmartThings Capabilty Button / Holdable Button (Normally Open!) //#define PIN_BUTTON_2 D4 //SmartThings Capabilty Button / Holdable Button (Normally Open!)

define PIN_TEMPERATUREHUMIDITY_1 D5 //SmartThings Capabilities "Temperature Measurement" and "Relative Humidity Measurement"

define PIN_TEMPERATURE_1 D6 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

define PIN_DOORCONTROL_CONTACT_1 D7 //SmartThings Capability "Door Control"

define PIN_DOORCONTROL_RELAY_1 D8 //SmartThings Capability "Door Control"

//#define PIN_MOTION_1 D5 //SmartThings Capabilty "Motion Sensor" (HC-SR501 PIR Sensor) //#define PIN_SMOKE_1 D6 //SmartThings Capabilty "Smoke Detector" //#define PIN_TIMEDRELAY_1 D8 //SmartThings Capability "Relay Switch"

//** //ESP8266 WiFi Information //** String str_ssid = "XXXX"; // <---You must edit this line! String str_password = "XXXXX"; // <---You must edit this line! IPAddress ip(10, 8, 1, 29); //Device IP Address // <---You must edit this line! IPAddress gateway(10, 8, 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(10, 8, 1, 1); //DNS server // <---You must edit this line! const unsigned int serverPort = 8090; // port to run the http server on

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

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

//** //st::Everything::callOnMsgSend() optional callback routine. This is a sniffer to monitor // data being sent to ST. This allows a user to act on data changes locally within the // Arduino sktech. //** void callback(const String &msg) { // Serial.print(F("ST_Anything Callback: Sniffed data = ")); // Serial.println(msg);

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

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

//** //Arduino Setup() routine //** void setup() { //** //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, 20, PIN_WATER_1, 200); static st::PS_TemperatureHumidity sensor5(F("temphumid1"), 60, 40, PIN_TEMPERATUREHUMIDITY_1, st::PS_TemperatureHumidity::DHT22,"temperature1","humidity1"); static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

//Interrupt Sensors //static st::IS_Contact sensor3(F("contact1"), PIN_CONTACT_1, LOW, true); static st::IS_DoorControl sensor3(F("doorControl1"), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, false, 1000); //static st::IS_Button sensor4(F("button1"), PIN_BUTTON_1, 1000, LOW, true, 500); //static st::IS_Button sensor5(F("button2"), PIN_BUTTON_2, 1000, LOW, true, 500); //static st::IS_Motion sensor6(F("motion1"), PIN_MOTION_1, HIGH, false); //static st::IS_Smoke sensor7(F("smoke1"), PIN_SMOKE_1, HIGH, true, 500);

//Special sensors/executors (uses portions of both polling and executor classes) //static st::S_TimedRelay sensor8(F("relaySwitch1"), PIN_TIMEDRELAY_1, LOW, false, 3000, 0, 1);

//Executors //static st::EX_Alarm executor1(F("alarm1"), PIN_ALARM_1, LOW, true); static st::EX_Switch executor2(F("switch1"), PIN_SWITCH_1, LOW, true); //Inverted logic for "Active Low" Relay Board

// // 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 ESP8266WiFi Communications Object //STATIC IP Assignment - Recommended st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);

//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::SmartThingsESP8266WiFi(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);

// //Add each executor to the "Everything" Class // //st::Everything::addExecutor(&executor1); st::Everything::addExecutor(&executor2);

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

ogiewon commented 6 years ago

@Thileeppan

Based on your current logs, I think everything is working fine. I do not see any 'new' errors that a child could not be created. If you click the Parent Device's 'Refresh' tile in the ST Classic Mobile App, while watching Live Logging for the Parent, do you seen any additional 'child could not be created' messages? If not, then everything is fine.

I believe you may have simply found a bug in my error handler during the initial setup of the parent device. It probably is not hurting anything. I'll try to reproduce it when I have more free time.

Aside from the error message in the Parent Device's list of Events, are you experiencing any issues? If not, then you can safely ignore the old event.