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

Hello,
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
gardena:water_control:35xxx55:valve_commands#commandDuration
to 20mins via
ItemName.sendCommand(20)
—The value of duration changes to 20.

To start watering, I set
gardena:water_control:35xxx55:valve_commands#start_seconds_to_override
to ON via
ItemName.sendCommand(ON)
—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
„valve#Duration“

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"
when
    Item gardena_water_drip_start_stop received update
then
    if(gardena_water_drip_start_stop.state==ON) {
        //Start Watering for e.g. 15 mins
        gardena_water_drip_irrigation_duration.sendCommand(15)
        gardena_water_drip_open_valve_with_duration.sendCommand(ON)
    }
    else if(gardena_water_drip_start_stop.state==OFF) {
        //Stop Watering
        gardena_water_drip_close_all_valves.sendCommand(ON)
    }
    else {
        logError("error", "error")
    }
end

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(GardenaThingHandler.java:177) [bundleFile:?]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_222]

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

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]

	at java.lang.Thread.run(Thread.java:748) [?: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.