Rachio Smart Sprinkler Controller

Some more light.

  • Rachio support provided more information on the JSON format: see https://community.rachio.com/t/webhook-documentation/9184/17
  • I added a validation on the inbound request come from AWS - Rachio cloud is hosted here. The list of valid IP address ranges is loaded on binding initialization directly from AWS, so will be up-to-date.
  • I changed the device / zone event string to be a JSON format, I remove the “gson” stuff required to reconstruct the object. So this information can be processed by a OH rule.

Still need some time to figure out the https problem. Maybe a Jetty config problem.

The next days I let the binding run. Events are processed and then I could check the log for additional unhandled events, which might be processed to provide for event driven information.

You can find the latest build at: https://github.com/markus7017/org.openhab.binding.rachio/blob/master/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar
README: https://github.com/markus7017/org.openhab.binding.rachio/blob/master/README.md

Rachio community forum is involved:

Hello folks, new here to try to get started with the Rachio binding. I followed the steps above on post 127 but cant get through to installing things when I scan. I see this after I scan but I get a “Thing not found error when I try to add.”

I am also seeing this when I go into karaf. No matter which snapshot I download, I see the same “2.3.0.201802071915” not sure if thats always going to be the case.

openhab> bundle:list | grep Rachio                                                                                                                                                                                                            
249 │ Active   │  80 │ 2.3.0.201802071915     │ Rachio Binding
openhab>     

Just wondering if any of you have come across this error… or if its something obvious on my end.

Hi Hector,

perfect timing. I‘m just finishing a code redactoring. As I see in the timestamp you tried a version from February.

Please make sure to use this one: https://github.com/markus7017/org.openhab.binding.rachio/blob/master/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar
README: https://github.com/markus7017/org.openhab.binding.rachio/blob/master/README.md

In general:
copy thr jar to your addons folder
enable debugging: open karaf/openhab console and type ‚log:set DEBUG org.openhab.binding.rachio‘
create a rachio.things file in the things folder, see readme for syntax
make sure to add the apikey to the config (not apiKey as is previous versions)
when you do a manual scan it should create things for all controllers and things under your account (apikey)
otherwise check openhab.log for errors and post an extract here

if basic stuff is running check the README how to setup the event interface (opening a port on your router and setting callbackUrl in the thing definition).

Looking forward to your feedback

@fifo Hi Hector, I updated the repository so you could use the links above.

Markus thanks, I won’t be able to try it tonight but should get to it tomorrow afternoon. I’ll let you know how it goes.

Markus,

First thanks for this, I love the idea of having all my automation in one place.

I went ahead and followed your instructions. When the new rachio binding was installed it did not create a rachio.cfg file. Not really sure if it is supposed to based on the readme file but I was expecting it to. I ended up creating a rachio.things file and added the info as explained at the bottom of the readme file. I never populated a .cfg file. It loaded with no problem and when I did my initial scan it found my zones and the rachio controller. I added the things it found to openhab and then the items as well. As I was doing this I noticed that it went offline. I had also made the portforward to my rachio controller before I even began setting up in openhab.

I see this in the debug file.

2018-04-17 21:38:31.014 [DEBUG] [rnal.api.RachioEvent$RachioApiResult] - RachioApi: Remaing number of API: limit=1700, remaining=1694, reset at 2018-04-19T00:00:00Z
2018-04-17 21:38:31.020 [ERROR] [g.rachio.handler.RachioBridgeHandler] - RachioBridge: API access blocked on update (0 / 0), reset at

A restart of openhab temporarily fixes it but eventually goes back to this in the log. I havent been able to control the rachio just yet because it disconnects too quickly.

2018-04-17 21:48:16.160 [DEBUG] [inding.rachio.internal.api.RachioApi] - RachioApi: Using cached personId ('REDACTED_CODE').
2018-04-17 21:48:16.908 [DEBUG] [rnal.api.RachioEvent$RachioApiResult] - RachioApi: Remaing number of API: limit=1700, remaining=1690, reset at 2018-04-19T00:00:00Z
2018-04-17 21:48:16.917 [ERROR] [g.rachio.handler.RachioBridgeHandler] - RachioBridge: API access blocked on update (0 / 0), reset at 
2018-04-17 21:48:33.144 [ERROR] [lmessage.RequestNodeInfoMessageClass] - Request node info not placed on stack due to error.


I restarted one last time just to see if the controls would go out while it was responding and here is what I got… ( The sprinklers did respond but lost communication again)

2018-04-17 22:05:49.097 [DEBUG] [ing.rachio.handler.RachioZoneHandler] - RachioZone.handleCommand ON for rachio:zone:1:RANDOMNUMBER-1:run
2018-04-17 22:05:49.099 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone: Starting zone 'Pool Zone [1]' for 0 secs
2018-04-17 22:05:49.100 [DEBUG] [ing.rachio.handler.RachioZoneHandler] - RachioZone: No specific runtime selected, using default (120 secs);
2018-04-17 22:05:49.101 [DEBUG] [inding.rachio.internal.api.RachioApi] - RachioApi: Start zone 'SOME_RANDOM_NUMBER' for 120 sec.
2018-04-17 22:05:49.885 [ERROR] [inding.rachio.internal.api.RachioApi] - RachioApi: Running zone 'SAME_RANDOM_NUMBER' for 120sec failed: RachioHttp: Error sending HTTP GET request to https://api.rach.io/1/public/zone/start . Got response code: 204
2018-04-17 22:07:09.399 [DEBUG] [inding.rachio.internal.api.RachioApi] - RachioApi: Using cached personId ('REDACTED_CODE').
2018-04-17 22:07:10.200 [DEBUG] [rnal.api.RachioEvent$RachioApiResult] - RachioApi: Remaing number of API: limit=1700, remaining=1676, reset at 2018-04-19T00:00:00Z
2018-04-17 22:07:10.209 [ERROR] [g.rachio.handler.RachioBridgeHandler] - RachioBridge: API access blocked on update (0 / 0), reset at 

Hi @fifo,
thanks for feedbank. Doing a fresh installed I noticed that some initialisation was
missing. This is already fixed, but I saw another bug.

Stay tuned, I’ll post a new version today or tomorrow :wink:

@fifo: New version is available at https://github.com/markus7017/org.openhab.binding.rachio/blob/master/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar

Please let me know about results

Markus,

Its looking better. I installed the new binding and it no longer seems to disconnect. I was able to control the zones with no issue and it is no longer disconnecting. I noticed the Run Zone switch does not turn back off when it completes the cycle. I am assuming its related to that last message in the log.

Here is the log data…

2018-04-19 08:19:56.146 [DEBUG] [ing.rachio.handler.RachioZoneHandler] - RachioZone.handleCommand ON for rachio:zone:1:RANDOMNUMBER-1:run
2018-04-19 08:19:56.147 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone: Starting zone 'Pool Zone [1]' for 0 secs
2018-04-19 08:19:56.151 [DEBUG] [ing.rachio.handler.RachioZoneHandler] - RachioZone: No specific runtime selected, using default (120 secs);
2018-04-19 08:19:56.151 [DEBUG] [inding.rachio.internal.api.RachioApi] - RachioApi: Start zone 'RANDOMNUMBER' for 120 sec.
2018-04-19 08:19:56.684 [ERROR] [inding.rachio.internal.api.RachioApi] - RachioApi: Running zone 'RANDOMNUMBER' for 120sec failed: RachioHttp: Error sending HTTP GET request to https://api.rach.io/1/public/zone/start . Got response code: 204

ok got another clue now. When I run the zone it runs the zone for the time I have on the manual run of the app on my phone ( equivalent to Quick Run setting on App). It doesn’t just stay on which is what it looks like the binding is expecting. Again I am assuming here that is the case because openhab seems to think it is still running. Here is the log when I flip the switch back to off even though the sprinklers are already off.

2018-04-19 08:30:54.290 [DEBUG] [ing.rachio.handler.RachioZoneHandler] - RachioZone.handleCommand OFF for rachio:zone:1:RANDOMNUMBER-1:run
2018-04-19 08:30:54.292 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone: Stop watering for the device
2018-04-19 08:30:54.639 [ERROR] [inding.rachio.internal.api.RachioApi] - RachioApi: device/stop_water failed: RachioHttp: Error sending HTTP GET request to https://api.rach.io/1/public/device/stop_water . Got response code: 204

