Rachio Smart Sprinkler Controller

org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (251.6 KB)
with zone->run

with reduced debugging on refresh and some more typos in thing definition fixed
org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (251.7 KB)

last build for today

  • fixes thing definition, use String instead of Text - now all Text field became valid channels
  • channel imageUrl added - that’s the image of the zone, which could be set in the App

org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (251.8 KB)

Have installed the latest version and I can confirm that I can start my zones with the RUN ZONE channel.

  • When turning the RUN ZONE channel on, the zone starts as expected. Turning the zone off has no effect. The zone will run for the length of the default time and then turn off. Is this an expected result? If so the documentation should probably show to use the AUTOUPDATE=FALSE so that there is only a push button to start, otherwise people will expect the switch to turn the zone back off.

Now that you have the DEFAULT RUN TIME in the bridge THING. What do I need to add to my .thing file so I can adjust the Default Run Time? What should the name of the variable be?

  • Question about logic - what happens if a user switches zones 1-4 all on at the same time using the ZONE RUN channels? Will the binding start and stop them in sequence or is that something the API will cue up? Most systems can’t handle multiple zones running concurrently, just want to make sure this is a safeguard in to prevent damage to the system.

More testing when I have some daylight.

Great Work!

Squid

Just started seeing this


Funny thing - I can still send commands
when I turn the system into STANDBY mode, the online portal still updates!

Squid

org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (252.5 KB)

The defaultRuntime is set in the bridge configuration:

Bridge rachio:cloud:1 [ apikey="xxxxxxxx", pollingInterval=30, defaultRuntime=120 ]
{
}

Zone level:
I change the zone’s run switch in the following way:

  • ON: the runTime channel could be used to set the desired runtime, the defaultRuntime will be used when runTime is 0
  • OFF: watering will be stopped on the device level even that’s not correct, because the function belongs the zone level. However, the API doesn’t supply the functionality to stop a single zone.

Device level:
The controller can run multiple zones at the same time (also supported by the App). We have 4 channels to control that:

  • runZones is a comma separated list of the zones to start, e.g. 1,5,7. If empty ALL zones will be started.
  • runTime acts the same way as for the zone. The defaultRuntime will be used when runTime is 0, otherwise the selected runTime applies to all zones.
  • run starts the watering process for runTime seconds.
  • stop ON: stop all watering for the device (will be flipped automatically to OFF position after API command is executed)
  • stop OFF: no function

In fact you need to use a rule to fully utilize the function:

rachio_xxxx_runZones.sendCommand("1,3,5")
rachio_xxxx_runTime.sendCommand(600)
rachio_xxxx_run.sendCommand(ON)

I was thinking to combine run and stop, but I’m note sure if this doesn’t mess up the function on the zone level.

The COMMUNICATION ERROR is caused by an Exception. If need the log to find out what’s going on.

I still need to look to “Show More
” Where to set AUTOUPDATE=FALSE to make it a push button?

For the AUTOUPDATE Function, you place the command in the item file.

Switch RtGarageDr "Right Garage Door" [ "Switchable" ] { channel="zwave:device:xxxxxxx:nodex:switch_binary",expire="1s,command=OFF",autoupdate="false" }

and then place a mapping in your sitemap file:

Switch item=RtGarageDr icon="garage" mappings=[ON="OPEN/CLOSE"]

Squid

did you tried the new binding with run/stop zone and device?

Yes, all of my notes were from running the latest version of the binding.

I’ve only had the opportunity to start a zone. I have not started a group of zones via the controller yet.

Squid

got my first event callback. However, the complete input format is not documented and I’m not sure if it makes sense to invest the time.

org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (253.7 KB)

This version registers a callback handler to the Rachio cloud. It requires a proper setup of your local router. I did the following:

  • the router registers its dynamic ip with a dyndns service
  • I created a port forwarding for external port 10080 to openhab:8080
  • the binding registers the url /rachio/webhook
  • the callback url is configured for the bridge thing
 Bridge rachio:cloud:1 [ apikey="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", callbackUrl="http://myopenhab.com:10080/rachio/webhook", pollingInterval=30, defaultRuntime=120 ]
 {
 }

For each event the Rachio cloud will send a http call to http://myopenhab.com:10080/rachio/webhook. The json is parsed and event is displayed in the log file.

The next step is to use those events as a trigger, supply the information to a channel and maybe process the received information.

Does that setup work for you? We should come to the same level, so I could move forward with implementation and we could make sure it also runs in your environment.

Hi Markus -

I can certainly set up a dynamic dns provider and as well as the port forwarding in my router, but I believe a further discussion needs to be had. Doing what you are suggesting will open up your local OpenHab installation to the Internet without any type of security. With that said, anyone who came upon the address could possibly operate any items controlled by OpenHab or even worse possibly inject code or look in on your environment if the server where OpenHab was installed was not sufficiently secured.

