Gardena: Set duration for Water Control / Mower doesn't work

I’m having some troubles setting the duration for my Gardena Smart System Water Control. I want it to open the valve for e.g. 20 mins but the duration goes back to 60 mins right after turning the switch ON. Same for the Sileno Mower.

I have used the documentation / example, but it doesn’t work.

I’ve tried to set the duration of
to 20mins via
—The value of duration changes to 20.

To start watering, I set
to ON via
—After this, the duration from above changes from 20 to 60 and the valve is open for 60 mins instead of 20.

What am I doing wrong? Have done a lot of research but I wasn’t able to find a solution…

I very appreciate your help. Thanks!

As I can see you are using the wrong channel for the duration. Use „valve_commands#commandDuration“ instead of

Note that after restarting OH, this item will go back to 60min.

I‘ve created a new „dummy“ Item with the duration (which is persists) and before the start_seconds_to_override command I set the commandDuration with the value of the dummy item

My bad, I have used “valve_commands#commandDuration” and not “valve#Duration”. Just checked again. Sorry.

I just created a dummy item too and setting duration to the desired value works fine but every time I send “ON” to valve_commands#start_seconds_to_override, the value is overridden with 60.

Hmm strange… can you post your item file (and if existing, rule file)?

Sure. I’ve cut it down to the relevant parts. Thanks in advance!

Items file:

Switch gardena_water_drip_start_stop "Start Watering" <none> //A dummy switch to manually turn on and off watering process
Number gardena_water_drip_irrigation_duration "Irrigation Dauer [%f]" <none> {channel="gardena:water_control:35xx55:valve_commands#commandDuration"}
Switch gardena_water_drip_open_valve_with_duration "Öffnen mit Dauer" <none> {channel="gardena:water_control:35xx55:valve_commands#start_seconds_to_override"}
Switch gardena_water_drip_close_all_valves "Stop" <none> {channel="gardena:water_control:35xx55:valveSet_commands#stop_until_next_task"}

Rules file:

rule "Gardena Water Control 15 mins"
    Item gardena_water_drip_start_stop received update
    if(gardena_water_drip_start_stop.state==ON) {
        //Start Watering for e.g. 15 mins
    else if(gardena_water_drip_start_stop.state==OFF) {
        //Stop Watering
    else {
        logError("error", "error")

Funny. I’m getting an error in Log Viewer now. Haven’t seen it before.

Here is the log:

2020-05-27 00:16:47.921 [ome.event.ItemCommandEvent] - Item 'gardena_water_drip_start_stop' received command ON

2020-05-27 00:16:47.934 [vent.ItemStateChangedEvent] - gardena_water_drip_start_stop changed from OFF to ON

2020-05-27 00:16:47.966 [ome.event.ItemCommandEvent] - Item 'gardena_water_drip_irrigation_duration' received command 15.0

2020-05-27 00:16:47.988 [ome.event.ItemCommandEvent] - Item 'gardena_water_drip_open_valve_with_duration' received command ON

==> /var/log/openhab2/openhab.log <==

2020-05-27 00:16:47.988 [WARN ] [internal.handler.GardenaThingHandler] - org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType

java.lang.ClassCastException: org.eclipse.smarthome.core.library.types.DecimalType cannot be cast to org.eclipse.smarthome.core.library.types.QuantityType

	at org.openhab.binding.gardena.internal.handler.GardenaThingHandler.handleCommand( [bundleFile:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]

	at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:1.8.0_222]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:1.8.0_222]

	at java.lang.reflect.Method.invoke( ~[?:1.8.0_222]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect( [bundleFile:?]

	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke( [bundleFile:?]

	at com.sun.proxy.$Proxy479.handleCommand(Unknown Source) [?:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand( [bundleFile:?]

	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem( [bundleFile:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_222]

	at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:1.8.0_222]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:1.8.0_222]

	at java.lang.reflect.Method.invoke( ~[?:1.8.0_222]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect( [bundleFile:?]

	at [bundleFile:?]

	at [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:1.8.0_222]

	at java.util.concurrent.ThreadPoolExecutor$ [?:1.8.0_222]

	at [?:1.8.0_222]

==> /var/log/openhab2/events.log <==

2020-05-27 00:16:48.006 [nt.ItemStatePredictedEvent] - gardena_water_drip_irrigation_duration predicted to become 15.0

2020-05-27 00:16:48.048 [nt.ItemStatePredictedEvent] - gardena_water_drip_open_valve_with_duration predicted to become ON

2020-05-27 00:16:48.061 [vent.ItemStateChangedEvent] - gardena_water_drip_irrigation_duration changed from 60 to 15.0

2020-05-27 00:16:48.064 [vent.ItemStateChangedEvent] - gardena_water_drip_open_valve_with_duration changed from OFF to ON

2020-05-27 00:16:53.007 [vent.ItemStateChangedEvent] - gardena_water_drip_open_valve_with_duration changed from ON to OFF

2020-05-27 00:16:53.508 [vent.ItemStateChangedEvent] - gardena_water_drip_activity changed from CLOSED to MANUAL_WATERING

2020-05-27 00:16:53.526 [vent.ItemStateChangedEvent] - gardena_water_drip_duration changed from 0 to 60

2020-05-27 00:16:53.530 [vent.ItemStateChangedEvent] - gardena_water_drip_irrigation_duration changed from 15.0 to 60

Found the reason for the error which solves the problem:
I’ve set %f instead of %d for “:valve_commands#commandDuration” in items file.

1 Like

Perfect! Thanks for sharing your solution… I didn’t see that!

@jwsp1: Thank ou so much for your posts, they helped me a lot to get my Gardena stuff working.

One small thing I found: Define [%d min] for “:valve_commands#commandDuration” in items file.
Before I got error:

failed: class org.openhab.core.library.types.QuantityType cannot be cast to class org.openhab.core.library.types.DecimalType

Hi all, perhaps not the right place to post but i have a very close issue with gardena binding.
I have exactlty the same problem with duration command but with “mower” thing : “mower_commands#commandDuration”.
Ie : I set it to 90 frequently, and for some reason it goes back to 60 after a while.
I think 60 min is the value of the planning in the gardena official app (and we have to keep at least one planning, even if we dont use it in the app) but i dont understand why this value is periodically replaced with 60. Any idea or tip ? I think it is the same problem as above but not sure.

There’s an easier solution that works without dummy items:
Switch the profile of the duration item’s channel from “default” to “follow” so that the binding doesn’t change the state of the item.

Does this mean that we can send with one command/widget the duration time and ON command?

You have to send two commands: One to set the duration and one to start the irrigation.

1 Like

Hello Mike,

I am new to openhab and just added my Gardena System to openhab. Because of my poor programming skills I have just build up a test page and added a toggle switch to start the irrigation of one valve. That worked out fine but of course the irrigation does not stop when I switch the toggle of. I now that there is another channel to stop the irrigation. My question is now is there a simple way to build a toggle switch to start and stop the irrigation? When yes do you have a hint for me??? Another question: is there a chance to build a slider that I can choose the irrigation time for e.g. 30min. and then the irrigation starts and stop automaticly after this time without writing million lines of code? Sorry for that but I just do not get a real start on that topic. Hope to hear from your.
Greetings, Marc

Hi all,
Sorry to dig again this post but I cannot use “duration” with gardena binding properly.
What I want : set a duration of my mower to 120min (2 hours)
And I cannot change the “mower_commands#commandDuration” of the binding, set by default to 60.
If I try to send another value, binding says me that I have to wait (few min) before sending another value and set itself to offline. ( I guess this is to respect gardena policy of flooding)
Openhab store the new value, but after few min, the binding reset the value to 60 itself automatically.
Is anyone succeeded to use this field ? And how exactly please ?

PS : also new with openhab 4.0, I have a class cast error now and cannot fix it.

class org.openhab.core.library.types.DecimalType cannot be cast to class org.openhab.core.library.types.QuantityType (org.openhab.core.library.types.DecimalType and org.openhab.core.library.types.QuantityType are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @164c9f45)

Send the command as e.g. 120 min instead of 120. It’s a Number:Time, not a Number.

Thanks for the tip.
I have not succeed to use a variable in rule with “120 min” value, but it set me on the right way to fix my problem.
It seems that the plugin actualy uses “Number:Time” as paramater type for “commandDuration” which is by default in “seconds” according to manual, and therefore use it as “minutes” for gardena API.
So now I use 120 seconds as value instead of 120 minutes in it is working. (for 2 hours…)