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

Thanks! I will dig down into this comming weekend! Thanks! I will let you know how it goes!

So tidbit to those excited to work on arduino hardware…

DO NOT CONTINUE WORKING WHEN TIRED. Yes I know it is exciting to work on @ogiewon great solution for custom devices…BUT you can have a HUGE issue like I did last night.

I was making great progress towards my custom home LUX sensor for motion/light automation. I accidentally pushed my creation off the table and the 3.3v and negative wires came undone. In my rush to get things moving back I accidentally crossed the wires resulting in my WeMo and Adafruit Lux sensor to fry. UGH! Why didn’t I buy spares?!? Amazon why don’t you ship in hours and in the middle of the night?!?!

Anyways back to waiting patiently. Just wanted to share.

1 Like

Been there, done that… multiple times… Glad these parts are so inexpensive!

Hi, Ogiewon

First off, thanks so much for ST_Anything and all the hard work around it.

I have bought an Arduino Mega 2560, plus W5100 shield some time back. Ben having issues with the W5100 not staring up most of the time. Running off 7.5Volt 2 Amp PSU.

So, I bought a Arduino Leonardo Eth (Chinese). Tried to upload your W5500 to it: As expected: Too little memory.

What to do? I am not good with code at all. :frowning:


Finding a reliable W5100 shield is becoming more and more difficult. So I totally understand the desire for something more robust.

I have never used a Leonardo, so you are blazing a new trail. You have run into problems, which will be hard for me to assist with since I don’t have the same platform to test and debug with.

Start commenting out superfluous sensors in your setup() routine - both in the definition of sensors/executors, and a little lower where they are ‘added’ to ‘Everything’. That will reduce the size of the sketch dramatically.

I have no idea if the Leonardo with W5500 onboard will work with the current libraries. My W5500 is a shield that I use with an Arduino MEGA 2560.

You may want to start with am inexpensive NodeMCU ESP8266 board which has built-in WiFi and works very well for most people.

One of the things my coming home piston does is to open the correct garage door. I have SmartThings Presence sensors in my vehicles which is supposed to tell the piston which vehicle is in its garage (present). So, if Vehicle A’s presence sensor is present, it means I’m coming home in Vehicle B and the piston opens vehicle B’s garage. Problem is, the presence sensors do not work well when they are left in a vehicle. Almost half the time the sensors report a vehicle not being home when it is.

When I was reading up on how to use ST_Anything (which I still don’t really don’t due to my lack of programming skills), I came across a thread where @psun03
used an ultrasonic sensor to determine if a garage door is open or not. If I understand the discussion correctly, the sensor simulates as a switch in the sense that if the distance reported by the sensor is less than a specified distance, the switch is reported to be On and the other way around.
I know people have tried numerous solutions to determine vehicle presence for garage door opener pistons. So, I thought an ultrasonic sensor would be a perfect solution (and probably many times more reliable than my current solution) to determine which garage is occupied. (Which would allow a different (and more practical) approach in my piston. If I could get this to work, it would simply be a matter of open the garage which is not occupied. )
I’ve tried the sketch and DTH Dan set up for @psun03, but I could not get it to work as it is no longer compatible with the latest ST Anything version.
So, the question Dan probably fears is, what are the changes of adding the necessary library and DTH to ST Anything for ultrasonic sensors? If the DTH could be set up to report the distance to webCoRE, I suppose the best approach would be to get the sensor to report distance to webCoRE. That would make the setup a lot more useful to many people as it could be used for other purposes as well, as opposed to simulating a switch using a fixed distance to switch between On/Off.

So, you want know what is the best method of knowing if a specific car is currently in your garage or not, correct? That’s an interesting problem. Sounds like you’ve already tried the most obvious answer, the ST key-fob presence sensors, without too much luck… Have you placed a zigbee repeater device (like a zigbee smart outlet) in your garage to help improve the reliability?

