Rachio Smart Sprinkler Controller

could you give an overview on your network setup

ISP modem -> firewall ( 2 subnets: Nat for rachio done here pointing to webserver on segment 1) -> segment 1 where my outward facing web server is. It is performing a reverse proxy to open hab which is on segment 2.

Itā€™s a bit confusing to wrap around but I have other things using reverse proxy with no issues using exact setup.

Let me know if you need me to expand on any of that. I canā€™t do the Nat direct to the openhab because I only have 1 IP so I kind of have to play with ports to host multiple servers if I need to as in this case.

could start with a simplified setup - straight forward?

Check the log, you should see

2018-04-18 00:24:15.811 [DEBUG] [.c.thing.internal.ThingManager:686  ] - Calling initialize handler for thing 'rachio:cloud:1' at 'org.openhab.binding.rachio.handler.RachioBridgeHandler@20030401'.
2018-04-18 00:24:15.817 [DEBUG] [r.internal.RachioConfiguration:53   ] -   defaultRuntime=120
2018-04-18 00:24:15.818 [DEBUG] [r.internal.RachioConfiguration:53   ] -   clearAllCallbacks=true
2018-04-18 00:24:15.818 [DEBUG] [r.internal.RachioConfiguration:53   ] -   apikey=xxxxxxxxx
2018-04-18 00:24:15.818 [DEBUG] [r.internal.RachioConfiguration:53   ] -   pollingInterval=300
2018-04-18 00:24:15.818 [DEBUG] [r.internal.RachioConfiguration:53   ] -   callbackUrl=http://xxxxxx.yyyy.com:50000/rachio/webhook
2018-04-18 00:24:15.818 [DEBUG] [r.internal.RachioConfiguration:53   ] -   ipFilter=

make sure the url is set correctly.

and also

2018-04-18 00:26:59.546 [DEBUG] [.rachio.internal.api.RachioApi:302  ] - RachioApi: Register WebHook, callback url = 'http://xxxx.yyyy.com:50000/rachio/webhook'

make sure this message is included and no error is displayed.

Markus the URL does look correct there. I can look into bypassing the reverse proxy. I will have to do that tomorrow though. Iā€™ll try and let you know.

yup :wink:

by the way

The 45696 is the client port.

We just need to focus why we are getting ā€œā€ on the curl command. Event the port forward is not working you have to see the registered URL, otherwise there will be no call back anyways. Please post the complete initialisation part (without the apikey) of the log. - maybe as file.

I verified what the cloud returns (using bridge option clearAllCallbacks=true cleans up the table when the binding gets initialized)
a) when no registrations are active

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaa" https://api.rach.io/1/public/notification/dddddddd-dddd-dddd-dddd-dddddddd/webhook

returns 
[]
= empty list

when the binding is initialized:

[{"id":"wwwwwwww-wwww-wwww-wwww-wwwwwwww","url":"http:/markus123,com:51443/rachio/webhook","eventTypes":[{"name":"DEVICE_STATUS","type":"WEBHOOK"},{"name":"ZONE_DELTA","type":"WEBHOOK"},{"name":"ZONE_STATUS","type":"WEBHOOK"},{"name":"SCHEDULE_STATUS","type":"WEBHOOK"},{"name":"RAIN_DELAY","type":"WEBHOOK"},{"name":"DELTA","type":"WEBHOOK"},{"name":"WEATHER_INTELLIGENCE","type":"WEBHOOK"}],"externalId":"hhhhhhhhhhhhhhhhh"}]

aaaaaaaa is the app key
dddddddd is the device id
wwwwww is the webhook id
hhhhhhhh is a hash to be validated on inbound requests

I found a mini bug displaying the clearAllCallbacks setting, but is just cosmetics.

Markus,

I temporarily bypassed my reverse proxy and exposed the ports. I was able to access everything as expected however the response to the curl command is still []. I cant seem to find the init string you mentioned anywhere. Where am I looking for that exactly?

[{"id":"wwwwwwww-wwww-wwww-wwww-wwwwwwww","url":"http:/markus123,com:51443/rachio/webhook","eventTypes":[{"name":"DEVICE_STATUS","type":"WEBHOOK"},{"name":"ZONE_DELTA","type":"WEBHOOK"},{"name":"ZONE_STATUS","type":"WEBHOOK"},{"name":"SCHEDULE_STATUS","type":"WEBHOOK"},{"name":"RAIN_DELAY","type":"WEBHOOK"},{"name":"DELTA","type":"WEBHOOK"},{"name":"WEATHER_INTELLIGENCE","type":"WEBHOOK"}],"externalId":"hhhhhhhhhhhhhhhhh"}]

I tried a grep of my log files and I donā€™t see it come up.

Here is what I triedā€¦

:/opt/openhab2/userdata/logs$ tail -f *.log | grep WEBHOOK

Important. I opened up a new branch ā€˜alpha2ā€™ - see below

update for the community while having direct chats with Hector

  • we found the problem preventing registering web hook - he didnā€™t accepted the linkage of the device thing (only bridge + zone things), this led into missing device initialisation. Iā€™ll add a check on the zone level to block zone initialisation until the device is linked and initialized -> pending
  • we get the events working in his setup with reverse proxy, found a bug in the ipFilter -> solved, now the binding has private IP address ranges as default (10/8, 192.168/16 and 172/12) to simplify setup and support those configurations out-of-the box

Finally itā€™s now working for @fifoā€™s setup (including inbound events / webbhooks), so we could move to the next level: user interface
The common goal is to create a HABpanel widget. For this we need some more changes

  • We need to verify which set of channels are really useful - providing information for the device + zone status, having some UI specific information, but donā€™t overload the user with channels noby needs or donā€™t provide consistent information,
  • The imageUrl provided by the API is more a key than a file. If you enter the url in the browser it brings up the image as a file to download, but if you use this url und a custom wight it shows the default picture. This needs to type of logic - call the link, download the image and then transform it - maybe as local file, but I donā€™t like the idea. So maybe other HABpanel developrs can help - this is not binding specific.
  • Implement and map more events (like water budget, rain skip) to channels so they can be processed by the UI.
  • alarming if unusual things happen (e.g. device went offline for a certain time). Some of it could be implemented just by using the expire biding (and provide a how-to)
  • Implement time zone handling (for now all timestamps are related to EDT)
    that will bring us to new ideas :slight_smile:

In regards to the binding / network level:

  • recover on internet connection problems - for now bridge goes down, but donā€™t recover when connection became available
  • https for webhook - this requires additional investigation. I canā€™t get the event, because jetty is refusing the certificate. Rachio support is involved, but still no break-through
  • @fifo will document his reverse proxy setup, which adds even more security

And in general: enhancing the documentation (e.g. full example of config) + some refactoring (already mostly done)

So: Donā€™t hesitate to raise other ideas for smart solutions by integrating other OH features / bindings.

Important. I opened up a new branch ā€˜alpha2ā€™. So if you want to get access to the latest build you can use this url: https://github.com/markus7017/org.openhab.binding.rachio/blob/alpha2/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar
Once done Iā€™ll go to post this build on the ESH ioT market place.

@KidSquid @Agbush @ranielsen @NCO @leadsrating @mjwedeking Do you want to try the latest build? Itā€™s getting pretty stable. Iā€™m interested to get broader test coverage and also improving the setup experience (incl documentation).

https://github.com/markus7017/org.openhab.binding.rachio/blob/alpha2/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar (please note: itā€™s a new branch ā€˜alpha2ā€™).

Does anyone already have a Generation 3 controller or the Rachio flow meter? I suppose they will be supported by the same api and would add additional feature to the binding (e.g. send an alarm when flow meter detects a leak).

Sprinkler system (v2) turned back on this weekend. Will download and look. Thank you for getting this far

basic steps for setup

  • obtain an appkey from the Rachio Website
  • create a rachio.things under /things

example:

Bridge rachio:cloud:1 [ apikey="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", pollingInterval=180]
{
}
  • copy the binding jar to addons folder
  • go to the openhab console and enable debugging:
log:set DEBUG org.openhab.binding.rachio
  • wait a minute
  • check that the bridge thing is online; PaperUI->Configuration->Things
  • Due to the fact that there will be many things/items generated it might be a good idea to enable simple mode for item linking (you could revert it after the thing discovers):
    PaperUI->Configuration->System->Item Linking, Simple Mode on
  • switch to PaperUI->Inbox, press the scan button, select Rachio binding
  • you should get 1 thing for the controller and 1 for each zone
  • make sure that the device thing is initialized and you see all zones
  • now you can go to PaperUI->Control and should see the device & zones status. Click on run and it should run a zone for 2 min (default).

You should allow the binding to receive events from the Rachio cloud. This has some pre-requisites - see README.MD
extending for events signalling (http webhook):

  • create a port forwarding on your router (myport to the OH device:8080)
  • add url to the bridge config
Bridge rachio:cloud:1 [ apikey="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", pollingInterval=180, callbackUrl="http://mydomain.com:myport/rachio/webhook", clearAllCallbacks=true ]
{
}
  • restart OH so everything gets initialized
  • check openhab.log for inconsistent parameters and errors

Let me know if you canā€™t get it up. Cheers, Markus

Hi Markus,

thanks for you effort.
I have soved my watering issue in a different way and cannot help testing your new version.
Sorry

thx for responding :slight_smile:

Markus,

Just wanted to give you a heads up that I have tested the webhook URL with a secure url and it is working as expected.

Do you mean https rather than http? Was that in your reverse proxy setup or directly? (I aleay had the problem that jetzy didnā€™t liked the certificate, but maybe they changed sthg).

I got it to work with https using a letsencrypt cert. Is your cert a self signed certificate? Could that be the issue?

Hi, itā€™s the inbound certificate, which doesnā€™t get accpred by jetty, because of cert chain issues - maybe they corrected it in between

Guess thatā€™s possible. I am still good on my end.

a new build is available at
https://github.com/markus7017/org.openhab.binding.rachio/blob/alpha2/target/org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar