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

Tags: #<Tag:0x00007f5c9818d570>

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.

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