ST_Anything and WEMOS D1 mini Board (ESP8266)... HELP!

Hi,
To all the Arduino + ST_Anything Experts and Gurus here…

first of all, I apologies if this is a repeated entry, but I spend some time an efforts looking for solutions and/or any answer and it result in nothing.

My situation is that im NOT able to see my ESP8266 (or any other new device) on the Classic App after I performed all the steps and instruction of the ST_Anything’s GITHUB (the read me file) and I DONT KNOW WHY!!! :’(

I already spend the whole week before and after work looking for a solution but i dont find it. So i have no other way than just ask into the forum.

I really apologies for taking some of your time by asking, but Im almos surrender and i don want to!!! I know that is possible!!
Please, any help is more than appreciated…

So far, this is what i do:
*Im using the “ST_Anything_GarageDoors_ESP8266WiFi” Arduino File
(Which is one of the most easy/simples and requiere nothing fancy to operate and/or additional Libraries, I think… ).
*I downloaded everything related to ESP8266 (this is not my first time using it. I love this little guys for my projects).
*I Linked my ST/Samsung Account with GitHub.
*I Copied/installed all the DevicesHandlers from Github to my ST/Samsung
*I already seated the ST Hub with an Static IP in my network (192.168.0.13)
*I already change the SSID and Password in the Arduino’s Code

  • I check on my Router/Modem settings and i see that the Arduino/Wemos Board is connected to my network.
    *I changed all the Router’s Information on the Arduino code (please see both images).

However, after all this, i dont see any new device installed/paired under the “things” tab in “My Home” on the classic app.
In addition, if i try to “add” a new device, the Hub dont “see it” on automatic mod or manual (by clicking on “add device manually” /others/ “SmartThing Shield for Arduino”.

Please!! Did i miss something!!??
Im attaching screenshots of the ArduinoCode and my RouterSettings.
Any help is more than appreciated.
THANK YOU!!!


You have to MANUALLY add the “Parent ST_Anything Ethernet” device using the ST Cassic WEB IDE. It’s in the ReadMe. Just follow those specific steps as it appears you’re very close.

1 Like

Greaaaat!!! I finally did!!! I didn’t noticed that part of the readme has to be done inside the ST Developer web (I was looking on the app or something like else).

OMG, it feels so great!!!
Thank you so much, I finally did it… you point me in the right direction… I’m so glad!! Thank you!!!
I really Appreciate the help!!

1 Like

Dan,
I saw in ST Clasic app all the door’s Contact Sensors and the Temperature readings (I dont have the temp. Sensor connected yet, that is the reason of those readings)…
But I can’t find on the ST apps any “Button” to be pressed for the relays connected on the WemosBoard.
Did I miss something?? Is there any additional step to be done?
Please, see picture attached. Thank you!!

Click on the word “Closed” or “Open” as that will send a message to the ESP8266 to momentarily activate the relay.

I tried… But dint work!
I revised the code and I see that you are using Pin #2 and Pin#6 for Relays1&2 (respectively).
I armed an small circuit to see when the contacts and relays works, but only the contact are working fine (in the circuit and ST).
For some reason, the relays are not responding when I pressed the buttons.

Did i missed something on the code? (please, see the attached code).
Or their might be something in the DeviceHandeler??

Thank you!

This is the code that im using…
Contac sensor are working fine, but relays not.
Thank you

//******************************************************************************************
// File: ST_Anything_GarageDoors_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
// - 2 x Door Control devices (used typically for Garage Doors - input pin (contact sensor) and output pin (relay switch)
//
// Change History:
//
// Date Who What
// ---- — ----
// 2019-01-24 Dan Ogorchock Original Creation
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP8266WiFi
//******************************************************************************************
#include <SmartThingsESP8266WiFi.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_Illuminance.h> //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

#include <PS_TemperatureHumidity.h> //Implements a Polling Sensor (PS) to measure Temperature and Humidity via DHT library
#include <PS_DS18B20_Temperature.h> //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries
#include <PS_Water.h> //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)
#include <IS_Motion.h> //Implements an Interrupt Sensor (IS) to detect motion via a PIR sensor
#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_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 Siren capability via a digital output to a relay
#include <S_TimedRelay.h> //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
//******************************************************************************************

//Garage Door Pins
#define PIN_DOORCONTROL_CONTACT_1 D1 //SmartThings Capabilty “Door Control”
#define PIN_DOORCONTROL_RELAY_1 D2 //SmartThings Capabilty “Door Control”
#define PIN_DOORCONTROL_CONTACT_2 D5 //SmartThings Capabilty “Door Control”
#define PIN_DOORCONTROL_RELAY_2 D6 //SmartThings Capabilty “Door Control”

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid = “HOME”; // <—You must edit this line!
String str_password = “xxxxx”; // <—You must edit this line!
IPAddress ip(192, 168, 0, 227); //Device IP Address // <—You must edit this line!
IPAddress gateway(24, 50, 201, 1); //Router gateway // <—You must edit this line!
IPAddress subnet(255, 255, 255, 0); //LAN subnet mask // <—You must edit this line!
IPAddress dnsserver(24, 138, 252, 19); //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, 0, 13); // 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

//Interrupt Sensors
static st::IS_DoorControl sensor1(F(“doorControl1”), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, true, 1000, 1000);
static st::IS_DoorControl sensor2(F(“doorControl2”), PIN_DOORCONTROL_CONTACT_2, LOW, true, PIN_DOORCONTROL_RELAY_2, LOW, true, 1000, 1000);

//Executors

//*****************************************************************************
// 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, “OfficeESP”);

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

//*****************************************************************************
//Add each executor to the “Everything” Class
//*****************************************************************************

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

Also, thank you so much for the help and the “couching”… i really appreciated!! :wink:

What relays are you using? How are they wired to the board?

Im using some cheap Chinese relays, that I bought from Ebay long time ago, their are activated with a LowSignal from the Arduino/wemos board.

How ever, I also tried using a LED (connecting the negative lead/side of the LED to the Board) and it doesn’t work.
I also switch the LED of it position (just to double check) and does not work either.

Can you get the standard “blink” example a Arduino app to activate your LED? Remember to reverse the logic to active low and see if you can still get it to work. This will help to sort out the wiring.

Also, what shows up in the Arduino Serial Monitor window when you click on each of the garage doors? If nothing, then you haven’t entered the Arduino IP address and port correctly in the parent device’s settings.

Thanks Dan,
Regarding the circuit and the “blink” logic,
I already do it prior to write you on the forum.
Also, I have mine own code/sketch and circuit to test all the basics functionality of this board and is working fine. Also the led by itself.

I will try what you mention of the serialmonitor.
I’ll check what the serial monitor shows when I click the buttons, but I think that it says nothing.
I do remember that when I close/open the contact sensors there is something typed on the serial monitor, but I dont remember that this happens when I pushed the buttons.

Note:
I also saw the button changing of state when I open/close the contact sensors. I dont know why I’m not capable of active the board outputs when I press the buttons on the ST app.

Also, did you checked my code? Is anything wrong on it? How can I see if there is any issue with the DeviceHandler? (I change nothing on your device handler… so is supposed to be working just fine).

Thanks for the help and advice!!!

Your sketch’s network section looks strange and may explain the issue you’re seeing. Are your ST hub, Router, and ESP8266 all on the same LAN? Why do you have such a strange gateway and dns server address? Usually those are the same address as your router’s LAN address.

-Yes, all of them!

-I fill this from my router’s data.
I attached a picture of it in this thread.
Fid you recomend me to change it??
Did you think this is the issue?

Here, my router settings.

Again, thanks for the help!!

Those are the router’s WAN settings. You need to use LAN settings. If your router’s LAN IP is 192.168.0.1, then use that as the gateway and dns addresses in your sketch.

Ok, Gateway and DNS addresses is going to be both the same… got it!!

Ps:
I think that this is exactly the LAN IP, but I have to double check!! I will try all.of this as soon is I get home.
I hope that this resorve the issue with the buttons… :crossed_fingers:

Thanks for the help!!

I finally can says that… “It’s alive!!!” “It’s aliveeeeeeee!!!” :joy:

I finally founded my error. I doesn’t was the gateway settings, it was the ESP8266 Board’s IP itself!!
I seated an static IP for the STHub and I pretty sure that I also did this for the ArduinoBoard.
However, I looks that I forget this part… lol
So I saw in my network that the board have other IP inside the network, I changed exactly to the one that I inserted on the code and… whal-a!! Is working like a charm!!

It took me a while to find the error, I was focusing on the code, but the error was in the DHCP settings for the board.

It was a really great lesson for the kids at home… “never surrender; hard work pays off”!!

Really appreciate the help Dan!!! :wink:

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.