[DEPRECATED] ST_Anything - Arduino/ESP8266/ESP32

Got it all set up thanks!

I have a question, can you group/hide child things, like multi sensor do. (ie lux,temp,humidity only show when opening parent sensor?, not crowing up things list )

FYI I’m very novice at this stuff, but with your great instructions i was able to get this far.

Thanks again,
Nathan

@Nathan909 - Nathan,

Glad to see you got it up and running! In answer to your question, YES, you can very easily hide the child devices, however you will not be able to rename them, move them to separate ‘rooms’, or delete them individually.

In order to change the behavior, simply edit the following line of code in the Parent_ST_Anything_Ethernet device handler. Modify the “isComponent: false” to be “isComponent: true” instead. Save and Publish-For Self again.

 				addChildDevice(deviceHandlerName, "${device.deviceNetworkId}-${deviceName}${deviceNumber}", null,
                	[completedSetup: true, label: "${device.displayName} ${deviceName}${deviceNumber}", 
                	isComponent: false, componentName: "${deviceName}${deviceNumber}", componentLabel: "${deviceName}${deviceNumber}"])

You will need to delete the current parent device (which will delete all of the children as well) and then manually recreate it again. Afterwards, you will only have a single device in the Things view.

1 Like

Nathan,

I have not looked into adding the MQ2 Smoke, Gas, & CO2 sensor. I will happily add support for it if you send me one for testing. Please private message me so we can work out the details.

Dan

@ogiewon - Hey Dan,

I am beyond thankful for all the work you have done with ST Anything! I’m just now getting the time to implement everything around the house and it has been amazing and so much easier to do everything that I’ve wanted to do now that you have written all this code!

I do have a question that is related to the Alarm Panel, but it’s not specific to just the Alarm Panel.
I’m using NodeMCU and running the contact sensors through the digital pins and its working perfectly, but I have roughly 24 sensors to attach. The previous home owners when they built the house had all windows and doors wired, but only the main doors actually hooked up to the original Alarm Panel. So lucky for me I will have every conceivable entry into my home armed and monitored!

The question is, can I use a Shift Register with my set up and get all 24 sensors running on the NodeMCU or is there going to be a limitation with the RAM on the device?

Example of a Shift Register: https://www.arduino.cc/en/Tutorial/ShiftOut

I know I can just add more arduino’s, but if possible I always try to trim down my projects to the absolute minimum needed for it to function, but for aesthetics and practical purposes…I try to keep it as clean as possible.

I will be running some tests here shortly, but just thought I’d ask for some feedback that could possibly prevent some headache in the future.

Thank you again for developing all this!
-Hank

P.S. - Alot of this is over my head, but I’m learning!

I haven’t tried this my self but you may be able to use this.

If you need more analog inputs.

What am I doing wrong?

I have had 2 thingshields for almost a year and not really done anything with them. Every project I came up with other than full window open/close monitor I found hardware for sale already.

Now I am working on triggering switches in my bathroom for vent fans based on humidity (showers) and have returned to my thingshield and arduino + DHT22 sensor collection.

I have followed the directions and added the GitHub repo in to the arduino IDE I opened the sample project for ST_Anything_Temperatures.ino as that is closest to what I want to replicate.

I compiled and uploaded the project to the UNO. I seem to have forgotten something like I can’t flash with the thingshield attached or I have to move the hard switch on the shield and reset to flash? Anyway I have gotten the project loaded on to the UNO and paired the thingshield up with smartthings. I changed its device handler to the parent ST_Anything type. I have let it go for a while and I see nothing when I open the item in my smartthings “Thing” collection other than Refresh and Configure. Neither of which seem to do anyting save one of the serial comms LED’s flashed on the arduino. Their are no sensors connected to the arduino as I only have the 3 DHT 22’s and not the thermocouples anyway.

As I understand it child objects should automatically be added by what is defined in the arduino project but I don’t see that happening. No tiles, I added buttons, nothing happens. I am wondering what i am missing?

