I have cheaper electricity at night time, and I want a item that I can use to trigger when the cleaper electicy is available.
The Night Rate charges apply between 1am and 8am (winter time) or between 2am and 9am (summer time).
Ideally, I would have a time based trigger from 1am and 8am that would be based on standard time.
If not, I can use an if statement, or if I’m really lazy just go from 2am to 8am.
Is there any clever way of doing this?
I would e.g. go the way that is described in the 2 answer in
00 1 * * * [ `TZ=CET date +\%Z` = CEST ] && sleep 3600; /run/script/to/set/the/trigger/item
You can use that cronjob and let the cronjob e.g set an item. The item change can used as trigger.
During CEST ( daylight saving time in CET timezone ) sleep for on hour will be executed. After that the command to set the trigger will be executed. In case of non daylight saving time the sleep command will not be executed.
I assume that this also can be done in a rule. For that part I do not have enough knowledge.
I don’t think that the cron library used by openHAB supports timezones. Using the system cron as you suggested is probably the best approach.