Page 1 of 1

Creating a sprinkler device

PostPosted: Thu Mar 09, 2023 5:55 pm
by siclark
I'm struggling a bit with trying to create and update a sprinkler device. I've got my relay and sensors working but hit a block now.
How can I update the zoneCount and zoneNames which I want to do programmatically based on the results of the API (along with some other details)
However the instructions say they aren't writable and dev.replaceOnServer() doesn't work as I get error on dev.zoneCount"12

I'm sure I'm needing something obvious but I'm new to this.

Cheers. Simon

Re: Creating a sprinkler device

PostPosted: Fri Mar 10, 2023 9:58 am
by jay (support)
Just to confirm/close this, you figured this one out by looking at the Rachio plugin, right?

Re: Creating a sprinkler device

PostPosted: Fri Mar 10, 2023 10:19 am
by siclark
Yes. Many other questions about the Rachio plugin as without a Rachio API key it's a bit hard to step through and understand, bit solved this question.
Thanks

Re: Creating a sprinkler device

PostPosted: Tue Mar 21, 2023 5:16 pm
by siclark
Hi Jay.
Could you help with how to add onState to a sprinkler. I see your toggleStandbyMode method uses if dev.onState: but I can’t get my sprinkler device to accept supporting it and I think testing the rachio plug-in with json code from the rachio API docs, the rachio errors on that line too.
I can use setstandbyMode for my purposes but trying to understand more.

Thanks. Simon

Re: Creating a sprinkler device

PostPosted: Wed Mar 22, 2023 12:05 pm
by jay (support)
Sprinkler devices have no onState, so that action will not work correctly (it's a bug). Looking at the github commit log, it was added after I stopped working on it.

In terms of how your plugin works, you'll need to evaluate other states that your sprinkler device can be in to determine if it's on or off, then do the appropriate thing based on those factors. You can add it as a custom state that you manage whenever other state changes are made which would change your custom on status state.

Re: Creating a sprinkler device

PostPosted: Wed Mar 22, 2023 12:57 pm
by siclark
Haha and there was I thinking that because it was a plug-in by you that it had to be something that worked!
Yes I am using a custom state for standby now.