www.homeseer.com    
 

Go Back   HomeSeer Message Board > Irrigation Plug-ins > Irrigation Discussion

Irrigation Discussion Discussion of irrigation integration with HomeSeer systems.

Reply
 
Thread Tools Display Modes
  #1  
Old March 10th, 2018, 03:00 AM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
$25 Sonoff 4CH for irrigation control

Itead makes a family of WiFi IOT products including the Sonoff 4C (4 channel relay). I have a couple on order for evaluation with intent of customizing the firmware for irrigation. My basic thoughts is that they would be used like a Rain8, Ezflora, etc, but would like to go a step further where they could run a dynamic schedule if something would happen with HS or other automation controller that normally initiates irrigation cycles.

I had a similar discussion with Legotek several years ago with integration of mcsSprinklers with intelligent controller, but we never reached agreement on commercial terms so the engineering never materialized. Now with $25 price points for the valve controllers and success with modification of the single channel Sonoff I am looking at this again.

I would like the master HA controller such as mcsSprinklers to continue to compute optimal schedules and provide the primary UI. The Sonoff is able to assess calendar time so can be programmed to run in a backup mode if connection with the master HA is lost. A concept similar to what I did with the F16 digital flight control back in the 1980’s.

What I would like to open up for discussion is the nature of the backup “program”. I want more intelligence than just interval time scheduling, but I do not want the full inhibit/scheduling engine that is in mcsSprinklers. I would imagine something closer to the recent wave of Kickstarter-like irrigation smart controllers such as Rachio, Rainmachine, Blossom etc.
Reply With Quote
  #2  
Old May 11th, 2018, 02:07 PM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
My input would be for a simple relay, with some sort of timer to open the relays after x amount of time, if HomeSeer lost communication.

This would be a great replacement for my existing (and non-functional) setup.

Hope you pursue it.
__________________
Don
Reply With Quote
  #3  
Old May 11th, 2018, 05:58 PM
Steve Q's Avatar
Steve Q Steve Q is offline
OverSeer
 
Join Date: Jun 2005
Location: Michigan
Posts: 3,656
I think the Sonoff 4 Channel Pro could work nicely as an irrigation controller. I think it could control 4 zones without any problem. I don’t know much about the voltage and current required for the valves but the pro version should be capable.

I am considering using the 4Channel Pro as a zone controller for my whole house audio system.

What is interesting to me is how easy it is to add a second controller to an MQTT network. HS3 could provide primary control. A secondary device such as an Arduino could be added to act as a backup.

I am currently running McsMQTT on my test computer, but I am triggering some of my Sonoff switches via JSON commands from my production HS3 computer. Lots of possibilities with MQTT.

Steve Q
__________________
HomeSeer Version: HS3 Pro Edition 3.0.0.368, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins
2.0.83.0: BLRF, 2.0.10.0: BLUSBUIRT, 3.0.0.75: HSTouch Server, 3.0.0.58: mcsXap, 3.0.0.11: NetCAM, 3.0.0.36: X10, 3.0.1.25: Z-Wave,Alexa,HomeKit
Reply With Quote
  #4  
Old May 11th, 2018, 06:29 PM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
Can you talk me through this process? I don't have a Sonoff yet, but I'm assuming that somehow you connect it to your local LAN and shoot JSON commands to it. Is that correct?

Quote:
Originally Posted by Steve Q View Post
I am currently running McsMQTT on my test computer, but I am triggering some of my Sonoff switches via JSON commands from my production HS3 computer. Lots of possibilities with MQTT.

Steve Q
Reply With Quote
  #5  
Old May 11th, 2018, 06:32 PM
Steve Q's Avatar
Steve Q Steve Q is offline
OverSeer
 
Join Date: Jun 2005
Location: Michigan
Posts: 3,656
I found an iPad app (iTouchHome) that allows triggering Sonoff devices via MQTT. I briefly tried it and it works fairly well. This looks like an easy way to control Sonoff devices from an iPhone or IPad. I don’t think it is cloud based. Everything happens locally. Possibly a good approach for remote control. It has scheduling capabilities, but I could not get them working.

Another idea I had is to use a SonoffTH as a dummy switch to trigger an HS3 scene or event. My main use for the SonoffTH is for temperature and humidity monitoring. I don’t really need the switch at this location. But I can use it’s on/off button to trigger an HS3 event to turn other HS3 devices.

Steve Q
Reply With Quote
  #6  
Old May 11th, 2018, 08:44 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
Quote:
Can you talk me through this process? I don't have a Sonoff yet, but I'm assuming that somehow you connect it to your local LAN and shoot JSON commands to it. Is that correct?
The Sonoff units are WiFi-connected IO devices. Over WiFi they support HTTP and MQTT protocols using the Tasmota firmware that is user-installed. Tasmota is basically a layer of firmware that gives one abilty to control the IO. It has a very limited application layer beyond that which is used for configuration.

It will model a light switch as being a toggle or pushbutton and will initialize at power-on to last state or a defined state.

I augmented it to model a garage door control where the door has an open sensor, closed sensor and a motor that moves the door.

What we are discussing here is to further augment it to model an irrigation system that has a schedule of some type that controls each relay. Also being considered are sensors for monitoring and for sensors (may be cloud-based) that can affect the schedule.

In its normal mode it will get commands to control a valve from an intelligent controller. If communication with the controller is lost then it will revert to its internal more-basic control schedule. The intelligent controller in our content will be HS that could be something as simple as a set of events that control based upon time or mcsSprinklers that schedules based upon criteria setup by user.

I suspect that MQTT will be the protocol of choice which implies mcsMQTT would be used to transmit the Event actions or Device changes. It could also be done with HTTP.

For a simple example, assume you have a drip system that is to run 30 minutes every other day. You would setup an Event in HS that controls Device 251 to be ON and then 30 minutes later to be OFF and this event triggers at 6 AM every other day.

mcsMQTT would recognize that Device 251 turned ON and it would send ON command to Sonoff which would close the relay and provide power to the irrigation valve. Thirty minutes later the OFF communications would occur.

If HTTP rather than MQTT is the protocol then HS event action would execute a one-line script that would made the HTTP request.

In the background HS and Sonoff would be handshaking to assure HS is still connected to Sonoff. When the communication has lapsed beyond the normal scheduling time for the drip system then the Sonoff would control the relay in a fallback scenario for 30 minutes.

The fallback criteria, the fallback schedule and the UI with Sonoff to affect its operation while in fallback mode need to be determined.

Since new firmware is being developed to model irrigation control the user would need to install this firmware on the Sonoff. This is one with a well-documented procedure, but is does require that the unit be opened to gain access to the programming pins.
Reply With Quote
  #7  
Old May 11th, 2018, 09:15 PM
logbuilder logbuilder is offline
Seer Master
 
Join Date: Nov 2016
Location: Pacific North West
Posts: 666
I've worked with the single relay Sonoff. My existing custom app ported from an nodeMCU 8266 without problems. However, I wasn't able to implement OTA because it had less memory than the nodeMCUs. I've also been doing some work with the ESP32. It is a nice chip. Lots of memory. I'd probably go with the ESP32 and add the relays. Since you've already worked with MQTT, that would be the way to go.
Reply With Quote
  #8  
Old May 11th, 2018, 09:36 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
Agree that the 4CH is a bummer about OTA. Problem with the ESP32 is that it has not yet matured to product level but only exists in chip and development board levels. Physical packaging is a significant consideration for me and the 4 CH suits that need very well with internal power supply, good mounting and easy wire connection to relays.

I have worked with the ESP32 for LoRa and have got some LoRa functionality with a derivative of Tasmota, but is a hill to climb when being an early adopter.
Reply With Quote
  #9  
Old May 12th, 2018, 03:52 AM
BlairG's Avatar
BlairG BlairG is offline
Seer Deluxe
 