You could use the exact same Arduino code I helped you with for the tank Level monitoring project, as it already knows how to measure distance using an ultrasonic sensor. You would need to change the Child Device Handler a little to remove the tank level stuff and replace it with a threshold value to determine if the distance value means a garage is empty or full. I would implement this as a “Contact Sensor” device to SmartThings, as so much logic already assumes this type of device to perform decisions.

This would be very custom and not something I’d probably add to the overall project, unless others users feel that it would be useful as well.


Does anyone else have any suggestions on how to reliably know if a car is parked in the garage or not?

New member, can’t seem to find a solution and not sure where to post this:

I’m having trouble getting the PS_TemperatureHumidy function to compile in the sample ST_Anything_AlarmPanel_ESP8266_TEST.ino.
no matching function for call to 'st::PS_TemperatureHumidity::PS_TemperatureHumidity(const char [11], int, int, int, st::PS_TemperatureHumidity::DHT_SENSOR, const char [13], const char [10], bool)'

something about "candidate expects 1 argument, 8 provided"

Is this where I should supply my full code and errors?

Yes, this is as good a place as any… :slight_smile:

Did you modify the ST_Anything_AlarmPanel_ESP8266WiFi.ino sketch in any way, other than the WiFi/Network settings? If so, try going back to the original version and get it working before making any changes.

It looks like you did not install all of the libraries from my GitHub repository into your …Arduino\libraries\ folder based on the error message you posted above.

I tried the code you assisted me with, but I could not get it to work with these type of sensors. I would however not mind getting the same type of sensors as what we use for the water tank level measurement.
The issue (for me) however is that even if I use the same setup as that for the water lever, the DTH does not report any of the distance information to webCoRE. (It only reports the “last updated” time it seems. I did not forget what you explained the solution is. I looked at the DTH code but I could not figure out how to change it. When I came across @psun03’s thread, I thought I got lucky.)
As far as vehicle presence is concerned - As far as I could ascertain from this - and the webCoRE forum, there is no proper solution. Most people either use the presence sensors or a complicated system of setting variables to keep track of which doors opened/closed and which presence sensors had left and at what time, to determine which garage is empty. That is however not foolproof and could easily get out of sync if webCoRE misses one of the changes. If I’m not mistaken, one person set up an infrared beam.
If one could get the ultrasonic sensors to work and report their condition to webCoRE, it seems to be the perfect solution, because that would report the actual occupancy of a garage to webCoRE at any time. (The idea is obviously to install the sensors overhead, looking down towards the floor. If the distance between the sensor and the obstacle is less than the installation height of the sensor, it would mean the garage is occupied)
Maybe the solution is to ask the forum’s assistance to change the DTH so that the readings are exposed to webCoRE?

Getting the value to webCoRE is simply a change to the Device Handler code. I can help you with that later as I am away from my development system.

You need to learn about how SmartThings Device Handlers and SmartApps work, as it will become much clearer to you once you understand the architecture and work within the design. webCoRE is simply a very sophisticated SmartApp, but it still relies on the ST Architecture to accomplish everything it does with regards to devices.

A Device, in SmartThings, implements one of more standard device “Capabilities”. Each device capability must implement certain ATTRIBUTES (variables) and COMMANDS (functions). By doing so, SmartApps are able to interact with them. If you look at every one of my other Child Device Handlers, you will see where they declare what capabilities they expose. Intrinsic attributes are not explicitly declared. Custom attributes are explicitly declared. Same with commands, there are intrinsic commands and custom commands.

Read through the developer documents on Device Handlers and SmartApps and it will start to make sense.

If you look at the Child Device Handler that @saif76 developed for his custom application, he did NOT define any capabilities other than a very generic “Sensor” which has no intrinsic attributes or commands. This is why webCoRE cannot ‘see’ any values. Part of the problem that I am sure @saif76 faced is that SmartThings does NOT define a standard capability for LEVEL.

In your “Is Car in Garage?” project, you should make sure that a standard ST Capability is defined, like “Contact Sensor”, which will report a value of ‘open’ or ‘closed’ to any SmartApp that knows how to interact with a “Contact Sensor”. We’ll let the device handler use a user defined parameter to determine if the ultrasonic distance measurement is above or below the target. It will then report ‘open’ or ‘closed’ which you’ll use in any SmartApp you want to know if a car is present or not.

Starting to make more sense now??? We really probably don’t want the raw distance measurement exposed to outside of the device handler.

1 Like

thanks Dan,

everything uploades and connects to wifi. I copied all your library folders to Arduino>libraries.

The only change I made to AlarmPanel besides the wifi info was to add the following:


then I commented out:
//#define D2 4

this is the one that causes the error no matching function for call to st::PS_ ..........

st::PS_TemperatureHumidity sensor2("temphumid1", 120, 7, PIN_TEMPERATUREHUMIDITY, st::PS_TemperatureHumidity::DHT22, "temperature1", "humidity1", false);

Still looks like your libraries folder is not configured correctly. Can you show a screenshot of the contents of your libraries folder?

That looks pretty reasonable. Do you have another computer, that you could install a clean copy of the Arduino IDE and a clean copy of just the ST_Anything libraries & sketches?

Good idea I’ll see what I can do

Ok, wiped all libraries on my LINUX laptop. Added only your libraries and sketches.

same problem as before.

error also reads candidate expects 1 argument, 8 provided

Yes ST doesn’t have a sensor capability to use distance as an attribute. Here is the current updated list of capabilities https://smartthings.developer.samsung.com/develop/api-ref/capabilities.html

Your recommendation of mounting a distance sensor on the ceiling to check if there is a parked car can be achieved, either you can modify the device handler to be a contact sensor like @ogiewon mentioned or you can modify it to be a presence sensor.

To make it a presence sensor change the DH to take the distance reading from the sensor and then trigger presence active if the distance measured is around height from floor to ceiling minus car height. Remember that the presence sensor is not tied to a car but a immovable spot. So all your automations and smart home monitor configurations will have to account for that.

Thanks for the input @Saif76. It is much appreciated.
I will mess up the DTH without a doubt if I try to do this, but Dan has kindly offered to look into the possibility of changing the DTH.

Would it not be easier to give the DTH a “range trigger” (which should be less than the distance between the sensor and the floor) and if the distance reported by the sensor is less than the pre-set range trigger, the presence sensor should report a positive result? E.g., if the distance between the sensor and floor is 8ft, one would set the range trigger to 7ft e.g. That way, regardless of the height of the vehicle, it will trigger the sensor to “present” if any vehicle/object higher than 1ft is parked below the sensor.

Why is that Dan? The reason I’m asking is that if we could expose the distance measurement to webCoRE, it could be used to set off an alarm if (when used as a water level sensor) the water level drops below a certain level. If used as a “Car in Garage” sensor, webCore could be set up to regard the Car as being in the Garage if the distance reported by the sensor, is less than the distance between the sensor and the floor. I don’t know how the distance will be reported to webCoRE if this is possible, but if e.g. it is reported in millimetres (or inches), would it not be a simple "IF the distance reported by Garage Sensor 1 is less than 400mm, then regard the garage as occupied."
The same DTH and sketch could then be used for multiple applications without making any changes to it e.g. our existing application of a Water level sensor; Car-in-Garage Sensor (If object is closer than x distance); Check if a Door or gate is open; Report of a closet door/electrical distribution box is opened; check if drapes are open/closed; Report if someone walks past the sensor; etc. (all depending on the free space allowed between the sensor and the obstacle it senses, i.e. the closest distance an object may get to the sensor, or the reverse, if the distance increases beyond a pre-set distance reported by the sensor and as set up in webCore)
Am I making sense?

© 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.