[RELEASE] ST_Anything v2.9.2 - Arduino/ESP8266/ESP32 to ST via ThingShield, Ethernet, or WiFi


(Dan) #2347

This is usually just an artifact of the ST App not updating quickly. This has been an issue for years. As long as the device does what it is supposed to do, thee really is no harm if the ST App is a bit sluggish. On iOS you can drag the screen down to force a refresh of the ST App.

You can control the initial conditions to make sure the outputs are in the correct states at startup by adjusting the parameters when you declare the devices in your sketch.

//			  Create an instance of this class in your sketch's global variable section
//			  For Example:  st::S_TimedRelay sensor1("relaySwitch1", PIN_RELAY, LOW, true, 1000, 0, 1);
//			  st::S_TimedRelay() constructor requires the following arguments
//				- String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
//				- 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 Ouput should use inverted logic
//				- long onTime - REQUIRED - the number of milliseconds to keep the output on, DEFGAULTS to 1000 milliseconds
//				- long offTime - OPTIONAL - the number of milliseconds to keep the output off, DEFAULTS to 0
//				- intnumCycles - OPTIONAL - the number of times to repeat the on/off cycle, DEFAULTS to 1

(Brij Mohan) #2348

I have my August Lock connected to SmartThings, I am trying to use NFC Tags connected to my Arduino board to control the locks. Using this library I see I can integrate lots of things with SmartThings, but I don’t see any controller related to NFC. Just wanted to check if it’s supported in current release? Thanks.

(Dan) #2349

Unfortunately, there is currently no support for an NFC reader. If you’re a c++ programmer, you could add it.

(Denis Grabocka) #2350

Hi there Dan i hope you had a fantastic weekend;
- bool startingState - REQUIRED - the value desired for the initial state of the switch. LOW = "off", HIGH = "on"
I modified the sketch to change from yours that was LOW (as it should be) to HIGH with the hopes that the relays will be booting up as off and initially they do they are off… but once you touch them once they go right back to their On state and than Off than back On and remain that way from than on!!!
It is beyond me :slight_smile:

Have a great week

(Denis Grabocka) #2351

I was wondering the same thing but i figured it was beyond the scope of this project since its goal is to keep things as simple as possible… however i want to implement the same thing and while searching i found this thread Nfc-ing a lock that i am thinking about pursuing.
It uses a Particle Photon however and not an Arduino also IFTTT


Can you give us a diagram of what you are talking about? I’ve never seen NFC tags “connected” to anything. All the tags I’ve used get programmed and then placed. So, are you carrying around the tag? Or are you reading a placed tag with your phone?
And when you say NFC, do you actually mean RFID? Because they are different. Basically, if you can give a better description or a link to what you’re talking about, I think that would help someone to answer your question.

(Dan) #2353

Did you also change the ‘invertState’ parameter? I am assuming your relay may be the opposite logic of the ones i have used. By trying all of the combinations of the 2 parameters, you should be able to get it to work the way you want. There are only 4 combinations.

(Denis Grabocka) #2354

Great success LOL :slight_smile:
It worked like a charm LOW and Inverted=true

Thank you for your very much appreciated help

(Dan) #2355

Glad to hear you found a working configuration!

(L B) #2356

Have you ever considered or even have a dth for controlling small amplifiers for audio in a whole house install? I have read you can monitor output from an audio device such as a Chromecast audio to trigger power to an amp.

(Dan) #2357

No, I have never considered this. What is the use case, exactly? You want to command a Chromecast to play some audio or video, and then have a Amplifier/Receiver turn on automatically? I would personally use a Logitech Harmony Hub to handle this, not ST_Anything. Amazon even has a Logitech Harmony Hub with Remote on sale today for $50.

(L B) #2358

To start you can build a very inexpensive whole house amplifier to drive multiple rooms with speakers. I currently use a 12 channel amp that auto powers 2 channels on separate Chromecast devices.


That unit is 500.00. There are some great prices on 2 channel amps that don’t have auto sensing built in to power on and off from audio input. These can be had for about 30-40 each. I have this setup for a whole house audio system that any device can stream music to a Chromecast audio and play single out multiple rooms at once.

There are also some projects that can auto start a stream on action tiles.

Chromecast audios are on sale right now for 15.00 as well…

(Dan) #2359

OK, that helps… What type of control for these amps are you looking for? Just a simple on/off type of signal? If so, ST_Anything would easily do that for you, using a relay connected to a digital output. You would have to use ST to know if the Chromecast is on or off, and then simply change the state of the ST_Anything 'Switch" device appropriately.

(Matthew Sanders) #2360

I’m having trouble adding a device with ST_anything. Under “type” there’s no longer an option for “Parent_ST_Anything_Ethernet” . Has anyone else had this problem and solved it?


(Matthew Sanders) #2361

Found it at the very end. Did not get alphabetized.

(L B) #2362

To start to control them on, off would be great but how would I know when the Chromecast is on or off?


Well, it appears you can control the amp though a mini jack on the back. From the manual:

So it appears that you can use the port on the back to trigger the device to turn on and off and can read its current state with the other port. To read the 12V output though, you’d have to run it through a 12 v relay as the input pins on the ESP8266 are 3.3v max. It appears that would be the limit of your ability to control though.

The chromecast is off whenever your TV is off, if your TV is what is supplying the power. The Chromecast doesn’t have a switch. If it’s plugged in, it’s on.

(Dan) #2364

That’s where you would need some sort of SmartThings to Chromecast integration. That is not in the scope of ST_Anything.

(Seth Miller) #2365

I’ve got an ultrasonic sensor and an RGB strip hooked up to a nodeMCU and got it working perfectly with ST. However, I want to add some code local to the nodeMCU to have the RGB strip react in realtime to the ultrasonic sensor. This would require a reading from the sensor several times per second which means the callback routine wouldn’t work very well.

Is there a way for me to get sub-second readings from the nodeMCU from the library that is loaded as part of ST_Anything without messing with the polling frequency for ST and without trying to run a local loop against the sensor?

(Dan) #2366

I think you might want to write a truly custom sketch that uses my “SmartThingsESP8266WiFi” library for communications to your ST Hub. This is the same library that ST_Anything uses behind the scenes. This way, you can easily control the frequency of what data is sent to SmartThings (e.g. only every 30 seconds), while still reading the sensor as fast as you’d like and controlling the RGB strip. As long as the strings you send to SmartThings follow the exact same naming convention that ST_Anything uses, the ST_Anything Parent and Child Device Handlers will still work without any changes.

As is always the case, you need to make sure that you do not use any blocking calls in the loop() portion of the sketch, like the ‘delay()’ function as those wreak havoc on the network communications. Use ‘millis()’ to create timers.

Here is an example sketch that I wrote for another user earlier this year that demonstrates the use of the SmartThingsESP8266WiFi library with a custom sketch.