The ST_Anything_Temperatures.ino sketch is located in the deprecated folder for a reason… :slight_smile: Those sketches are old examples that pre-date the new Parent/Child Device handlers.

Please start with the new ST_Anything_Multiples_Thingshield.ino sketch. Just comment out all of the extra sensors/devices in the setup() routine other than the DHT22 sensor.

This sketch will then work as expected and auto create the child Temperature and Humidity devices.

I understand the request, however I do not have any plans currently to extend the I/O capabilities of the NodeMCU ESP8266 boards beyond what they have onboard. Adding in an I/O expander might be a good future enhancement. Or perhaps, the newer ESP32 will provide a higher GPIO count?

For now, I’d recommend you wire the various window sensors in series to create a traditional alarm zone. If any of the sensors wired together in series are “opened” then that zone will report as such. This allows you to dramatically reduce your I/O pin requirements.

Another option would be to add multiple ESP8266’s to handle everything. They are inexpensive, but they could get a little crowded.

Or, if you could hard wire some Cat5 Ethernet to your panel, an Arduino MEGA + W5100 or W5500 shield would provide you with 54 Digital and 16 Analog IO pins to choose from.

Lol and there you go… Im doing it wrong :smiley: Will test out in a bit

1 Like

Dan,

I fell victim to manually deleting child devices and having errors, basically breaking the entire parent/children devices. Google then led me back to this post warning us about this issue.

There may be a work around to this issue. I was able to avoid deleting the parent device by going to the “set-up” (gear in the upper right of ST app), then (without having to make any chances) just clicking “Done”. This ran an update and I was again seeing data flowing. In order to add the children devices back I hit “configure” and all was well.

Perhaps someone else can confirm this work. Not sure if its relevant, but before I did this I had already deleted all the children devices manually…

2 Likes

Update: I moved the slider on the thingshield to D2/D3 and I have data now? The really wierd part is I have tried this for over 2 hours and slid that switch a few times already so why it works now I don’t know.

ogiewon, Thanks for posting above. However, I’m still not having any luck.

Again, I have imported the github repository in to my arduino IDE (1.8.3)

I am now using the Multiples_Thingshield project. I commecnted ALL sensors save the first temp/humidity one. I commented all executors and sensor pins (except TEMP1).

I set TX and RX pins to 2 and 3 and the DHT22 at pin 7 for my Arduino UNO R3

This is the output in the serial monitor:
Everything: init started
Everything: Free RAM = 735
Everything: init ended
Everything: Free RAM = 735
Everything: adding sensor named temphumid1
Everything: Free RAM = 735
Everything: initDevices started
Everything: Free RAM = 735
Everything: Sending: temperature1 74
Everything: Sending: humidity1 47
Everything: initDevices ended
Everything: Free RAM = 735

So the code is running and pulling data from the sensor just fine. I paired it with smartthings and it shows up in the Thing list. I went to the Smartthings IDE website and changed the device handler for the new “Thing” to the Parent_ST_Anything_Thingshield.

When I l enter the “Thing” on the phone GUI I only see the refresh and configure buttons, nothing else. If there is a better doc to follow instructions on let me know. I read the repo instructions and followed them.

Thanks!

You’re very close! Did you press the gear icon on the parent device in your phone’s application? This brings up some settings that need to be filled in (very few for the ThingShield.) Then click done. This sends a command to your Arduino which causes it to send data to your hub.

Afterwards, the child devices will be created.

Can you post your ST IDE’s Live Logging data from your Parent Device? That is where you should see the child devices being created, updated, etc…

Thanks Dan, I think I actually just wasnt waiting long enough for info to be reported? I had performed the Add Buttons adjustment assuming 2, 1 for temp and 1 for humidity.

While I was writing my message I saw the serial monitor show several updates to smartthings and when I went to the phone I saw child objects and temp/humidity info being reported.

Thanks for talking with someone who was just too impatient it seems and bugged you about something that was really working.

You deserve an enormous amount of credit for taking something like this and making it TRULY valuable. Smartthings intended these to be one off devices and you figured out how to get so many hooked in to one shield I appreciate it!