I think if you want to make this a binding to a wide range of users the technical and security requirements may be a sticking point for some.

From the reading I have done in this forum, there currently is no way to secure OpenHab with usernames and passwords unless you run through some type of reverse proxy which adds another layer of technical hurdles.

One other option may be if a user has a router or other firewall that is rules-based and you can specify to only allow inbound traffic from a certain IP Address or URL that may offer more comfort than leaving the entire installation open to the Internet at large.

What are your thoughts???

Squid

yep, I already mentioned this challenge. The problem with webhooks or REST interfaces is that they are stateless an most of them doesn’t supply authentication. Rachio requires an access token to get access to the cloud api and provides a application defined “externalId” back to the webhook. I’ll use that for two purposes
a) Map the event to the corresponding bridge device and
b) include some kind of binding specific token that can be validated before processing the event

Nevertheless that doesn’t solve the problem to open your OH node to the internet. Currently I just used a http callback and will try to switch to https (didn’t worked initially), which helps to protect the exchanged data. Anything further (even userid+password) would require that Rachio supports that at their side. You may remember: that was what I mentioned above and a reasons to use polling beside events, so the user has a limited functionality, but doesn’t need to deal with port forwards and securing his installation. Obviously the API doesn’t provide the functions to poll that data, e.g. you don’t get the start/stop events if you don’t use the event interface.

Hi,

The event stuff is making progress:

  • Various event types are processed
  • Information goes to the log
  • run switch gets automatically OFF when watering stops
2018-02-18 20:55:38.714 [DEBUG] [.r.handler.RachioBridgeHandler:129  ] - RachioBridgeHandler: refreshDeviceStatus
2018-02-18 20:55:42.600 [DEBUG] [.b.r.handler.RachioZoneHandler:114  ] - RachioZone.handleCommand ON for rachio:zone:1:F0038CC690BE-2:run
2018-02-18 20:55:42.601 [DEBUG] [.b.r.handler.RachioZoneHandler:135  ] - RachioZone: No specific runtime selected, using default (120 secs);
2018-02-18 20:55:42.601 [INFO ] [.b.r.handler.RachioZoneHandler:137  ] - RachioZone: Starting zone #2 for 120 secs
2018-02-18 20:55:42.601 [INFO ] [.rachio.internal.api.RachioApi:232  ] - RachioApi: Start zone '58268c21-8056-4835-928a-a165f44971e8' for 120 sec.
2018-02-18 20:55:45.775 [INFO ] [.b.r.handler.RachioZoneHandler:175  ] - RachioZone: Event for zone 'Rechts': Watering Rechts for 2 minutes (status=STARTED, duration = 120sec)
2018-02-18 20:55:45.783 [INFO ] [.r.handler.RachioDeviceHandler:217  ] - RachioDevice 'Rachio-Golf'n Sun': schedule'manual schedule' started (type=MANUAL, estimatedDuration = 120sec) - Started manual schedule for 2 minutes
2018-02-18 20:57:46.053 [INFO ] [.r.handler.RachioDeviceHandler:217  ] - RachioDevice 'Rachio-Golf'n Sun': schedule'manual schedule' completed (type=MANUAL, estimatedDuration = 120sec) - Completed manual schedule for 2 minutes
2018-02-18 20:57:49.002 [INFO ] [.b.r.handler.RachioZoneHandler:186  ] - RachioZone: DELTA Event for zone 'Rechts': UPDATE
2018-02-18 20:57:49.003 [INFO ] [.b.r.handler.RachioZoneHandler:175  ] - RachioZone: Event for zone 'Rechts': Watered Rechts for 2 minutes (status=ZONE_COMPLETED, duration = 120sec)
2018-02-18 20:57:49.003 [DEBUG] [.b.r.handler.RachioZoneHandler:189  ] -     electricalCurrentOff: old=-12, new=-11
2018-02-18 20:57:49.003 [DEBUG] [.b.r.handler.RachioZoneHandler:189  ] -     lastWateredDate: old=1518982892742, new=1518983864378
2018-02-18 20:57:49.003 [DEBUG] [.b.r.handler.RachioZoneHandler:189  ] -     lastUpdateDate: old=1518982892859, new=1518983864524
2018-02-18 20:57:49.003 [DEBUG] [.b.r.handler.RachioZoneHandler:189  ] -     lastWateredDuration: old=32, new=120
2018-02-18 21:01:29.613 [DEBUG] [.b.r.handler.RachioZoneHandler:114  ] - RachioZone.handleCommand OFF for rachio:zone:1:F0038CC690BE-2:run
2018-02-18 21:01:29.613 [INFO ] [.b.r.handler.RachioZoneHandler:140  ] - RachioZone: Stop watering for the device
2018-02-18 21:01:31.061 [INFO ] [.rachio.internal.api.RachioApi:175  ] - Watering stopped for device 'bac64a79-c4a0-49cb-932c-fc7a08635350'
2018-02-18 21:01:34.970 [DEBUG] [.b.r.handler.RachioZoneHandler:114  ] - RachioZone.handleCommand ON for rachio:zone:1:F0038CC690BE-2:run
2018-02-18 21:01:34.970 [DEBUG] [.b.r.handler.RachioZoneHandler:135  ] - RachioZone: No specific runtime selected, using default (120 secs);
2018-02-18 21:01:34.970 [INFO ] [.b.r.handler.RachioZoneHandler:137  ] - RachioZone: Starting zone #2 for 120 secs
2018-02-18 21:01:34.970 [INFO ] [.rachio.internal.api.RachioApi:232  ] - RachioApi: Start zone '58268c21-8056-4835-928a-a165f44971e8' for 120 sec.
2018-02-18 21:01:37.451 [INFO ] [.b.r.handler.RachioZoneHandler:175  ] - RachioZone: Event for zone 'Rechts': Watering Rechts for 2 minutes (status=STARTED, duration = 120sec)
2018-02-18 21:01:37.452 [INFO ] [.b.r.handler.RachioZoneHandler:178  ] - RachioZone: Watering started for zone 'Rechts'.
2018-02-18 21:01:37.456 [INFO ] [.r.handler.RachioDeviceHandler:217  ] - RachioDevice 'Rachio-Golf'n Sun': schedule'manual schedule' started (type=MANUAL, estimatedDuration = 120sec) - Started manual schedule for 2 minutes
2018-02-18 21:03:37.234 [INFO ] [.b.r.handler.RachioZoneHandler:175  ] - RachioZone: Event for zone 'Rechts': Watered Rechts for 2 minutes (status=ZONE_COMPLETED, duration = 120sec)
2018-02-18 21:03:37.234 [INFO ] [.b.r.handler.RachioZoneHandler:180  ] - RachioZone: Zone stopped watering (ZONE_COMPLETED).
2018-02-18 21:03:37.245 [INFO ] [.b.r.handler.RachioZoneHandler:188  ] - RachioZone: DELTA Event for zone 'Rechts': UPDATE
2018-02-18 21:03:37.245 [DEBUG] [.b.r.handler.RachioZoneHandler:191  ] -     electricalCurrentOff: old=-11, new=-12
2018-02-18 21:03:37.246 [DEBUG] [.b.r.handler.RachioZoneHandler:191  ] -     lastWateredDate: old=1518983864378, new=1518984216255
2018-02-18 21:03:37.246 [DEBUG] [.b.r.handler.RachioZoneHandler:191  ] -     lastUpdateDate: old=1518983864524, new=1518984216421
2018-02-18 21:03:39.252 [INFO ] [.r.handler.RachioDeviceHandler:217  ] - RachioDevice 'Rachio-Golf'n Sun': schedule'manual schedule' completed (type=MANUAL, estimatedDuration = 120sec) - Completed manual schedule for 2 minutes

More data can go back to the channels (the event itself, watering duration etc.).
I’m thinking

How to proceed?

I updated the binding

  • removed most channels with static information (still in the code, but disabled)
  • processing webhooks to receive several kinds of events
  • event channel added
  • some cleanups

@KidSquid: You thoughts on the security topics. I tried again to enable https, but in this case I don’t receive any callbacks :frowning:

@Agbush , @ranielsen, @NCO, @ashley_stovall: Does someone else like to give it a try.

I would like to give it a try. How do I get the latest to try out?

@markus7017

Sorry for the lack of reply’s I’m traveling and should be sble to look st things next week.

Squid

no problem, I’m traveling the upcoming week, so take your time :wink:

Hi Matthew, this is the latest development snapshot.
org.openhab.binding.rachio-2.3.0-SNAPSHOT.jar.zip.pdf (262.1 KB)

Go to the Rachioportal and create/copy the Api Key.

Create a rachio.things file under things/

Bridge rachio:cloud:1 [ apikey="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx",  pollingInterval=60, defaultRuntime=120  ]
{
}

make sure to set the right api-key matching your setup.

Unpack and copy the .jar to the addons folder in your OH installation. The binding should immediatly start checking your installation data once the bridge thing is initialized (Check PaperUI->Configuration->Things, the bridge thing must be ONLINE).
Wait a minute go to Inbox and run a scan on the Rachio Service. You should receive 1 thing for each controller and one for each zone (the binding supports multiple controllers). Each thing provides device or zone-based channels, which can be configured. Go to PaperUI->Control to see the result.

If everything is running you may want to try the event interface you need to add the following to the bridge definition:
callbackUrl=“http://yourdomain.com:yourport/rachio/webhook”
Make sure that yourdomain:yourport will be routed to the OH node.

If you see errors send me the corresponding log file entries, maybe separate them to a single rachio.log (see way up in this thread for details).

Thanks Markus. It seems to be working ok. The only thing I don’t see being populated is the zone image URL. Also I’m not a fan of opening a port to my openHAB server, there must be another way.