Disable caldav command execution

I have a question regarding the caldav command binding. I was able to successfully set it up so that items are updated based on a caldav calendar. However I now would like to be able to turn on/off the automatic calendar based updates. In the documentation of the caldav binding a disable command is mentioned. However I did not figure out how to really use it. Does anyone have an example for that?

Thanks,
Dominik

Hi Dominik,

have you been able to solve your issue?
I would like to enable / disable the caldav command actions (e.g. when on vacation).
Thanks

Probably the best solution is to just stop the caldav binding.

As far as I understand the docs there has to be an item as follows

Switch presSimulationEnabled "Präsenzsimulation aktiv" (gPresence,gRRD) {caldavCommand="itemName:gPresenceSimulation type:DISABLE" }

This switch would when enabled disable caldav updates to all items belonging to group gPresenceSimulation.

I had this on my test openHAB installation and it seemed to work most of the time, but not all of the time unfortunately. I have the impression that it worked when the switch was set manually after openHAB had started, but not when the setting was restored by persistance. YMMV.

Thanks. Sounds good.
I will give it a try.

So you mean using a switch and disabling the binding?
Is there an easier way than doing this by script like

sudo ssh openhab@localhost -p8101
bundle:start org.openhab.binding.caldav-command

?

unfortunately I haven’t been able to solve the issue beside stopping the binding. I will try the solution proposed by ralle

Dominik

@Dominik_Bernhardt Did it work for you?

I have not tried it yet but have it on my todo list. I will let you know the result

hi, i was wondering if someone tried this and got it working.
i tried it but could not get it working, the schedule got still executed.

Matt

i actually trying to get the "caldavCommand=“itemName:gPresenceSimulation type:DISABLE"
working for quite some time now without any success.

my test item files look like this.

Group gTest
Group gTest1
Group gSchedule

Switch S_Test1_S	"Test Item"	(gTest)

Switch S_Test2_S	"Test Item"	(gTest1)
Switch S_Test3_S	"Test Item"	(gTest1)

Switch gTest_Enabled "Schedule gTest active" (gSchedule) {caldavCommand="itemName:gTest type:DISABLE" }
Switch gTest1_Enabled "Schedule gTest1 active" (gSchedule) {caldavCommand="itemName:gTest1 type:DISABLE" }

persistance

Strategies {
        everyMinute:"0 * * * * ?"
        everyHour : "0 0 * * * ?"
        everyDay  : "0 0 0 * * ?"
        default = everyChange
    }

Items {
    // which data to be stored
		gSchedule* : strategy = everyChange, everyMinute, restoreOnStartup
		gTest* : strategy = everyChange, everyMinute, restoreOnStartup
		gTest1* : strategy = everyChange, everyMinute, restoreOnStartup
}

if i switch gTest_Enabled oder gTest1_Enabled to ON i see the following entries in the log

2017-10-18 11:55:54.271 [INFO ] [aldav_command.internal.CalDavBinding] - execution for 'gTest' disabled
2017-10-18 11:55:54.276 [ome.event.ItemCommandEvent] - Item 'gTest_Enabled' received command ON
2017-10-18 11:55:54.284 [vent.ItemStateChangedEvent] - gTest_Enabled changed from OFF to ON
2017-10-18 11:55:56.048 [INFO ] [aldav_command.internal.CalDavBinding] - execution for 'gTest1' disabled
2017-10-18 11:55:56.053 [ome.event.ItemCommandEvent] - Item 'gTest1_Enabled' received command ON
2017-10-18 11:55:56.066 [vent.ItemStateChangedEvent] - gTest1_Enabled changed from OFF to ON

so for me everything looks OK, however even its showing “execution for 'xxxx” disabled, its still getting executed.

any ideas what i’m doing wrong here?

I installed the binding yesterday, this is a working config to compare with (also the disabled command works):

items:

Switch Test_Switch <switch> (gRestore)
Switch Test_Switch_value {caldavCommand="itemName:Test_Switch type:VALUE"}
DateTime Test_Switch_date {caldavCommand="itemName:Test_Switch type:DATE"}
Switch Test_Switch_disable {caldavCommand="itemName:Test_Switch type:DISABLE"}

sitemap:

Text item=Test_Switch_value label="Next command [%s]"
Text item=Test_Switch_date label="Date/Time next command [%1$td.%1$tm., %1$tH:%1$tM]"
Switch item=Test_Switch_disable	label="Disable Test_Switch commands"
Switch item=Test_Switch label="caldav Test Switch"

It is even possible to disable the execution between to switching states.

Edit: I haven’t tried it with groups, though

@sihui configured everything on item level, not with groups and its working fine now.

1 Like

@sihui Does the setting of disabling execution persist over openhab restarts? As I wrote in Sep '17 it didn’t work back then when I tried it.

Haven’t tried that yet, but if you configure a persistence service for that item it should work because the state can be restored during restart via restoreOnStartup:

https://docs.openhab.org/configuration/persistence.html#predefined-strategies

A nice and easy restoreOnStartup can be achieved via
https://docs.openhab.org/addons/persistence/mapdb/readme.html

I’m aware of the restoreOnStartup persistence setting. When I tried the caldav command binding sometime last year it seemed to make a difference if the item was set manually vs. being set by persistence on system startup.

Maybe the disable item’s state is not checked on every execution and this is a timing issue if the restore on startup runs when the caldav binding is not ready yet set the right internal flag that prohibits the execution of commands?!

I’ll try to check sometime later, maybe next week or so :sunglasses: