Rainmachine Irrigation Controller

It seems as if the Rain Machine Irrigation controller now has a python based client. How difficult would it be to make a component from this? The ability to turn on a zone based on motion to stop deer from eating my flowers would be cool.

Doesn’t rain machine already expose a RESTful API that would be just as easy to integrate with existing components?

I have a Rain Machine but haven’t looked at integrating with me Home Assistant yet…

http://wikipage.rainmachine.com/index.php?title=Controlling_RainMachine_through_REST_API

1 Like

Hi gang. Starting work on this today. First step is writing the API in an official PyPi package; the Python library that RM provides is pretty verbose, so I’m going to create something slimmer that caters to HASS needs. Will keep you posted!

1 Like

Quick update: library is underway and making progress. More to come soon!

Another update: the first release version of the library is done and ready!

With it, developers can:

  • Control programs
  • Control zones
  • Control other watering activities
  • Get status on all programs, zones, and much more

I’m whooped, so I’m going to take a small break, but once I return, I’ll be ready to start work on the HASS component that utilizes this library. In the meantime, I’d love any feature requests you might have!

2 Likes

And we’re off! Just getting my feet wet, but you can see progress under the custom_components folder: https://github.com/bachya/home-assistant/blob/rainmachine/local_config/custom_components/switch/rainmachine.py

1 Like

Hi again. Making progress: I can now see RainMachine programs and zones as switches (that actually work!). However, while hitting the local device’s API, I seem to have crashed it and am working with RainMachine to figure out what’s going on. More soon.

1 Like

Still debugging my RainMachine crashing, but it came back up long enough to share some quick screenshots!

You’re seeing two programs (named “Evening” and “Morning”) and two zones (named “Landscaping” and “Planter Box”) with the prefix “Home” (which is what I’ve named my device). Disabled programs and zones are hidden from the UI unless you add a special configuration item to show them.

These switches work as expected: turning them on/off turns on/off the corresponding program/zone; similarly, if a program/zone is altered from the RainMachine app or web UI, the HASS UI updates appropriately. Right now, zones are turned on for a set number of seconds defined in the configuration.

Still a good chunk of work to do before this is ready for prime time:

  • Add state attributes to all programs and zones (to include things like time left to run, etc.) – will give people a way to create their own sensors based on the data.
  • Register some custom services for things like zone activation (which will provide additional flexibility to what I mentioned above, wherein zones are activated for a set amount of time determined by the configuration).
  • Make everything asynchronous (not crucial, but would be nice).
1 Like

Hi all - my unit was apparently a lemon and I am awaiting a replacement; once I receive it, development will continue. Thanks for your patience!

Hi again – my replacement unit arrived yesterday; will get it installed and get back to work!

Well, my friends, we are in business! Took some time today to wrap up the final pieces, write the documentation, and fire off pull requests:

Component PR: https://github.com/home-assistant/home-assistant/pull/8827

Doc PR: https://github.com/home-assistant/home-assistant.github.io/pull/3135

Final functionality is what’s listed above, minus the customized services – given that the RainMachine platform inherits from the Switch component, it’s limited to what services that provides. Down the road, we (the developers of all the smart sprinkler systems) might consider a “Sprinkler Controller” component, but that’s a bit much for an initial release.

Fingers crossed this gets into the next release!

1 Like

Awesome! I just happened to search this thread because I’m ready to add RainMachine to my hass.io install. I guess I’ll just wait for this now!

The pull requests have been approved! Waiting to see which version this gets into, but we’re nearly there!

1 Like

Well gang, it’s been a long journey, but I’m extremely happy to report that Home Assistant 0.51 now has this integration: https://home-assistant.io/components/switch.rainmachine/

Enjoy!

8 Likes

Amazing!!

I’m looking to get a sprinkler system, do you think there is any way to pull the rain sensor info into hass? That would be so powerful!

Alarms when windows and doors are open and it’s raining!

If you’re talking about the little thing that clips onto the side of your house and triggers a switch when it rains enough, yes the standard rainbird sensor works with Rain Machine. Mine is set to Rain Sensor Normally Closed, false.

Now, the rain sensor will not trip until a set amount of rain has fallen like 1/4". Do not rely on this for getting alarmed for doors open and it’s raining unless you’re ok with a lot of rain falling before it alarms.

EDIT: I found my fix. My env is hassbian, and raspian doesn’t include setuptools which runamel.yaml requires. Therefore…

pip3 install --upgrade setuptools

Original below:

regenmashine=0.3.2 fails to install due to a prerequisite being broken

It traces back to ruamel.yaml. The last several versions die with the same error, so I’m a bit at a loss here.

Collecting ruamel.yaml
  Using cached ruamel.yaml-0.15.27.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-1z9ou4xr/ruamel.yaml/setup.py", line 917, in <module>
        main()
      File "/tmp/pip-build-1z9ou4xr/ruamel.yaml/setup.py", line 905, in main
        setup(**kw)
      File "/usr/lib/python3.4/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/srv/homeassistant/lib/python3.4/site-packages/setuptools/dist.py", line 266, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib/python3.4/distutils/dist.py", line 280, in __init__
        self.finalize_options()
      File "/srv/homeassistant/lib/python3.4/site-packages/setuptools/dist.py", line 301, in finalize_options
        ep.load()(self, ep.name, value)
      File "/srv/homeassistant/lib/python3.4/site-packages/setuptools/dist.py", line 101, in check_extras
        if pkg_resources.invalid_marker(m):
      File "/srv/homeassistant/lib/python3.4/site-packages/pkg_resources.py", line 1207, in is_invalid_marker
        cls.evaluate_marker(text)
      File "/srv/homeassistant/lib/python3.4/site-packages/pkg_resources.py", line 1319, in _markerlib_evaluate
        for key in env.keys():
    RuntimeError: dictionary changed size during iteration
    sys.argv ['-c', 'egg_info', '--egg-base', 'pip-egg-info']

Thanks for the tip… I’ll need to setup another rain sensor solution

Come on intergration for one of these

http://www.gearbest.com/home-smart-improvements/pp_668897.html?vip=2047965&gclid=EAIaIQobChMI8_aag5Da1QIV7bDtCh30yAowEAAYASAAEgIJP_D_BwE