Join Date: Mar 2015
Location: Phx.Arizona
Posts: 375
Here we use the 4 ch. Pro, and have the 4 dry contacts wired to the 4 alarm inputs on our DVR camera system.

It works perfect if motion is sensed on the front porch, HS fires the #1 relay, which triggers features of the DVR

Last edited by BlairG; May 12th, 2018 at 05:15 PM.
Reply With Quote
  #10  
Old May 12th, 2018, 03:45 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
I have implemented a simple irrigation control for Sonoff in Tasmota. I still need to test. It goes like this:

1. Flash the modified Tasmota firmware into a Sonoff 4CH Pro (or 4CH or Basic with hardware hacking to isolate relay from mains voltage)
2. Use mcsMQTT to create devices for the Sonoff relays
3. Via MQTT publish Max On Time, Max Off Time for each relay. Also publish an irrigation enable. I am going to update mcsMQTT to make this easier.
4. Setup your irrigation schedule as desired with devices that are associated with the Sonoff relays. This can be events or any irrigation plugin that can control HS devices.

If HS controls the relay then the Sonoff will act as a dumb slave and set the relay to the commanded position. If HS fails to turn it off or fails to start a new cycle then the Sonoff will go into failback mode and control per the Max On and Max Off times that it has been provided. If the Enable is not provided then no failback is executed.

The updated Tasmota firmware monitors every minute the relay state and looks for exceedance of maximum on or off times. It controls the relay when the times are exceeded. This is in essence an interval timed irrigation controller.

The Sonoff has discrete inputs that can be used for other purposes related to irrigation such as a water use counter.

I had considered making it smarter with download of weather data and computing ET. I also considered doing HTTP setup of the configuration rather than MQTT, but at this time I think I will make it as simple and reliable as possible as it is intended to be a backup and not a primary irrigation controller.


Quote:
However, I wasn't able to implement OTA because it had less memory than the nodeMCUs.
My Tasmota build with irrigation control is on the borderline for being directly loadable with a file size of 495KB. I did confirm that I can load it using the two step OTA process where I first load a minimal image which is 433KB and then use it to load my actual one. Really not that much of an impediment and do not need a device with more memory or faster processor.
Reply With Quote
  #11  
Old May 12th, 2018, 07:18 PM
Steve Q's Avatar
Steve Q Steve Q is offline
OverSeer
 
Join Date: Jun 2005
Location: Michigan
Posts: 3,656
Are the same Max on or off times applied to all channels or can they be assigned per channel? Did you have to remove some Tasmota features to make room for the timers? This could be a nice addition for almost any use of the 4 Channel relay.

Steve Q
Reply With Quote
  #12  
Old May 12th, 2018, 07:45 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
Each relay has its own min and max timers. I have been adding all my code without removing anything that already exists. I have not yet tried to pick up any other Tasmota changes since 5.9.1. Since I am not now current it is not possible to add it to the main line.

In this case I did not need to add any configuration-dependent logic. It was just some new MQTT topics that need to be recognized, a few new variables for the timers, and a new procedure to execute every minute that does the irrigation logic.
Reply With Quote
  #13  
Old May 14th, 2018, 09:46 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
I am happy with the operation of the irrigation monitoring within the 4CH. I have updated mcsMQTT to provide an easy way to setup an irrigation schedule or any other one-time set of messages.

I still have to test the Sonoff Basic for irrigation (one channel relay). I don't expect any difficulty, but something that has not been addressed is the multi-module coordination of irrigation in the failback mode. In the normal mode it is handled the by higher level controller, but in the backup mode there is no coordination of let us say 8 Sonoff Basic units to assure only one of the 8 have a relay active at one time.
Reply With Quote
  #14  
Old May 14th, 2018, 11:53 PM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
Good to hear. I'm waiting for mine. I'm going to start out with the OEM firmware.
Reply With Quote
  #15  
Old May 15th, 2018, 07:56 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
Quote:
I'm going to start out with the OEM firmware.
I believe the OEM app ewlink allows scheduling of the relays, but you will not have integration with HS.

I have added another MQTT setup variable which is the start hour for each of the relays. The failback will not start irrigation until after the start hour specified.

Two benefits to this approach. One is that time-of-day scheduling can now be done. The second is that multiple modules can be used with the time-of-day used to keep each module independent and not overtax the water pressure available.
Reply With Quote
  #16  
Old May 15th, 2018, 09:49 PM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
Quote:
Originally Posted by Michael McSharry View Post
I believe the OEM app ewlink allows scheduling of the relays, but you will not have integration with HS..
Oh? You think that the firmware update is needed for HomeSeer communication? I didn't realize that.
Reply With Quote
  #17  
Old May 17th, 2018, 12:00 AM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
The OEM firmware is outsourced to 3rd party company in China. It is cloud based. It does respond to Echo commands that are also from the cloud.

To update firmware you will remove 4 screws that hold the case together. There is a sequence of three through-hole pads on the circuit card. You can solder a header pin to it, use the header pin and some temporary pressure such as clay or tape, or solder wires directly to pads. You only need to do this once as subsequent updates of firmware are done just like HS updates with a browser.

A usb/serial adapter with 3.3 volt signal levels is used to transfer the firmware from pc to Sonoff. These sell for around $10. I can do it for you but you will pay more in shipping than for the hardware. It is cheaper to ship from China than it is to ship between any two places in USA.

There are many how-to on internet. There is also one at the top of the mcsMQTT forum that was contributed by one of our forum members. I have updated the mcsMQTT manual with the setup for irrigation control and it includes the 4CH circuit card walkthrough. Should have it posted in a day or two. My 4CH testing is done and now confirming same firmware works with single relay basic Sonoff.
Reply With Quote
  #18  
Old May 17th, 2018, 12:09 AM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
Thanks. Got the two Sonoffs and will try to follow your instructions.
Reply With Quote
  #19  
Old May 17th, 2018, 01:13 PM
donstephens's Avatar
donstephens donstephens is offline
OverSeer
 
Join Date: Dec 2001
Location: Hamilton, MT
Posts: 2,724
What USB to serial adaptors are being used to flash the Sonoff?

Thanks
Reply With Quote
  #20  
Old May 17th, 2018, 05:15 PM
Michael McSharry's Avatar
Michael McSharry Michael McSharry is offline
OverSeer
 
Join Date: Jul 2001
Location: North Bend, WA, USA
Posts: 13,635
I have purchased a few varieties over time. In my recent order history on Amazon I have the following. The first will likely suit you better since it has the jumper wires you will need.

https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

https://www.amazon.com/gp/product/B0...?ie=UTF8&psc=1

If you dont have the headers for the circuit board then something like this from Amazon is overkill, but likley cheaper than what you can get for small quantity at a local electronics store.

https://www.amazon.com/OdiySurveil-2...+board+headers

I did upload the firmware and updated the manual that is on the mcsMQTT thread. I did my testing with Sonoff 4CH Pro R2 and Sonoff Basic. The one awkward part is the transition from new firmware to connection to your Wifi. It is similar process as the OEM firmware. If you build from source you can put your SSID and security info into the firmrware. If not you will need to two a two step process with 192.168.4.1 being the IP that the Sonoff will open up to make your initial connection. If you want me to build a special one for you and are willing to provide PM with info then I will make an image for you.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Irrigation control? mikedr HomeSeer Z-Wave Plug-in 7 November 13th, 2014 03:13 PM
New to irrigation control - newbie question ClemsonJeeper Irrigation Discussion 4 April 14th, 2013 11:38 AM
Anyone have screens or are using HSTouch for irrigation control? amblix auto HSTouch™ 7 March 31st, 2011 08:51 PM
best irrigation control script ??? collegeboyslive HomeSeer General Discussion Area 1 December 8th, 2004 12:07 AM
HVAC & Irrigation Control jlevee General Home Automation Hardware Discussion 21 April 22nd, 2004 11:32 PM


All times are GMT -4. The time now is 06:58 AM.


Copyright HomeSeer Technologies, LLC