Announcement

Collapse
No announcement yet.

$25 Sonoff 4CH for irrigation control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $25 Sonoff 4CH for irrigation control


  • #2
    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

    Comment


    • #3
      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

      Comment


      • #4
        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?

        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
        Don

        Comment


        • #5
          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

          Comment


          • #6
            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.

            Comment


            • #7
              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.

              Comment


              • #8
                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.

                Comment


                • #9
                  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, 04:15 PM.
                  Blair

                  HomeSeer: HS3 Pro 3.0.0.435
                  Hometroller S6 | Devices: 601 | Events: 202
                  Plug-Ins: Z-Wave .190 | HSTouch | RFXCOM | UltraRachio3
                  BLLAN | NetCAM | Global Cache Pro | Blur-Iris :rolleyes:

                  Comment


                  • #10
                    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.


                    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.

                    Comment


                    • #11
                      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
                      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

                      Comment


                      • #12
                        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.

                        Comment


                        • #13
                          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.

                          Comment


                          • #14
                            Good to hear. I'm waiting for mine. I'm going to start out with the OEM firmware.
                            Don

                            Comment


                            • #15
                              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.

                              Comment

                              Working...
                              X