Rain bird garden system

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
hendrikenrenny
Posts: 18
Joined: Monday 20 April 2015 21:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Rain bird garden system

Post by hendrikenrenny »

Hey,

Is there anyone that connected the rain bird garden system to Domoticz?

How is that done?

I ordered the Rain Bird beregeningscomputer, type ESP-RZXe4i with a wifi module.

Thanx!

Hendrik
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Rain bird garden system

Post by waltervl »

There is a Python library https://github.com/jbarrancos/pyrainbird
Perhaps that can be used to make a python plugin or a python script.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
solarboy
Posts: 345
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: Rain bird garden system

Post by solarboy »

I have this irrigation controller, the wifi connection is terrible (short range and lots of dropouts) and the "app" is extremely slow, can't recommend it at all.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Rain bird garden system

Post by BarryT »

Just take away the controller and make 1 by yourself.
Its 12/24v with valves mostly, so easy done with some relais or ethernet board.
Made many irrigation systems this way, and it works perfectly.
Just some scripting with time based zones or even with soil moisture sensors if you want it full automatically.
solarboy
Posts: 345
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: Rain bird garden system

Post by solarboy »

Agreed, I will be moving to a couple of 4 way zigbee relay pcbs, they can be powered with the same 24V AC as the irrigation valves.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Rain bird garden system

Post by BarryT »

solarboy wrote: Tuesday 31 May 2022 3:16 Agreed, I will be moving to a couple of 4 way zigbee relay pcbs, they can be powered with the same 24V AC as the irrigation valves.
Good job ;-)
Succes!
Tuk90
Posts: 50
Joined: Thursday 04 January 2024 15:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain bird garden system

Post by Tuk90 »

hendrikenrenny wrote: Monday 09 May 2022 22:12 Hey,

Is there anyone that connected the rain bird garden system to Domoticz?

How is that done?

I ordered the Rain Bird beregeningscomputer, type ESP-RZXe4i with a wifi module.

Thanx!

Hendrik
Yes, and I got it working, if your still interested I can show what I did
User avatar
waltervl
Posts: 5846
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Rain bird garden system

Post by waltervl »

There will be always someone interested in your setup so please share it.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BazemanKM
Posts: 35
Joined: Wednesday 22 July 2015 21:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain bird garden system

Post by BazemanKM »

Tuk90
Posts: 50
Joined: Thursday 04 January 2024 15:44
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Rain bird garden system

Post by Tuk90 »

A bit late but my setup:

I have created a dummy hardware and in my case three devices for the three zones which I have in my garden. I have a script that is initiated on start, on stop and also a dzvents script. All these scripts are calling the python module of https://github.com/allenporter/pyrainbird.

You need to install this module on your device before you can use it.

My on start invoke script: script:///[path]/rainbird_start.py 2 30 192.168.1.1, where two is the zone, 30 is the time and the last one is the ip adres.

Code: Select all

#!/usr/bin/env python3
from pyrainbird import RainbirdController
import sys
import time
import logging

logging.basicConfig(filename='pypython.log',level=logging.DEBUG)

#gets the given arguments and puts them in the right variable
zone = sys.argv[1]
minutes = sys.argv[2]
ipadress = sys.argv[3]

_LOGGER = logging.getLogger(__name__)
_LOGGER .setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
_LOGGER.addHandler(ch)

#starts irrigate zone for the given zone and minutes
controller = RainbirdController(ipadress,'password')
controller.irrigate_zone(int(zone),int(minutes))

Mind the second last line, there you need to fill in the password of the controller

The off action invoke script: script:///[path]/rainbird_stop.py 192.168.1.1, it only needs the ipadres

Code: Select all

#!/usr/bin/env python3
from pyrainbird import RainbirdController
import sys
import time
import logging

logging.basicConfig(filename='pypython.log',level=logging.DEBUG)

_LOGGER = logging.getLogger(__name__)
_LOGGER .setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
_LOGGER.addHandler(ch)

