ESP8266 Smart Sprinkler System

Ok here is a update, I wrote reset bin file that resets the settings then after deleting the device from st I then restored the stock code, was able to re-add the device waited a few minutes for the firmware and ip to show up on the device and in the st ide. Then it changes the device id to the MAC address and also adds a Mac field. Then bingo its working again.

But I’m a person likes to figure out a issue. So I deleted tried to re add and now no luck. So it seems to mess up when it doesn’t populate the Mac and ip info it just sits there. :frowning:

I would like to help out with this as much as I can also if I can add some features to it.

Such as a password protected mode, uptime reporting. Password to the web access or at least the reboot and ota.

Again thank you for this project! Sorry my battery is about to die on my phone.

Thanks!

Ok, I feel like I’m the only one who is watching this forum I don’t know how to message the author on here?

But I guess someone will read this eventually.

I fixed up the code a bit.

Here is everything I have figured out so far.

1.) The discovery mode seems broken? --errors on the ide when requesting the esp3xxx.xml I suppose I can fix this haven’t really looked into it.

2.) The initial code would add the device manually I would know it’s working when the firmware and ip were populated. But when trying to send a on command to any of the zones it would lock on the “pushing updates to hub”. I modified the code to fix this.

3.) It wasn’t updating the status back to st for the correct on/off for each zone. I fixed this also. I am not sure if I am having these issues why anyone else isn’t? Maybe since I’m running v1 hub I wouldn’t think that would be the issue ? I did fix this also. It reports back 95% of the time.

4.) So the issues I have still is the weather does not seem to work in the scheduler *the rain or the above degrees setting.

5.) Another issue I am still having is if I remove any of the devices then try to re add them they do not work unless the device id in the st ide matches the MAC of the device? Initially the discovery groovy seems to after a minute or two change the device to the MAC but upon deletion of the device and re adding it does not. Not sure what is causing this right now. I don’t know is smart things does this for security reasons but if the MAC is not set to the device id it will not allow status updates.

I would like to have some help with any this? Does anyone want to snag up a $10-15 board and play with this stuff. We can use this for so much more than just sprinklers! Thanks to the op!

I will keep posting updates, would be nice to get some people involved testing out current code I’m working on. Thanks!

Btw I’m using a linknode r4 and r8 :slight_smile:

I’ve been traveling a lot for work lately so I haven’t had time to work on this much. My sprinkler controllers have been working pretty well all summer so I haven’t really thought about making changes. I don’t have time to review the code in detail this morning, so I’m going from memory for now. Below are a few thoughts…

I’m a little surprised to hear about some of the issues you’ve been having because I haven’t seen them and they haven’t been reported by others. I’m wondering if they may have to do with either your version of the hub or possibly your internal network. The discovery mode uses SSDP and may require UPNP to be enabled on your router.

There may very well be issues when setting the device manually. Most of that code was borrowed from others and since the discovery mode seemed to work reliably that was what I tested most. The issue of not reporting status back to ST correctly may have to do with how picky ST is about the deviceNetworkID begin set properly. ST requires the deviceNetworkID to either be the MAC of the device or a combination of IPAddress and port number all in hex. MAC address seems to work reliably but I’m not sure if the IP:port combination ever did. Setting the device manually sets the deviceNetworkID using the IPaddress:port all in hex, and if I remember correctly, the device handler tries to change the deviceNetworkID to the MAC as soon as it can. Definitely would love to see your changes and improvements to make this work reliably

Regarding the scheduler with the weather features… This seems to be an issue with the ST getWeatherFeature API call. getWeatherFeature looks up weather information from Weather Underground. Apparently Weather Underground limits the number of calls that can be made for free. It appears that too many ST handlers are calling the getWeatherFeature an overrunning the ST allotment of free ST calls. Sometimes it works and sometimes it doesn’t - but I’ve had it be fairly reliable if I set my schedule to kickoff at odd times like 10:07 rather than 10:00. I haven’t had time to really dig in and look for alternatives.

Thanks for your interest and work on these devices and integration. I agree, there are a lot of different things these can be used for besides just sprinklers!

1 Like

Great, thank you again for the start on this and the information provided in your reply!

Ok I understand the weather call now, wonder if there is another free api we can use ? Yeah it makes sense why it wasn’t communicating with the device due to do the MAC address not being in the device id.

I am wondering if the v1 hub has anything to do with this. I wouldn’t think so. Did you not have any issues with your latest code freezing on the pushing updates to hub. :slight_smile:

I was wondering that on the upnp option, I don’t have it enabled on the router. So maybe I will go ahead and enable the upnp then see if I can get the device to discover. I figured that was the case. Other than I did see the request to the espxxx.xml and then the error in the ide. So I will mess with that. :slight_smile:

Again thank you for this I’m not sure why people aren’t jumping up and down considering all the uses for this. I would like to improve on the code & design of the main dth.

I haven’t looked into the static ip option for the code yet, but for a response to the person above I would say the easiest way for that would be to assign a reservation in your router under your dhcp settings.

I think it would be great to set varriables to the device and have it stored. Like for example if you enable the pump but then the device reboots it forgets the pump was enabled then defaults back. I know most people won’t be losing power, or I guess you can hard code the pump always on but for the people who don’t know how to do that it would be nice to store these varriables on the device.

Btw do you have any issue with reporting back to the hub status of the zones? I’m getting about %95 of the responses back for each zone. Every now and again it misses zone x turned on in the history of the device. But since the timers are scheduled on the device its not a big deal. Just informational.

One last question, seems to be random delays between each zone sometimes the next zone turns right on other times it takes a minute or so? Do you know why this is? Also on the r8 the 8 relay seems to turn on for a second on reboot not sure if that’s code or the esp its self doing that?

