I do have some generic switch items e.g. to disable automation when we go on vacation. All works smooth except that whenever I reload the configuration files, the state is being reset to ‘NULL’.
So far I was not able to find a proper way to set a default value. I tried a rule linked to the system start levels (and tried System reached start level 40 - Rules are loaded and parsed, both from db as well as dsl and script files)
But the rule did not fire up when I am just loading fresh config files (thimgs, items, rules, sitemaps), however the item state of my vacation switch (and some other generic switches) gets reset to “NULL”.
I would like to handle this in a better way than adding a check to all other rules what to do if state is “NULL”.
Any ideas? Thx, Jens
You can never guarantee that any Item has a usable state. Any Item can become NULL or UNDEF at any point. So it’s probably a good idea to add the checks to all your rules anyway.
But for this specific problem, that’s what persistence and restoreOnStartup is for. You do not have a default persistence config (or else this would already be happening) so you need to modify your .persist file to save these switch Items on everyChange and restoreOnStartup. If rrd4j, you also need everyMinute.
Thx @rlkoshak I created a cron based rule to check these switches regularly and set the proper state.
If you can do that why can’t you just calculate the proper state in the rules in the first place?
Give the information posted, this us a very odd configuration.
@rlkoshak because I am lazy was faster to have a “anti-null-rule” than to adjust all other rules
I have the suspicion that some of my issues result from “performance” limitations (I am running OpenHAB on a 4x4 GB Raspberry Pi4 Kubernetes/K3S Cluster on Longhorn distributed storage). You remember the load time issues you identified on my other topic….
However during runtime all is fine and I can run many other services in parallel leveraging a highly reliable environment…