ipadress = sys.argv[1]

#stops all the irrigation
controller = RainbirdController(ipadress,'password')
controller.stop_irrigation()

Mind the second last line, there you need to fill in the password of the controller

And I got a get status dzvents script, but I have not used it for quite sometime because occasionally it did crash domoticz:

Code: Select all

return
{
    on =
    {
        timer =
        {
            'every minute',
        },
        
},
    execute = function(dz)
        local GazonAchter = dz.devices('Gazon achter')
        local GazonVoor = dz.devices('Gazon voor')
        local Druppels = dz.devices('Druppels')
        
        --function to execute a local script with logging
        local function osCommand(cmd)
            if dz == nil then dz = domoticz end -- make sure dz is declared as domoticz object if not already done earlier 
            dz.log('Executing Command: ' .. cmd,dz.LOG_DEBUG)

            local fileHandle = assert(io.popen(cmd .. ' 2>&1 || echo ::ERROR::', 'r'))
            local commandOutput = assert(fileHandle:read('*a'))
            local returnTable = {fileHandle:close()}

            if commandOutput:find '::ERROR::' then     -- something went wrong
               dz.log('Error ==>> ' .. tostring(commandOutput:match('^(.*)%s+::ERROR::') or ' ... but no error message ' ) ,dz.LOG_ERROR)
            else -- all is fine!!
                dz.log('ReturnCode: ' .. returnTable[3] .. '\ncommandOutput:\n' .. commandOutput, dz.LOG_DEBUG)
            end

            return commandOutput,returnTable[3] -- rc[3] contains returnCode
        end
        
        if GazonAchter.state == 'On' or GazonVoor.state == 'On' or Druppels.state == 'On'
        then
            osCommand("python3 /home/pi/pyrainbird/rainbird_get_state.py")
        end
    end
    
}
and the python code looks like this:

Code: Select all

#!/usr/bin/env python3
from pyrainbird import RainbirdController
import requests #used for the api calls
import sys
import time
import logging

ipdomoticz = '192.168.1.1' #ipadress of domoticz
portdomoticz = '8080' #port on wich domoticz is running

zones = {
    "1": "229", #Gazon achter
    "2": "230", #Gazon voor
    "3": "228"  #Druppels
}

#puts it in a dict so that it can be used in an for loop
zones = zones.items()

logging.basicConfig(filename='pypython.log',level=logging.DEBUG)

_LOGGER = logging.getLogger(__name__)
_LOGGER .setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
ch.setFormatter(formatter)
_LOGGER.addHandler(ch)

#credentials to connect to the controller
controller = RainbirdController('192.168.2.1','password')

#for loop to update the device states in domoticz
for zone, devidswitch in zones:
    zonestate = controller.get_zone_state(int(zone))
    print(str(zone)+' heeft als status '+str(zonestate))
    devreq = requests.get("http://"+ipdomoticz+":"+portdomoticz+"/json.htm?type=devices&rid="+devidswitch).json()
    devstatus = devreq["result"][0]["Status"] #gets the status value in the first array of result
    if zonestate == False and devstatus == "On":
        requests.post("http://"+ipdomoticz+":"+portdomoticz+"/json.htm?type=command&param=switchlight&idx="+devidswitch+"&switchcmd=Off") # update device
    elif zonestate == True and devstatus == "Off":
        requests.post("http://"+ipdomoticz+":"+portdomoticz+"/json.htm?type=command&param=switchlight&idx="+devidswitch+"&switchcmd=On") # update device

It is not really clean, but it does the job, I think this logic could be setup in a python plugin fairly easy, the only problem is that you do need an external library.
marcin2
Posts: 3
Joined: Thursday 16 May 2019 13:23
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: PL
Contact:

Re: Rain bird garden system

Post by marcin2 »

For those who use Rainbird ESP-RZXe Series, see the following to control the RainBird irrigation system via MQTT and Domoticz:

https://github.com/KD377/mqtt-rainbird

Cheers,
Marcin
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest