openSprinkler Binding: How to set nextDuration (Basic UI, sensCommand, Jython

Hi there,

i try to set the nextDuration channel of the openSprinkler binding. The corresponding item is a Number:Time item and i did not manage to set the value.

I get errors like that: “Ignoring implausible non-QuantityType command for NEXT_DURATION” using the Basic UI with selection or Setpoint

Trying a sendCommand gives me a NumberFormatException: java.lang.NumberFormatException in Jython.

Has anyone an idea?

Are you using the correct syntax (Selection) in your sitemap?

Selection item=Station03NextDuration mappings=[300="5 min", 600="10 min"]

Would help if you provide the configuration for all associated openSprinkler issues.

Using this selection statement

Selection item=RB_BM_SC_SprinklerValve01_NextDuration label="Laufzeit [%d %unit%]" mappings=[300="5 min", 600="10 min"]

leads to this error

2020-06-27 20:00:36.938 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '600' of item RB_BM_SC_SprinklerValve01_NextDuration with format '%.0f %unit%': Conversion = 'u'

Modifying the selection to

Selection item=RB_BM_SC_SprinklerValve01_NextDuration label="Laufzeit [%d min]" mappings=[300="5 min", 600="10 min"]

brings up the following

2020-06-27 20:06:18.100 [INFO ] [.handler.OpenSprinklerStationHandler] - Ignoring implausible non-QuantityType command for NEXT_DURATION

Did you try:

Selection item=RB_BM_SC_SprinklerValve01_NextDuration label="Laufzeit" mappings=[300="5 min", 600="10 min"]

Tried it, did not work get the following error

2020-06-27 20:25:04.785 [INFO ] [.handler.OpenSprinklerStationHandler] - Ignoring implausible non-QuantityType command for NEXT_DURATION
2020-06-27 20:25:04.794 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '600' of item RB_BM_SC_SprinklerValve01_NextDuration with format '%s %unit%': Conversion = 'u'
2020-06-27 20:25:04.817 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '3300' of item RB_BM_SC_SprinklerValve01_NextDuration with format '%s %unit%': Conversion = 'u'

The Second error come from the current value. unfortunately i have no idea how to set the value with a sendCommand

Wonder where it gets NEXT_DURATION from? I assume you have the items defined similar to the doc’s?

Switch Station01 (stations) { channel="opensprinkler:station:http:01:stationState" }
Number:Time Station01RaminingTime { channel="opensprinkler:station:http:01:remainingWaterTime" }

That right acording to the docs. There is a channel for Next_Duration. The channel definition ist not the problem, because it is copied from the thing.

The problem ist how to send a proper value to a Number:Time item.

This worked for me…

Number:Time           Test_Number_5           "Test Number 5 [%.0f s]"
events.sendCommand("Test_Number_5", "5")
Selection item=Test_Number_5 mappings=[5="5 s", 10="10 s", 60="1 minute"]

Didn’t work either. Got still

2020-06-28 09:46:29.861 [INFO ] [.handler.OpenSprinklerStationHandler] - Ignoring implausible non-QuantityType command for NEXT_DURATION

So i assume the there is something wrong with the openSprinkler binding. I will open an issue on that.

I’m not 100% certain, but it looks like this bug was addressed but not released yet:

I have the same issue. For scripting, I found that the binding will accept a duration value from a postUpdate, but not a sendCommand.

From my point of view there was a problem, but it causes a java error. I get and info message. So iopened an issue on that.

Your hint to use a postUpdate does not work for me. The next duration switches for two or three second to the desired value, but than back to aroun 50 minutes.

It’s an odd one - the postUpdate command avoids the exception for me, but no matter what value I set (and verify through the API), when I activate the zone the duration is always 18 hours.

The same code was working fine a day ago, now it’s not. Something’s up with the binding for sure.

1 Like

I’ve been using OpenSprinkler for about a month now, including weather adjustments. I am using HABPanel and Sitemaps/BasicUI without issue. I am using a Setpoint for the NextDuration items, and I am able to use sendCommand(duration) without issue from rules as shown below.


Switch vStation01RunStatus "Zone 1 Run Status [MAP(]"   <status>        (gSprinkler, gSprinklerZones, Group_HabPanel_Dashboard)
Switch vStation01Queued "Zone 1 Queue Status [MAP(]"  <status>        (gSprinkler, Group_HabPanel_Dashboard) 
Number:Time vStation01RemainingTime "Zone 1 Running Time"                               <time>          (gSprinkler, Group_HabPanel_Dashboard) 
Number:Time vStation01NextDuration "[%.0f s]"                                           <time>          (gSprinkler, gSprinklerDurationMin, Group_HabPanel_Dashboard) 
Number:Time vStation01NextDurationMin "[%.0f min]"                                      <time>          (gSprinkler, gSprinklerDurationMin, Group_HabPanel_Dashboard) 


  Setpoint item=vStation01NextDurationMin label="Zone 1 Next Duration[%.0f min]" minValue=0 maxValue=35 step=1 icon="water"

I am running OH2.5.4 with OpenSprinkler2.5.6 and everything is working great so far, exceeding my expectations. Perhaps what I’m doing will provide additional insight and a workaround for your issues.


 Member of gSprinklerDurationMin changed
  var durationMin = vStation01NextDurationMin.state as Number
  var durationSec = (durationMin*60)/60

  durationMin = vStation02NextDurationMin.state as Number
  durationSec = (durationMin*60)/60

  durationMin = vStation03NextDurationMin.state as Number
  durationSec = (durationMin*60)/60

  durationMin = vStation04NextDurationMin.state as Number
  durationSec = (durationMin*60)/60

  durationMin = vStation05NextDurationMin.state as Number
  durationSec = (durationMin*60)/60

  durationMin = vStation06NextDurationMin.state as Number
  durationSec = (durationMin*60)/60

Thanks for your feedback. Firts view does not show any unusual differences. I don’t understand your durationSec calculation. You multiply the minutes by 60 and then you divide by 60. Technicalls you do nothing with the minutes.

Yes I know that is odd, and probably not required but it works to generate a pure number without units and so I just left it. When I get more time I’ll play with this a bit more and improve the code.

Have you tried to define the Minutes Duration as a pure Number?

Not yet. As I said I have only been using opensprinkler for about a month, and this was my initial code to get NextDurations functioning in both HABPanel and sitemaps. As I get more time I will explore further, but right now everything is working as it should and with the heat of summer upon us, I’m reluctant to fix what isn’t broken. However I am always tinkering, so I’m sure this will be improved with time. I guess the point of my contribution here is that I don’t have any issues with the binding or using sendCommand to set NextDuration, so I’m not sure it is a binding bug.

1 Like

I don’t quite understand it yet, but this works for me:


Number:Time z03_Next_Duration	"Property Line [%s]" 		{ channel = "opensprinkler:station:a6b82ecf:nextDuration" }`


Selection item=z03_Next_Duration mappings=['300 s'="5 min", '1200 s'="20 min"]

Sending the values over as ‘300 s’ instead of 300 gets past the:

Ignoring implausible non-QuantityType command for NEXT_DURATION

…error for me. There seems to be some other side effects, like my sitemap doesn’t display the next_duration value that has been selected, but I’m sure it’s all wrapped up in a unit conversion somewhere.

This also works in Jython for me:

events.sendCommand(ir.getItem('z03_Next_Duration'), '120 s')

…where this does not:

events.sendCommand(ir.getItem('z03_Next_Duration'), 120)

I didn’t get it. now it is workin and the only thing i changed is to install the corona binding …

Thanks for your help

Has anyone an idea how to a setpoint instead of a selection with quantity types?

@Dibbler42 You must have missed this in my post above because I didn’t explicitly call it it out as part of my sitemap, but this setpoint works for me. I have set a max time of 35 mins and increments of 1 min.