GreenIQ Irrigation Controller

The GPIO is mapping is as follows:

BCM GPIO Valve # Cable 1 color
4 7 1 White
17 0 2 Brown
18 1 3 Red
27 2 4 Yellow
22 3 5 Green
23 4 6 Blue
24 5 Master Orange
25 6 Light White (Cable 2)

I’m using wiringPi GPIO: http://wiringpi.com/wp-content/uploads/2013/03/gpio1.png

I tried modifing the code of OpenSprinkler but for example the GPIO7 is used for something. Even after the modification, the pin doesn’t appear in the web interface (because it is pulled from the OpenSprinkler servers). I also tried forcing using the API but the software just bugs and stops working.

You can check my fork of OpenSprinkler here: Fork

The API documentation

That’s me :smile:

I’m guessing that GPIO Modification | OpenSprinkler is you too!

I am in the same boat. I have found this document online (not receiving any mail):

So after April 1st I think we can turn it on and off using the app. However, I hope somebody can make it also “smart”. I have also trouble finding a good alternative for greeniq in the Netherlands.

I found an interesting controller that may be used and installed in the Raspberry, it’s called sprinklers_pi.

It offers many features including a web interface, scheduling, manual control, weather adjustments to cite a few.

I installed it on the Raspberry in the GreenIQ and the valves are reacting normally. The valve mapping is a bit different though, the wiringPi GPIO naming is used and the zone number corresponds to the GPIO number (e.g., Zone 1 will trigger GPIO 1). GPIO 0 corresponds to the master/pump valve. The complete mapping is found below:

Sprinklers Pi Zone wPi GPIO Cable 1 color GreenIQ Valve #
Master/Pump 0 Brown 2
1 1 Red 3
2 2 Yellow 4
3 3 Green 5
4 4 Blue 6
5 5 Orange Master
6 6 White (Cable 2) Light
7 7 White 1

Concerning control from Hass, something can be done using the API it offers.

Dear a-reda,

Could you explain a bit more how you fixed it? So a bit noob like ;). I am not really deep into such things only playing abit with home assistant and have since today a GreenIQ hardware to otherwise throw away. Thanks and very much appreciated.

Thanks Peter

Hi All,
the sprinklers_Pi thing looks pretty interesting. As far as I understand I have to replace the SD card within the Greeniq with a new one that has the sprinklers_PI code loaded.
As I have never worked with raspberry before I would love to get a short description how this can be achieved.

For programmers this might be of interest: https://arxiv.org/pdf/1808.02131.pdf
It is a hacking report covering the greeniq as well. Maybe this helps to understand how the original software worked and how it can be replaced.
Best Thorsten

VALID ONLY FOR GEN 2 GREEN IQ WITH A RPI INSIDE

Here is a little description on how to install Sprinklers_pi on the RaspberryPi of the GreenIQ.

This tutorial requires opening the GreenIQ box to access the SD Card, be sure to be safe :wink:

