Hi all. My OH 2 setup died so I decided to install a fresh new setup. I downloaded the latest Openhabian with OpenHab 4.2.1.
I created a Rule to test the time-based rules
configuration: {}
triggers:
id: “1”
configuration:
time: 23:20
type: timer.TimeOfDayTrigger
conditions:
actions:
inputs: {}
id: “2”
configuration:
itemName: OfficeLights_Office_Lights
command: OFF
type: core.ItemCommandAction
The light is not switched off at 23:20. Is there any plugin or Add on I need to load to make the time-based rules work?
Also in version 2 I used a extension expire to switch off a extractor after it ran for 20 minutes
//Sonoff extractor
Switch EXTRACTOR “Main Bathroom Extractor” [Switchable]
{ mqtt=“>[broker:cmnd/Extractor/POWER1:command:*:default],
<[broker:stat/Extractor/POWER1:state:default]” , expire=“20m,command=OFF”}
How do I do that now in Version 4?
rlkoshak
(Rich Koshak)
September 9, 2024, 4:25pm
2
Please post code using code fences.
```
code goes here
```
Using quote blocks does not preserve the white space and special characters making the code very hard to understand.
No, this rule should work out-of-the-box.
If you are still using .items files, what you have there for expire will work as is. Expire is now part of core instead of being a separate add-on.
If you have managed Items (i.e. defined through the UI), navigate to Settings → Items → EXTRACTOR → Add Metadaa → Expiration Timer.
Sorry I was not sure which icon to use
configuration: {}
triggers:
- id: "1"
configuration:
time: 23:20
type: timer.TimeOfDayTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
itemName: OfficeLights_Office_Lights
command: OFF
type: core.ItemCommandAction
I have now done it all using the GUI and not files. I will have a look at the Metadata
The Rules show a status of Idle. Is that correct?
rlkoshak
(Rich Koshak)
September 9, 2024, 5:27pm
5
Yes, it will only show differently when it’s actively running but that’s usually too fast to see in the UI. Or it will show disabled if the rule is disabled.
I don’t see anything obviously wrong with the rule. Are you sure a command wasn’t sent to the Item? Have you checked events.log to confirm?
If I click the run button it works but it does not fire on its own when the time is 23:20 or whatever time I set.
OK I figured out what is wrong but not what is creating the issue. There is 1 hour difference between Openhab and my Pi time. Here you can see if I get the system time it is 22:43 but in the log file it is 21:43. So the Rule will fire but I have to subtract 1 hour. My locale is correct and my time zone etc. What could it be?
OK I followed this and the time now seems fine
Hi,
I’m Runnng OH 3.0.0 M2 on a Ubuntu server. The time on the Ubuntu server shows the correct time…
Installed the NTP binding which is ONLINE and defined a Item “Date” in the items file.
If you see in the event.log the timestamp runs 1 hour behind the ntp time which is the correct time.
Also if i show this date in the MainUI the time runs 1 hour behind?
[image]
Where end how can i correct this?
rlkoshak
(Rich Koshak)
September 9, 2024, 9:42pm
9
Checking the timezones was going to be the next step. I’m sure this will fix it and it should work going forward.