Hi @fifo, I found the problem (the call returns http 204=NOP_CONTENT instead of http 200 to indicate OK - leftover from refactoring).
The button should auto-switch off if the binding is receiving the event call back. This requires proper setup of your router (port forwarding to the OH device) and the correct callbackUrl incl the port number: http://mydomain.com:/rachio/webhook.

Please check the log for "RachioApi: Register WebHook, callback url = " and potential error message while registering the web hook.

https://github.com/markus7017/org.openhab.binding.rachio/blob/master/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar

Hmm ok I will check later on today. I’m pretty sure I set that up but may have missed something on the port forward.

I put in the latest binding and I am no longer getting the 204 errors. I still continue having the issue with the webhook however. Quick question, I am not 100% on how the webhook part works. Is there any way I can test this internally to make sure OH is listening for the webhook port. I am trying this on my browser for my internal network but am getting nothing. Seems nothing is listening on the webhook port.

Here is what I tried so far and gotten nowhere.

https://mydomain.com:50043/rachio/webhook
192.168.1.2:50043/rachio/webhook (.2 is my openhab server in this case)

Also did a cat /etc/services and dont see the port listed there.

Hi, I added some info to the README.MD (at the end) - click on the link


Please let me know about the results.

Ok it makes sense now. Will try this afternoon and get back. I was all confused about how that worked and the readme helped a bunch. Have to make a few changes…

This is the tricky part of the binding setup😉 and the reason on integrating UPnP based port mapping.

ok everything is set up however I don’t seem to be getting the webhook call back when the timer is up.

Here is what I see in the log

==> events.log <==
2018-04-20 18:01:22.305 [vent.ItemStateChangedEvent] - IRO1Zone_RunZone changed from OFF to ON

==> openhab.log <==
2018-04-20 18:01:22.847 [ERROR] [inding.rachio.internal.api.RachioApi] - RachioApi: Running zone 'RANDOMNUMBER' for 60sec failed: can't parse argument number: 


I can reach the webhook white page from outside my network so I know it is working. If I try accessing it from outside I see this in my log.

==> openhab.log <==
2018-04-20 18:04:01.665 [DEBUG] [io.internal.api.RachioWebHookServlet] - RachioWebHook: Unable to process inbound request, data=''


never saw RANDOMNuMBER as a zone number (should be 1, 2, 3 etc.).
did you changed the defaultRuntime?

The zone number is invalid, so the command doesn’t get through and you don’t see an event (in general you’ll see events like in the App, just a few sec later)

Please enable debugging:
open the openhab console and enter

log:set DEBUG org.openhab.binding.zwave

and post the initialization messages showing the zone configuration and the section when you run the zone.

got it
https://github.com/markus7017/org.openhab.binding.rachio/blob/master/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar

you should see something like

2018-04-20 22:58:46.413 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone: Starting zone 'Zone 1 - Front Yard [1]' for 0 secs
2018-04-20 22:58:51.194 [INFO ] [g.rachio.handler.RachioDeviceHandler] - RachioDevice 'Rachio Turtle Pine House': schedule'Quick Run' Schedule Started (type=FIXED, estimatedDuration = 120sec - Quick Run will run for 2 minutes.)
2018-04-20 22:58:52.114 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone: Event for zone[1] 'Zone 1 - Front Yard': Zone 1 - Front Yard began watering at 10:58 PM (EDT). (status=STARTED, duration = 120sec)
2018-04-20 22:58:52.118 [INFO ] [ing.rachio.handler.RachioZoneHandler] - RachioZone[1]: 'Zone 1 - Front Yard' STARTED watering (2018-04-21T02:58:48Z).
==> /var/log/openhab2/events.log <==
2018-04-20 22:58:52.144 [vent.ItemStateChangedEvent] - RachioTurtlePineHouse1Zone1FrontYard_LastZoneEvent changed from  to {"timetstamp":"2018-04-21T02:58:48Z","summary":"Zone 1 - Front Yard began watering at 10:58 PM (EDT).","topic":"","type":"ZONE_STATUS","subType":"ZONE_STARTED"}

This is an example for an event:

RachioZone: Event for zone[1] 'Zone 1 - Front Yard': Zone 1 - Front Yard began watering at 10:58 PM (EDT). (status=STARTED, duration = 120sec)