Send Input to a Tile

So I’m currently working on an interface for my sprinkler system, and trying to determine how I should setup my SharpTools dashboard once it’s complete.

Effectively, I plan on having switches to control the different programs (e.g. Front Yard, Back Yard, Full Watering). I’d also like to have switches to control the various zones, but this gets a little more complex. Executing an irrigation program is easy, because it already has values for how long to run each zone. But if I’m manually running a zone, it requires that I provide a number of minutes to run the zone for.

What I’m thinking is to have a zone dashboard, with a tile for each irrigation zone. When you tap on the tile, it would start the zone (much like a switch). But how would I specify a zone runtime when activating it?

Any guidance is appreciated. Thanks!

@Pierce, can you show me the device handler you used for your sprinkler system or can you specific the run time as the command argument in Rule Engine when controlling which zone to water? See the the rule action below for example that I use a variable as the volume argument when asking Alexa to play something.

Am wondering if this can be achieved in the same way by creating a rule for each zone to water manually and use the variable to specify the run time if supported. Then you can add this number variable as a tile in the irrigation dashboard along with the rules created for each zone. Before you tap each zone to water, you can tap the variable tile to adjust the run time and then tap the specific rule tile to manually start watering.

1 Like

I’m actually in the process of writing the device handler(s) myself (in hubitat), so I can really do whatever I like with them. Hence why I’m asking about the dashboard now. If there’s a particular capability or method I can use within the handlers to facilitate the functionality I’m looking for, I’m sure it can be accommodated.

I’m still pretty new to SharpTools, which is why I’m looking for a little guidance now, instead of completely writing the device handlers and then realizing I should have done something differently to support a SharpTools dashboard.

2 Likes

If you don’t mind me asking, which irrigation system is it? @Justin_Leonard just wrote a really neat Rachio integration that provides a beautiful visual summary for his dashboard:

1 Like

Unfortunately, it’s not something as elegant as a Rachio. I have a Rainbird setup, which has a very limited API. I’m almost done with a Flask app that utilizes pyrainbird.

This will limit me to mostly executing programs or zones manually, doing anything more is too much headache. But I’m frequently turning on individual zones in the evenings where I see my lawn is a little dry, so being able to do that from my SharpTools dashboard would be awesome!

1 Like

Using the approach James mentioned above, you could define the method however you see fit as you could use SharpTools Variables along with the Rule Engine to send the custom commands.

In James’ example, he’s showing a custom searchSpotify() method that’s not defined by any official capabilities. But he can use a Variable tile on the dashboard to allow for custom input and have the change of that variable trigger a rule which runs the custom command (using the variable as an input).

Here’s an example:

From top-to-bottom, the layout is:

  • Variable: $SprinklerZone (numeric)
  • Variable $WateringDuration (numeric)
  • Rule: Custom rules for starting and stopping the watering
    • The Start Watering rule would use the $SprinklerZone and $WateringDuration variables when calling whatever custom method you expose for manually running a zone.
1 Like

Ok, cool. I was going a bit of a different direction; Basically adding a device for each zone and each program (up to 12 and 3 respectively). But I could just add a “zones” device and a “programs” device, and use the method you outlined above. I’ll give that a shot and report back.

Thanks!!

2 Likes

In theory, you could do it with a single master device. Then have it expose custom commands like:

  • runZone(zoneId, duration)
  • stopIrrigation()
  • runProgram(program)

And you could optionally add child devices for each ‘zone’ if you had a need for that elsewhere - that sometimes makes it easier to use these zones in other simple apps that expect a Switch or something similar. So you could simply flip the switch ‘on’ in whatever app and it would run a default duration. The challenge here is usually managing the state of each of these switches - making sure the parent keeps the switch state in sync so two different ‘child’ zones don’t visually show as if they’re running when it’s not physically possible.

1 Like

Also a good idea. I think I may go that route; A single device with custom commands. Didn’t have much time to work on it today, but I’m going to try to get the SharpTools dashboard laid out tonight, and work on the device/API later this week.

On the former’s note, is there a method for setting the label of a tile to a variable? For example, I’m using a variable adjustment tile to set the zone almost exactly like you have above, but setting the label of that tile to the zone name would be very helpful. (e.g. Zone 1 == Street, Zone 2 == Front Yard South, Zone 3 == Front Yard North, etc)

I have three variables created so far, $irrigationDuration, $irrigationZone, and $irrigationZoneName. I can set $irrigationZoneName through rules, but being able to display the variable’s value in the zone adjustment tile would be great.

Thanks!

So I’ve got this working. Thanks @josh for the guidance. I moved from creating a device per zone/program to a single controller device that exposes the runZone, runProgram, and stopIrrigation commands. What I was missing was how to use rules/variables for this interaction.

Here’s a screen shot of the first dashboard I worked up (which is very similar to josh’s):

As you can see, I’m using separate tiles to display the zone/program names, which I’m setting in variables via simple custom rules. If it were possible to set these variables ($irrigationZoneName, $irrigationProgramName) as labels, I could remove the dedicated tiles completely, which I would prefer.

Otherwise, I’m happy with the result. Thanks for the help!

2 Likes