I’ve put my “time off” (“vakantie” in Dutch) from work in my Google Calendar, and have its beginning and ending converted into DateTime Items.
These DateTime Items then trigger a rule:
configuration: {}
triggers:
- id: "1"
configuration:
itemName: startschoolvakantie
timeOnly: false
type: timer.DateTimeTrigger
- id: "2"
configuration:
itemName: startschoolvakantie1
timeOnly: false
type: timer.DateTimeTrigger
- id: "3"
configuration:
itemName: eindeschoolvakantie1
timeOnly: false
type: timer.DateTimeTrigger
- id: "4"
configuration:
itemName: eindeschoolvakantie2
timeOnly: false
type: timer.DateTimeTrigger
- id: "6"
configuration:
itemName: schoolvakantie_switch
type: core.ItemStateChangeTrigger
conditions: []
actions:
- inputs: {}
id: "5"
configuration:
type: application/javascript
script: |-
var itemnaam = event.itemName;
var pythoninvenv = '/var/lib/openhab/bin/python/tado-manual-control/venv/bin/python';
var pythonscript = '/var/lib/openhab/bin/python/tado-manual-control/tado-manual-control.py';
var pythonwachttijdinseconden = 10;
function callPython(command) {
var pythonOutput = actions.Exec.executeCommandLine(time.Duration.ofSeconds(pythonwachttijdinseconden), command);
console.log("python output = "+pythonOutput);
}
function startVakantieschemaTado() {
var command = [pythoninvenv, pythonscript, 'set_schedule_type', '-s', '0'];
callPython(command);
}
function startWerkchemaTado() {
var command = [pythoninvenv, pythonscript, 'set_schedule_type', '-s', '2'];
callPython(command);
}
if (event.itemName == "schoolvakantie_switch") {
var nieuwestaat = event.newState;
if (nieuwestaat == "ON") {
startVakantieschemaTado();
} else if (nieuwestaat == "OFF") {
startWerkchemaTado();
}
} else if (itemnaam.startsWith("start")) {
items["schoolvakantie_switch"].sendCommand("ON");
} else if (itemnaam.startsWith("einde")) {
items["schoolvakantie_switch"].sendCommand("OFF");
}
type: script.ScriptAction
So eindeschoolvakantie1 should have triggered this rule Monday morning. But it didn’t. This is an extract from events.log:
2026-02-22 23:59:46.609 [INFO ] [openhab.event.ItemStateChangedEvent - 449 ] - Item 'Stopcontact_gasbrander_Power_Consumption' changed from 6 W to 5.9 W (source: org.openhab.core.thing$shelly:shellyplusplug:e4b32339c760:meter#currentWatts)
2026-02-23 00:00:00.031 [INFO ] [openhab.event.ItemStateChangedEvent - 449 ] - Item 'Wasmachine_Power_Consumption' changed from 0.4 W to 0.3 W (source: org.openhab.core.thing$shelly:shellyplus1pm:d4d4da7df8a8:meter#currentWatts)
2026-02-23 00:00:00.181 [INFO ] [openhab.event.ItemStateChangedEvent - 449 ] - Item 'startschoolvakantie1' changed from 2026-02-14T00:00:00.000+0100 to UNDEF (source: org.openhab.core.thing$icalendar:calendar:schoolvakantiekalender:current_start)
2026-02-23 00:00:00.182 [INFO ] [openhab.event.ItemStateChangedEvent - 449 ] - Item 'eindeschoolvakantie1' changed from 2026-02-23T00:00:00.000+0100 to UNDEF (source: org.openhab.core.thing$icalendar:calendar:schoolvakantiekalender:current_end)
I thought that maybe the DateTime Item would be updated prior to the time it should trigger the rule. But that doesn’t seem the case. Unless I don’t understand 2026-02-23T00:00:00.000+0100 correctly, it should come before 2026-02-23 00:00:00.181, right?
Or is 181 ms not enough time to trust this to work? In that case, does someone have an idea on how to tackle this?
Thanks in advance!
