GreenIQ Irrigation Controller

It’d be good to have a component for GreenIQ watering systems, they already have a documented API and an official package on pip - gardenkit

Anyone tried to integrate this yet?
More info can be found here: https://greeniq.com/api.htm
Looks like the rest API is easy to use. Just ordered one unit. Will have a look when item arrives.

Simply a status check…any progress on integration with GreenIQ API (local/cloud)?

Nope, not on this side. Just returned this unit and got a Rainmachine instead as it’s cheaper, better engineered and already has a full HA implementation!
GreeIQ technical staff seem willing to help with for example rewriting the code to python 3…

Rain machine all the way :slight_smile:

1 Like

GreenIQ have announced that they will be stopping their activity. Therefore, their cloud services will be stopped and it won’t be possible anymore to control the device from outside. They still didn’t communicate any details about how to control the device from the local network …

Since the device is basically a Raspberry Pi, I was thinking about opening it and installing another image. Do you guys know any software that may control the GPIO while having a full integration with HA. The optimal solution is a software that is made for sprinklers, any ideas?

Where did you see that announced? I can’t find it, but their website is suspended - which isn’t a good sign.

The last Android app update in December 2018 has the release notes

GreenIQ Direct feature allows a peer-to-peer communication with your GreenIQ hub.

Once downloading the upgrade, a direct communication with the hub will be possible, using the local network.

Irrigation scheduling can be adjusted via the current APP.

This looks like the app pushes out an update to enable a direct connection to the hub

I received an email saying that basically they will stop their cloud service by end of March and that the devices will run in GreenIQ Direct mode. They said also that they will send an email with more detailed description (which I didn’t receive yet).
I also requested a local API documentation by email and I’m waiting of their response.

Hello. Any news oh how we can still use green iq. I cannot even update to the recommended version and I will not be able to use my mobile app locally. Can we install another software manually? How do you connect to it? Do you ssh? Thank you

I’ve repeatedly sent emails for a local API access but never received any response.

I decided to open the GreenIQ device, I installed Raspbian on a new SD card and then I identified which GPIOs controls which valve. Then, I installed Opensprinkler Firmware but I couldn’t get it to control the GPIOs I need. Now I’m trying to find a new solution to install on the Raspberry to control the GPIOs and integrated it with HA. Do you guys have any suggestions to schedule the control of GPIOs?

There’s local access through the web interface, if you play around with dev tools you should be able to find the web requests it makes and reverse engineer at least the basic on/off functionality.

Reflashing it to use open sprinkler sounds like a good shout. Please can you share the GPIO/valve mappings and I’ll see if I can take a look at it too.

I’m guessing that https://opensprinkler.com/forums/topic/gpio-modification/ is you too!

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 https://opensprinkler.com/forums/topic/gpio-modification/ 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.