Design Pattern: Simple State Machine (e.g. Time Of Day)

That’s one of the breaking changes.

Somewhere around the early 700’s in the posts above (I think) there is a version of the Rules DSL version of the rule posted that uses ZonedDateTime. You probably have other rules that use Joda DateTime so be sure to review DateTime Conversion (openHAB 3.x). I’m not really supporting the Rules DSL version myself any more but there are replies above that have the changes.

Since you are reworking things, you might consider using the JavaScript version of the rule. You just need to copy over the code (soon you’ll be able to install it just like an add-on :partying_face:) and set some metadata on your Items.

The advantage is that it supports setting a different set of times of day based on the type of day (e.g. have a different set for weekdays and weekends), the times can come from anywhere (e.g. I use the Android app’s Alarm Item feature to drive one of my times of day) and you don’t have to change the rule to add or remove times of day. You just need to add/remove the Items and set the Item metadata.

1 Like