Thank you!

@bickyb the easiest way is to set a dhcp reservation in your router to keep the ip static. I will look into the code and see if it’s possible to set a static ip. I know on the Ethernet devices you can. :slight_smile:

One reason could be because there are already other well-established solutions for integrating microcontrollers into SmartThings. Have you checked out my ST_Anything solution? You can implement basically any ST Capability (or multiples of each) with just a single simple Arduino sketch. Contact sensors, temperature sensors, humidity sensors, relays, momentary relays, water sensors, light level sensors, voltage sensors, smoke detectors, co detectors, etc… I’ve created an entire package to allow you to build your own “Anything” to meet whatever needs your project has.

@ogiewon I did not know about this? I can basically do the same thing timers and everything ? Are the timers built in to the device or do they require the cloud? It says edit one line of sketch code?

Does that mean tell it which board your using esp8266 for example ? Also it says in your drawing v2 hub is that required? Other than local processing and battery backup what is the big difference vs v1?

Have you already implemented the ability to password protect your esp uptime reports etc ? Any other cool features I would be excited about.

By the way I love the st community do you know if there is any other cloud home automation system out there that allows you to create custom device handlers and custom device types? I know about home automation assistant which is all non cloud. Openhabb, don’t get me wrong I have been using st ever since its kickstarter.

I would love to have it local and not depend on the cloud. But I don’t want to give up all the community and custom apps everyone has made.

Thank you!

Both hubs seem to work equally well for ST_Anything. I recently pulled out my old v1 hub and ran some tests successfully.

I have example sketches for each type of micro controller. You just need to start with the one matches your board. Inside the sketch, you will see lines of code in the setup() routine where devices are defined and associated with specific pins. This is the file you edit to define your specific configuration. Want 2 switches, 3 timed relays, temperature and humidity, just define them in setup(). Child devices are automatically created in ST based on what you define in the sketch.

ST_Anything does not support configuring the ESP8266 over WiFi. The configuration is in the sketch for networking. There is no automatic device discovery. I chose to keep things simple. Also, all of the features are supported on all of the various board configurations. Pros and cons to both approaches. Always room for improvements.

As for the timers, they are defined in the sketch and handled locally. This is not to say that you couldn’t set the timers for a relay from the cloud if desired and still have the micro controller perform the timing. Currently, the timing is predefined in the sketch and though.

Probably best to continue this discussion in the ST_Anything discussion thread…

1 Like

Will do thank you.

I will look more into this st anything. My thoughts are these are two different projects there are some similarities. But for people who just want a easy to setup sprinkler timer system, timers set via the app.

Stanything sounds like it would need to be coded into the sketch. Which is fine for the tinker guy who wants to do that, but for the guy who just wants to modify his times on the fly then this seems more towards them. On these devices the arduino etc. I would like to see all of the configuration done via the cloud timers being set varriables etc then stored on the device.

Thanks for your input. Do you know of any other platform where we have this much control ? Without a cloud requirement ? I’m not against smart things. :slight_smile:

I totally agree with your assessment. I think implementations like this Sprinkler project are ideal for people looking for more of a turn-key solution.

I do not know of many other systems with local processing that are as open as SmartThings. Vera Plus may be one option though, but I do not know if one is able to develop custom integrations to the level of what is possible in SmartThings.

Update here, I have been working on optimizing and fixing up the code to my liking.

I have fixed a few issues and added features.

There is a error in the dth that turns off the status for zone 3, just a mistypo called o3 vs on.

Fixed the ssdp upnp discovery I still can’t get it to show up automatically. But I’m not sure why it’s having issue with that.

Also I have added a password to the firmware update and reboot via the webpage.

I have cleaned up the device to match the 2x st layout.

Also it’s working great now.

3 Likes

This is great. I just got my R8 in the mail. I am having the box printed and hope to get this setup this week.
I will be back

Keep up the good work. In stead of using the built in schedule can I use webcore? The reason i ask is that i need to make a special schedule when blowing out my system for winter storage.

Do you need to schedule your sprinkler controller while blowing out the system or do you just need to be able to manually turn on each valve for a period of time? You can manually set a time for each valve and turn them on and off without creating an automation schedule via the SmartApp. I guess I need a little more information on what you’re trying to accomplish. I’m not familiar enough with webcore to know whether it could be used.

Can someone post the complete command line for esptool to upload the r8 binary to esp8266? I looked around and played quite a bit but esp8266 wouldnt create any access point.

Check attached picture for details and command line used… thanks in advance!

Rickybobby, any chance at trying your new updated code? Been having the same issues you described.

@AlumaFX Sure I haven’t had a chance to update the code for the 8 Channel version which issues are you having ? Thanks!

Exactly the same ones you were having above. I think I could update it to 8 channel. Still learning this language. Mind sharing? Winter is here so i have until spring before it needs to control my sprinklers again.

Hi, not sure why but I can’t get this working. Any help is greatly appreciated.

I have the linknode r4, everything compiled properly and the SmartApp discovered and added the device. However, the device is not responding to any commands. When I click on start or any of the relay switches it says “sending” or “starting…” but nothing happens.

Am I missing something?

Thanks

@bdonchen I would have issues like that, after adding you need to wait about 5 min or so for st to auto change the device id to the MAC address of the linknode esp, one issue I noticed is if you try to re add the device to soon it will not change the MAC address I had to remove and wait about 24 hrs for st to do it automatically again.

The work around I found is just change the device id to the Mac manually in the IDE. It’s also a security built into st wifi devices can’t communicate with the hub unless that Mac is set. :slight_smile: also force closing the app after you enter the Mac is also a good idea.

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