I will be including links to tutorials for further details on some steps.

  1. Start by downloading an OS for the Raspberry, I recommend using Raspbian Lite to have better performance: https://downloads.raspberrypi.org/raspbian_lite_latest

  2. Install Raspbian into an SD Card (either a new one or the one already in the GreenIQ but you will lose GreenIQ software). Etcher is a good software to do so.

  3. Activate SSH by creating an empty file called ssh on the /boot partition Raspbian with SSH tutorial - Hackernoon

  4. SSH into the freshly installed Raspbian by finding it’s IP from the router or any other tool.

  5. Install SprinklersPi as in the steps below or in SprinklerPi Installation

  6. Install first Wiring Py (source http://wiringpi.com/download-and-install/)
    wget https://lion.drogon.net/wiringpi-2.50-1.deb
    sudo dpkg -i wiringpi-2.50-1.deb

  7. Install some dependencies
    sudo apt-get install libsqlite3-dev build-essential

  8. Download the last version of SprinklersPi (check latest on Releases)
    wget https://github.com/rszimm/sprinklers_pi/archive/v1.4.0.tar.gz
    tar -xzvf v1.4.0.tar.gz

  9. Compile
    cd sprinklers_pi-#.#.# (Replace # with the version you downloaded)
    make
    sudo make install

  10. Start SprinklersPi usingsudo /etc/init.d/sprinklers_pi start

And here you go the web interface is available on port 8080, sometimes rebooting resolves some problems if it doesn’t work directly. The installer automatically configures SprinklersPi to start on boot.

Make sure you choose Direct Positive in the SprinklersPi settings

Please refer to the SprinklersPi Wiki for further configuration settings, including weather provider configuration. Please note that the mapping zone to cable color changes as in this post:

Don’t hesitate to contact me if you need some clarifications. :smile: :sunglasses:

5 Likes

Hello,

I regret not seing this before! I am surprised how ‘close’ the look & feel of the sprinkler_pi UI is compared to the GreenIQ Web application… :wink:

In the mean time, I have tried a different approach:

  • I gain access to the GreenIQ through SSH
  • I played (to understand) the existing scripts - I should have been more careful, it detected a ‘corruption’ and reset to ‘emergency’ mode (which is way too old!) Hopefully, I made a backup that I will restore later.
    Exemple of the boot.log:
2019-04-02 06:42:48,591 - GreenIQ Initialization and Software Update Utility
2019-04-02 06:42:48,596 - --------------------------------------------------
2019-04-02 06:42:48,602 - Setting up GPIO pins - done.
2019-04-02 06:42:49,776 - Checking internet connection. Trial number #1.
2019-04-02 06:45:12,241 - Checking internet connection. Trial number #2.
2019-04-02 06:47:34,638 - Checking internet connection. Trial number #3.
2019-04-02 06:49:57,041 - Checking internet connection. Trial number #4.
2019-04-02 06:52:19,441 - Checking internet connection. Trial number #5.
2019-04-02 06:54:41,841 - No connection to cloud. Exiting initialization process
2019-04-02 06:57:47,857 - Starting release integrity verification
2019-04-02 06:57:47,867 - release_deployer.json based integrity check
2019-04-02 06:57:47,895 - Expected signature 1c94eb03d9ea8ef6073aef5b3a083a47 actual signature 1c94eb03d9ea8ef6073aef5b3a083a47
2019-04-02 06:57:47,906 - Emergency code validated code integrity. Exiting script.
2019-04-02 07:13:35,274 - Identity on card XXXXXX
  • Control of the GreenIQ with this deprecated API is quite easy, to run sprinkler #3 with the testGPIO.py script:
# ****************************************************************************************
#
# Debug Test
#
# ****************************************************************************************
import greeniq_defs as GD

import time

from hub_model_handler import HardwareHandler

model_utilities = HardwareHandler.getModelUtilities()

# ************************************************************************
# Init GPIO
# =========
try:
    # MAX_PORTS = 8 in model B, 19 in model C
    MAX_PORTS = model_utilities.get_max_ports()

    # For model B:
    # gpio_map  = [7, 11, 12, 13, 15, 16, 18, 22, 26]
    # high_is   = '1'
    gpio_map, high_is = model_utilities.init_gpio()

except Exception,e:
    print("Error in initialization process: ", e)


# ******************************************************************************
# Test valve 3
# ==============
def test_valve_3():
    GD.set_gpio(MAX_PORTS, gpio_map, '00100010', high_is)
    time.sleep(30)
    GD.set_gpio(MAX_PORTS, gpio_map, '00000000', high_is)
    return True
  • now, I will try to understand why GreenIQ web application is no longer able to run sprinkler on my Gen2 GreenIQ

Moving on from the GreenIQ software still seems like a durable and reliable solution, but this will help us reverse engineer the GreenIQ software. For example, I want to see which GPIO is used for the LEDs and sensors …

The reason that the web app is not able to run the sprinkler is probably due to the fact that the commands are validated somehow in the cloud. However, the cloud now is not working so they fail.

Can you please tell me how you got access through SSH? Also if you can put the scripts you found in a gist or something and share them.

I am very glad you are following this path for advanced users, I just would like to try fixing GreenIQ.

It is easy, for Gen2 GreenIQs, it is located in /home/pi/greeniq/Code/modelb_utilities.py (and modelc_utilities.py for Gen3)

[quote].

Sure, you need to reset root password as described here for pi user (pi user has been removed by GreenIQ): Changer un mot de passe oublié sur Raspberry Pi en 5 étapes

Hi,
With this procedure can I replace the GreenIQ SD card?
thanks
Rodrigo

Yes you can format it, or use another one.

1 Like

Incredible !!!
I did every single step you describe, but when greenIQ (3rd gen) turns on and I see all the green LEDs and it doesn’t connect to the wifi that I configured on raspberry …
Can you tell me if I’ve done something wrong?
Tnks!
R.

The LEDs are no longer relevant when you install the new OS, it should be something with the Wifi connection …

Can you confirm that I’ve done the correct steps?
1- install newOS with raspberry
2- configure the wifi on raspberry
3- install SprinklersPi and dependencies …
4- remove the sd card from the raspberry
5- replace the greeniq card with the new one.

Correct?

Hi,
I test else, i have gen3 and the same issue green led stay on and no communication with wifi.

Hello.Same here. I cannot get the wifi to work.

I think the Wifi problem is coming from the Stretch version of Raspbian and it’s new naming convention. Try adding net.ifnames=0 on the file /boot/cmdline.txt making sure you leave a space between each one of the arguments.

EDIT: To avoid spamming this forum with unrelated question, please join this discord group where I can reply to specific questions: https://discord.gg/tvrsXSs

Hello!
I have a GreenIQ device like that, but unfortunately I don’t have SD card in it.
Can somebody send me the SD card files, or can somebody share where can I download them?
Thank you in advance.

Hello. Be aware! the name of your network(ssid) must not contain “_”.

Hi tomdh76
Have you been able to connect via greeniq direct to your box? I’m trying desperately the last days but I do not get access. My user name / Pw is not accepted. I assume the user and pw is not the one used for the app?! But where can I find this initial and correct one?
Can anyone help ?! Cheers