[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

I just got mine set up last night and seems to work pretty well. Thanks, Dan!

A very simple question, it seems… Is there a way to change the way the child devices show up in the parent device? For example, my temp sensor shows up as “temperature 1”. How do I change that? Renaming the child device itself doesn’t do anything. And pressing the “Configure” button in the parent device doesn’t seem to do anything but update device network ID and number of buttons?

def configure() {
	log.debug "Executing 'configure()'"
    updateDeviceNetworkID()
	sendEvent(name: "numberOfButtons", value: numButtons)
}

Thanks!

1 Like

I have never found a way to edit the child device names shown within the Parent Device. Since each child device can be renamed independently, and they all show up as individual things, I don’t find it to be much of a problem.

If you really want to, you could modify your copy of the Parent Device Handler code to uniquely name the child devices automatically when they are initially created. You’d need to have a unique Parent DTH for each of your ST_Anything devices. It would have to include a lookup of generic names to your specific names, and use those names when creating the child devices. Just do NOT change how the Child Device Network ID’s are created, and that is what is used for the keep those devices up to date.

I have a few esp32 boards, Wemos and Adafruit variety’s. None of them can connect if using the Recommended Static IP method. They do connect if using the router DHCP assigned method. Any ideas why? My esp8266 and ATWINC1500 boards connect fine with the recommended static method, only an issue with esp32

//Create the SmartThings ESP32 Communications Object, STATIC IP Assignment - Recommended
//st::Everything::SmartThing = new st::SmartThingsESP32WiFi(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::SmartThingsESP32WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);

I have never seen that behavior, however I am not running any ESP32s currently. One problem with these devices is the rapid rate of change with supporting libraries. I do not test every device with every new release of supporting software. Sometimes incompatibilities do arise.

There are definitely some little issues with the ESP32 wifi. If you check the github for the software you’ll see a bunch. Even after adding in code to reboot the device after so many failed Wi-Fi reconnects I still have to manually reboot it every week or two because it loses its connection. Since for me it’s easy to do I haven’t gone through trying to troubleshoot it further. But I know that the code is constantly under development and last I heard they were talking about the revision to board to fix some of the issues with the current board such as analog inputs needing to be manually calibrated per input. Took me a lot of trial and error and testing to get my couple analog inputs working properly because of that issue (although they work great now).

I set a DHCP reservation on my router for its Mac address just to make sure it always pulled the same address and that seems to work fine. I did the same for my two Konnected panels also even though the smart app supports discovery. Just easier to have the reservations in DHCP and I know exactly what IP address they are at.

2 Likes

Doesn’t the ST_esp32wifi library have a “reset board” after a number of failed connection attempts, though I saw it in there. My WeMos Lolin32 board disconnects and goes dead everyday ~6:30am and reconnects sometime after 11am. It does a hard reset when comeing back up because it clears the variables stored. Its the weirdest thing, no idea why. I’ve cleared all the old IPs and settings in my router, router has no schedules set up, tried turning the board on late at night to see if it is a constant time thing… Always around 6:30am… My adafruit esp32 board does not do this but it does go dead at random times (2 to 5 days) and require a reset.

Yeah…it checks if its disconnected and tries to reconnect 10 times I believe and if it fails issues a reboot command.

1 Like

Static IP issue is noted on GitHub:
ESP32 does not accept Static IP #1262

1 Like

Sounds like the devs broke the Arduino ESP32 board support package. Hopefully a permanent fix is forthcoming soon.

You’re going to need to provide a few more details, please…

If you’re trying to send data from within a typical ST_Anything sketch, you can simply call the sendSmartString() function as shown below.

If you are just using the “SmartThings…” libraries from my GitHub project, you can choose to send whatever strings you desire. You’ll just need to process those messages in your own custom Device Handler’s parse() routine. I included Ethernet and ThingShield Device Handler examples within the SmartThings library’s ‘extras’ folder. These are basically the original SmartThings On/Off ThingShield example retooled slightly to work with my version of the SmartThings library. Ethernet support was added in early 2017.

1 Like

Dan, wondering if you have had any reports of the Child Dimmer Switch Device Handler for SmartThings and the callback(const String &msg) function for a dimmerSwitchX device type in an Arduino sketch not working completely correctly?

The callback function takes as a parameter const String &msg. I have few lines in the sketch to print out the value of msg. From the Smartthings app, if I turn ON or OFF the Dimmer device, the callback function successfully reports “dimmerSwitch1 on” or “dimmerSwitch1 off”. The problem presents when I change the level on the Dimmer device in SmartThings. The Smartthings Device Handler does appear to send the level message to the SmartThings hub:

debug Parse returned {{ linkText }} has arrived
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug F8F005E99821-dimmerSwitch1 - name: dimmerSwitch, value: on
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug parse() childDevices.size() = 1
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug Name = dimmerSwitch1, isChild = true, namebase = dimmerSwitch, namenum = 1
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug name is: dimmerSwitch1
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug Parsing bodystring: dimmerSwitch1 on
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug Parsing description ‘index:01, mac:F8F005E99821, headers:UE9TVCAvIEhUVFAvMS4xDQpIT1NUOiAxOTIuMTY4LjI1NC4xMDI6Mzk1MDANCkNPTlRFTlQtVFlQRTogdGV4dA0KQ09OVEVOVC1MRU5HVEg6IDE2, body:ZGltbWVyU3dpdGNoMSBvbg==’
95b887a7-f047-4ed4-bc47-a517cb00bc2f 1debug Parsing description ‘index:00, mac:F8F005E99821, ip:C0A8FEE8, port:1F9A, requestId:ce3a8bb9-a79e-4f98-8a98-725ca998c1e6, headers:SFRUUC8xLjEgMjAwIE9L, body:’
10:02:56 PM: debug Parsing description ‘index:00, mac:F8F005E99821, ip:C0A8FEE8, port:1F9A, requestId:ce3a8bb9-a79e-4f98-8a98-725ca998c1e6, headers:SFRUUC8xLjEgMjAwIE9L, body:’
9102225c-e4ab-4051-b9cb-1a160df54aa8 1info postEventToEndpoint: event successfully posted.
9102225c-e4ab-4051-b9cb-1a160df54aa8 1debug Property Change Event level: 43 (source: DEVICE)

However, the callback function in the Arduino sketch reports that msg is “dimmerSwitch1 on”. I was completely anticipating msg to be something in for format of “dimmerSwitch1 72”, where 72 is the level of the dimmer sent to the setLevel function in the Device Handler.

Am I missing something here? Or is there an unreported bug in the code between the setLevel function in the Device Handler and the callback function in the Arduino sketch?

It’s an Arduino side bug. I’ll get it fixed in the next day or so. Thanks for pointing it out.

@smarthusker - My Github repo has been updated to support the dimmerSwitch level being reported back to ST. This required two changes:

EX_Switch_Dim.cpp (on the Arduino side)
child-dimmer-switch.groovy (on the ST IDE side - remember to publish the update)

While I am not a huge fan of this solution, for now, every time the dimmerSwitch device reports its data to ST, you will see two events transferred. (In the future, I’d like to change all of the data transfers to use JSON as it is much more flexible.)

Example events
“dimmerSwitch1 on” (on or off)
“dimmerSwitch1 33” (the value of the dim level)

You can also ‘catch these’ in the callback() function within the sketch.

I would like to make 7 of them.
how do I install https://github.com/DanielOgorchock/ST_Anything/blob/master/README.md
WeMos D1 CH340 WiFi Arduino UNO R3 Development Board.
But i do not know the port number for the WeMos D1 Arduino and servos for Vent.
No way to get to the ductwork.
How I get the port number.

The port numbers used by ST_Anything are defined in the sketch. There is no reason or need to change any of the port numbers.

To initially install ST_Anything, you will need to connect it to the Wemos via USB. ESP8266 based boards can then be updated via Arduino Over The Air (OTA) for later changes.

Also, there is no support for direct servo motor control in ST_Anything (yet).

Can I get the code to make the servo go 180 win open then win closed go back to 0

All of the source code is in the GitHub repository. You can do anything you want with it. It is all open source. Have fun!

I’m not good with source code.

It’s been a while since I’ve been here, my 2 ESP8266 are working great doing garage door duty and temperature monitoring showing perfectly in Smartthings.

My question is about linking my temperature sensing one with a 2 x 16 display so that it will show the temps.

I have 5 1wire sensors connected to the pin D7. They have names in Smartthings but nothing in the Arduino sketch as they auto populated. ideally i’d like to have them shown all at once with a small title on the top row and the readout in xx.x format in degrees c. If they wont all fit perhaps they could scroll or maybe display 2 at a time or something but I’m struggling to add this to my sketch.

Can anyone give me pointers that wont break horribly as I’ve managed so far.

This is my display: https://www.amazon.co.uk/dp/B019SXNKGU/ref=pe_3187911_189395841_TE_dp_1

A separate query, I have acquired some RGBW rolls of LEDs but they’re the 12V ones, being an electronics thicko what would I need to do (other than bin them and buy 5V ones) to make them work with an ESP8266 and the RGBW thing sketch? I got the sketch working fine with a 1ft strip of 5V lights but obviously need to juice up the output somehow to work with the 12V LEDs.

All the best,

Dan.

Dan,

The simplest place to update a locally attached LCD display would be inside the sketch’s ‘callback()’ function. Simply uncomment the first two print statements and monitor the output within the Arduino IDE’s Serial Monitor Window. You should see your temperatures show up every time they send data to ST.

The string that is sent to ST is what is passed into the callback(string) function. Your updates should appear as “temperature1 76.8”, “temperature2 83.5”, etc…
You can then easily parse these strings into the name and value portions. Then, simply update your LCD screen with the data. Something like:

pseudo code
If (name == “temperature1”) {
updateLCD("Garage Temp = " + value)
}
If (name == “temperature2”) {
updateLCD("Attic Temp = " + value)
}

You get the idea… Hope this helps!