Glad to hear it is working for you. The “Buttons” are actually not related in anyway to the Temperature and Humidity measurements. Within SmartThings, there is a capability called “Button” which can used to trigger actions. This is the same functionality that an Aeon Minimote 4 “Button” remote control device uses. ST_Anything supports the use of digital inputs as “Buttons” which can be “pushed” or “held”, thereby giving each button two discrete functions which you can use for whatever you’d like. If you have commented out everything aside from the one DHT22 Temperature/Humidity sensor, you can safely set the “Number of Buttons” to Zero in the Parent’s Configuration Menu.

Hi Dan, It great to see how much help you offer here.
I have successfully modified the multiples sketch with my own arduino system to integrate the two However I’m looking to push it a little further and work around some of the compromises I’ve had to make.
The main action my arduino takes is to IR control my TV. Right now I’m using the timed relay class to trigger a function, each function then shows as a child device and switch.
Ideally, it would be nice to combine these switches to a single device in smartthings. Like if it showed as the arduino and then a series of buttons when you tap on the item in the phone app since each switch does something like source left/right, standby etc it’s a bit untidy to spread them out as separate switches.

Secondly I have put together a mp3 sound module to add to my arduino, what I want to do is have messages and sounds played in relation to house events. An example would be if someone arrives home their presence sensor becomes true. This could then trigger a boolean state in the arduino, it could wait until a person is spotted through PIR then play a relevant welcome home message. This could be done by passing events/state changes like lights on/off, who is home etc to the arduino but I dont know how to do this or if it is possible or will crash the arduino as I have already had to move as much as possible out of loop() to keep the whole thing working.

I also wondered if the static declarations in the setup could be written to just point to a void function() rather than a pin as changing a pin state just isn’t useful to the way my system works and takes up valuable pins.

I welcome your ideas :slight_smile:

Alex,

Glad you’re able to use ST_Anything successfully. It definitely appears that your use case is somewhat unique and not exactly aligned with ST_Anything’s current capabilities.

ST_Anything is designed to be expanded by adding additional device classes. In the IR transmitter use case you’ve outlined, I would think you might want to consider creating an EX_IRTransmitter class. This class could then receive “messages” from SmartThings that cause it to transmit the correct IR codes. For example, if you could send the entire IR code from SmartThings to the Arduino, then you would only need one EX_IRTransmitter device defined in setup(), using one set of pin(s) to communicate with the IR LED. The specific IR functions (On, Off, Vol Up, Vol Down, etc…) would be defined somehow within your SmartThings Groovy Code, and sent to the EX_IRTransmitter device in the Arduino. This way you could create a custom Child Device with as many “Tiles” as necessary for each IR function you want.

Similarly, you could create some sort of EX_Audio class for the other functionality, but the phrases might need to be stored within the Arduino (maybe an SD memory card) due to their size.

You should avoid putting anything within the loop() routine as that will cause issues with ST_Anything hitting its deadlines for all of the timing routines and being able to listen to the network for incoming traffic.

Ok so from what you are saying I need to research and get more into groovy code to streamline this.
I will search for other things people have made as I already have some ideas of how to accomplish what I want I just need something that passes all smartthings activity to st_anything even when st_anything wasn’t involved. For example the arduino receiving a smart string even if I for example tell Alexa to switch a light on.

Well, I think you’re probably going to need to get deeper into both the Groovy side of things, as well as the Arduino code side of things. If you can tell me what library you’re using for the Infrared LED on the Arduino, I may try to take a look at adding a new class for it to ST_Anything. The Groovy side will be a little more complicated, I believe… One step at a time… :slight_smile:

1 Like

Its this IR library. I’ve used it for years at this point its really good.

Alex,

What hardware platform are you running ST_Anything on? I am curious if you’re using an Arduino or ESP8266? If an Arduino, which board and what type of connection to ST are you using? ThingShield? W5100 Shield? …

It looks like that library is pretty much geared toward Arduino. The ESP8266’s are only somewhat supported on a fork of the repository.

Dan