[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Ahh!
Finally found what I needed.

If anyone else is having troubles getting multiples doorcontrol door control to work and/or compile on the esp8266 wifi (just throwing up search terms I was using to look for an answer)…see this post. And really 2 or 3 more that follow it for some additional related bonus material…

Plugged that in and I’m now immediately ready to print up a control/mounting box and wire up a switch on the door. I wasn’t giving up until I’d skimmed through every post here. Found the answer in 5 minutes. Reading is better than searching!

RTFM FTW!

Not a moment too soon. I left the dang garage door open again last night.

1 Like

Send me link buy Arduino Shield, Thanks all you.:heart_eyes:

The ST ThingShield is no longer sold. They are very hard to find on the used market. If you look through the ReadMe in my Github repository, you will see the supported hw combinations.

I have had the best luck with a stand-alone NodeMCU ESP8266 board. The other reliable platform is an Arduino MEGA + W5100 (or W5500) Ethernet shield.

Sorry if I missed it in the thread, but is there any wireless option for connecting an UNO R3 other than the ThingShield which I can’t seem to find anywhere?

There is no really good wireless option for the UNO R3. Personally, I would strongly recommend a NodeMCU ESP8266 board. The WiFi on these boards is very reliable, and there is no need for a separate Arduino board.

If you can describe you project, I’d be happy to help recommend the hardware that I believe would work the best using ST_Anything.

Hi Dan,
I’m basically doing (did) reactive color bias lighting for my TV. I went from dumb lights with lutron switches, to smart ones that que off screen color. The negative of this, is that even though I should allegedly be able to cut power to the LEDs with the Lutron switch to no harm, it tends to freak out and need resetting. Now this isn’t the biggest deal in the world, but I’d like to be able to turn the leds on and off as part of the same scenes I previously had (or I suppose in some use case mess with the colors independently of whatever was on the screen).

Any suggestion would be great, caveat being that I’m absolutely technically incompetent, so if the ‘coding’ is much more than copy and paste I’ll end up in a mess. :sweat_smile:

These are the steps, software wise, that I followed. The only hardware difference is that I used a UNO R3:

Thanks for all your help so far @ogiewon! I’m still trying to create a fully combined device handler for a single device with multiple sensors. I’m having a terrible time and can’t seem to figure it out. I know my arduino code works because the standard parent child method works great. I can see all the sensors and control the rgb led. My device has a temperature/humidity sensor, a motion sensor, an illuminance sensor, and an rgb led. Like I said, they all work in the parent child format.
The names of things coming from the device code are:

motion1
illuminance1
temperature1
humidity1
rgbSwitch1

I can get all three sensors to work correctly, but I can’t for the life of me get the rgbswitch working. I’ve hooked up the device to the ide and watched the serial monitor looking for clues, but I got nothing.
Any chance you can help me? Here’s where I’m at now:

The tile layout doesn’t matter, I can rearrange that once everything is working. I’ll just follow this.

If you are using Hyperion, there is a ST DTH for your hyperion setup.

But if you did this completely through your PC, you should look at a program called EventGhost. I have this installed to perform PC functions at the same time as I do things with SmartThings. So, when I disable voice alerts (with a virtual switch) it also mutes my PC. When my office lights turn on, it activates my screensaver. You might be able to get it to work with whatever program you’re running on your pc to get the lights to turn on or off. There is a smartapp available to choose which devices report to EventGhost and how they should be structured.

1 Like

One thing I would certainly change is to remove the numbers at the end of each device/tile name. For example, ‘temperature1’ should become ‘temperature’, ‘humidity1’ would be ‘humidity’. This is to make sure the attributes within the DTH are updated and exposed properly to other Smart Apps. You will also need to change your Arduino sketch to remove the numeric suffix from every device.

(Note: the numeric suffix was needed to implement the Parent/Child device handler, especially when supporting more that one of each device capability on an Arduino.)

As for the RGB device, hopefully @vseven Allan will chime in as he wrote that child DTH and the Arduino class for it.

Off the top of my head for each device you are using the “proper” type so for example:

valueTile("humidity", "device.humidity1", width: 2, height: 2, inactiveLabel: false)
standardTile("motion", "device.motion1", width: 2, height: 2)

Etc but for the RGB switch you are doing this:

multiAttributeTile(name:"rgbSwitch1", type: "lighting", width: 6, height: 4, canChangeIcon: true){
    tileAttribute ("device.rgbSwitch1", key: "PRIMARY_CONTROL") {

And the original code is this:

 multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
    tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {

So at the very least I don’t think it will turn on and off correctly since the switch property isn’t being toggled.

1 Like

Dan -
I am running a couple of switches with local control. I modified the momentary example, we discussed this earlier.
Was wondering how can I detect if I have a wifi connection or not. Basically what I want to do in the toggle case is if there is no wifi connection reset the micro using ESP::reset(). Basically what I am running into is that from time to time the micro loses wifi, I still have local control but it doesnt connect to wifi unless its reset.

thanks

Enis,

I cannot think of anything built into ST_Anything to detect the network is down. Perhaps you could try to ‘ping’ the ST Hub’s IP address periodically (like once every minute or so), as part of the loop() routine in your sketch. If the ping() times out, you could try to force a reset of the ESP8266.

Dan

Dan…or anyone really…
I’ve got door control clicking away, but might be running into some laws of electrical behavior issues.

I referenced a post below from a series of posts on door control, pins, and relays. I’m using some of the recommended pins, but have the issue off the door triggering if I remove and add power to the es8266.

Figured it’s was going to be easier to use the 3.3 from the esp8266…so i went with this relay. .

I’m having trouble deciphering the “product details”.
“Instructions with the signal output;
Signal input port can connect microcontroller IO port, high level signal”

I’m guessing that these are atypical to most Arduino friendly relays as Dan noted in that they Active High Logic? And that maybe changing some “low” to “high” on the constructor statements should/might do the trick?

Otherwise, I suppose I could just change out the relay and power it externally. I just thought I was being clever and avoiding that extra power source.

Any which way super pumped that I successfully passed the post bench, pre install test and actually made the door move by the ST app. Next step is to sort this piece of mind question and then final install.

What type of strikeplate are you using? A fail safe or fail secure? Are you connecting your plate to the NC or NO connection on the relay?

Dan
Ended up doing this - a little hard to test since the condition is random and nearly impossible to repro

      if (WiFi.isConnected() == false) {
              unsigned long currentMillis = millis();
              if (currentMillis >= wifiTimeoutInterval)  {
                 Serial.println(F("**** WiFi Disconnected. ***"));
                 ESP.reset();
              }
      }
1 Like

Looking at your code, I am not sure if the logic will work as you expect. You typically want to store the value of millis() at the start of the event (i.e. the first time you detect WiFi is disconnected) and then compare the time delta versus the timeout value.

Something like…

If (millis() - timeStartOfEvent > wifiTimeoutInterval) { … }

Make the timeout interval long enough to allow the normal WiFi reconnect logic to have a try, and only use the reset as a last resort.

As for testing, simple turn off your WiFi router/access point to see if the ESP8266 resets.

1 Like

Here are the details of what each argument of the constructor is used for:

//			  st::IS_DoorControl() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- byte pinInput - REQUIRED - the Arduino Pin to be used as a digital input
//				- bool iState - REQUIRED - LOW or HIGH - determines which value indicates the interrupt is true
//				- bool internalPullup - REQUIRED - true == INTERNAL_PULLUP
//				- byte pinOutput - REQUIRED - the Arduino Pin to be used as a digital output
//				- bool startingState - REQUIRED - the value desired for the initial state of the switch.  LOW = "off", HIGH = "on"
//				- bool invertLogic - REQUIRED - determines whether the Arduino Digital Output should use inverted logic
//				- long delayTime - REQUIRED - the number of milliseconds to keep the output on

Based on this, and the fact you are using an Active High relay, I believe your constructor should look something like:

 static st::IS_DoorControl         sensor3(F("doorControl1"), PIN_DOORCONTROL_CONTACT_1, LOW, true, PIN_DOORCONTROL_RELAY_1, LOW, false, 1000); //configured for Active High Relay Board

The pins used on the ESP8266 are critical. Using D1 and D2 should be safe and not cause the relay to activate upon power up.

Thanks man! I knew I was headed in the right direction. I would have initially got it wrong.
But…would have banged my head against the wall for a bit and fiddled with every combination until I got it right.
I have high confidence this will work. Some other things I’ve been learning about electricity-wise, relay-wise are totally tracking here.

You’ve really built an elegant platform. I don’t have any immediate plans to add much. I considered a smoke detector, because the brand name ones that are integrated with ST cost a fortune. But, I don’t mind spending a fortune for that. Garage door control? No way am I paying another $100 for a Linear unit that will crap out in 10-13 months. That’s how this project started. It stopped working. It was still talking to ST. I checked and reconnected wires. Got the multimeter out and saw it wasn’t passing current. Tried everything. Finally got online to search “linear garage door smartthings not working” and found post after post, thread after thread of people complaining they were failing at 10-13 months. Someone referenced ST_Anything and I was a couple months in to fiddling with Arduinos. To the point where I’d made to functional, usable devices. One for home. One for work. You know, just past the stage of making things blink and spin. It was perfect timing for me.

What impresses me is how far you took this. I keep expecting to turn a corner and having to figure out the complexities of coding…in the libraries. And while I could do some of that…and I might at some point… Most people wouldn’t need to. You’ve done all the heavy lifting. It just “works”…for 95% of what people want to do. You’ve done not only the heavy lifting…but the prettyifying too. This stuff is dang near plug and play. About the only thing that keeps it from being that is all of the varying quirks of all the varying components…and there’s just no way to account for all that.

2 Likes

Thanks for the feedback! Glad to hear ST_Anything is ‘scratching the itch’ for your DIY projects. My son and I designed it to be as flexible as possible, while still making it relatively simple to use for anyone with some basic programming skills. ST_Anything is also very simple to extend to support other hardware devices and ST Capabilities.

1 Like

Dan has really done a wonderful job here - there so many threads where people are looking for simple solutions, and once you get over the soldering iron part this opens up so many possibilities.
On that note looking for some suggestions on how to detect when a mini-split is on. Don’t want to spend $$ on the line voltage Aeon thing. Something that can detect either the vane moving or the motor movement … any ideas?