Time Rule does not fire on New OH 4 setup

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?

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?

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

Checking the timezones was going to be the next step. I’m sure this will fix it and it should work going forward.