[ANSWERED]Custom sprinkler device

Posted on
Tue Aug 26, 2014 1:02 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

[ANSWERED]Custom sprinkler device

Hello,

I'm working on a sprinkler plugin, and had a look on the SDK example.
If the property OverrideScheduleActions is set to True, the overall sprinkler actions have to be managed by the plugin. When a schedule is started through the RunNewSchedule action, what is the way of working regarding the sprinkler properties ? Do I have to update the zoneScheduledDurations and activeZones properties, or is it managed by the Indigo Server ?

Regards,

Julien

Posted on
Tue Aug 26, 2014 4:02 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Custom sprinkler device

Indigo will handle zone durations for you since it will get those from the user directly. You manage the activeZone in the ZoneOn action handler - basically, you do whatever you need to do to tell the sprinkler device which zone to activate, then when you get confirmation (hopefully) you update the activeZone state (see line 59 in the example plugin):

Code: Select all
# And then tell the Indigo Server to update the state.
dev.updateStateOnServer("activeZone", action.zoneIndex)

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 27, 2014 11:29 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Custom sprinkler device

I think in this case Julien is asking how to handle the higher level commands since he is setting OverrideScheduleActions to True.

In that case then in addition to updating the activeZone state, you do also have to manage the properties as well: PreviousZoneDurations, ScheduledZoneDurations, and PauseScheduleZoneIndex. I believe the example in the SDK is pretty complete and shows what to update, so look at that in detail. If you have questions about what the SDK example is doing then let me know.

Image

Posted on
Wed Aug 27, 2014 1:45 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [ANSWERED]Custom sprinkler device

LOL - True != False...

Sorry!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 27, 2014 2:17 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

Thanks guys. That's clear.

2 more questions :
- how have I to manage the new pausedScheduleRemainingZoneDuration property ?
- what is the difference between the StopSchedule and AllZonesOff actions ?

An other point : I have a strange behavior, and I don't know if it's on my side or on your side. When I update the activeZone state with an integer, the new value is stored as a string ... I don't find in my code where could be the mistake, so perhaps it's on your side ... If you can check ?

Julien

Posted on
Fri Aug 29, 2014 10:48 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Custom sprinkler device

Hi Julien,

Juju wrote:
how have I to manage the new pausedScheduleRemainingZoneDuration property ?

You'll want to update the pluginProps["PauseScheduleRemainingZoneDuration"] value for that. I just posted an update to the SDK (1.2.2) Example Sprinkler plugin that shows roughly how/when to set PauseScheduleRemainingZoneDuration (pretty much the exact places PauseScheduleZoneIndex is used). The value is just as a place the plugin can store the remaining zone duration for the activeZone when it is paused, such that it knows on resume to use that duration. Because you have OverrideScheduleActions set to True you'll have to calculate what the remainingZoneDuration value should be manually.

Note that IndigoServer has a buglet in the python object model so that the dev.pausedScheduleRemainingZoneDuration attribute does not mirror the dev.pluginProps["PauseScheduleRemainingZoneDuration"] property. They should always be the same, but in the case of OverrideScheduleActions being True the value isn't reflecting on the device instance property correctly. That will be fixed in the next release of Indigo, but in the mean time you can just access it via dev.pluginProps[] which is what the SDK example does.

Juju wrote:
what is the difference between the StopSchedule and AllZonesOff actions ?

If I remember correctly,

if OverrideScheduleActions is False:

• AllZonesOff will be called whenever Indigo Server's logic determines no zones should be on (user presses stop schedule, a schedule ends, user pauses a schedule, etc.)
StopSchedule is never called since Indigo Server handles the higher level scheduling

else if OverrideScheduleActions is True:

StopSchedule will be called whenever user stops an actively running schedule
StopSchedule will also be called if user turns off the zones when no schedule is running (ex: they manually selected a zone when no schedule was running, then press stop)

I'm not 100% positive on the last one though, in that case AllZonesOff might be dispatched instead. I'd have to just try it to see.

Juju wrote:
When I update the activeZone state with an integer, the new value is stored as a string ... I don't find in my code where could be the mistake, so perhaps it's on your side

Should be an integer. I tried it with the example plugin and never saw it become a string. Let me know if you come up with steps to reproduce the problem.

Image

Posted on
Thu Sep 04, 2014 4:17 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

OK thanks Matt for your detailed explanations.

I have just finished a new version of my plugin, and everything works perfectly.

Julien

Posted on
Mon Nov 09, 2015 2:15 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

Hello guys,

Another question : I don't understand how I have to manage to take into account the multiply duration variable.
The information (the variable or its value) is not contained in the action dict, and the values from the zoneDurations key have not been multiplied.

Julien

Posted on
Mon Nov 09, 2015 7:44 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Custom sprinkler device

Hi Julien,

The variable ID should have been included in the action, but it wasn't. It will be in a future version of Indigo as action.multiplierVarId.

Image

Posted on
Tue Nov 10, 2015 1:07 am
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

Ok, I Will prepare the code and wait for the update.
Just to be sure : multiplierVarId will be None if the checkbox is not ticked in the sprinkler schedule UI ?

Posted on
Tue Nov 10, 2015 7:19 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Custom sprinkler device

It should be None but to be safe you might also want to check for integer 0.

Image

Posted on
Tue Nov 10, 2015 1:29 pm
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

Ok thanks Matt.

Posted on
Thu Jan 21, 2016 2:06 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]Custom sprinkler device

The new multiplierVarId attribute is now available in v6.1.5.

Image

Posted on
Sat Jan 23, 2016 9:34 am
Juju offline
User avatar
Posts: 108
Joined: Aug 31, 2011
Location: Toulouse - FRANCE

Re: [ANSWERED]Custom sprinkler device

Thanks !

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 15 guests