Schedules within bindings

Is there a preferred way of implementing scheduling within openHAB?

I’m writing a binding for a smart heating system (Drayton Wiser Thermostat Binding), which has its own scheduling functionality which works perfectly well.

I want to be able to interact with the schedule from within openHAB for a couple of reasons:

  1. I need the official companion app to still function fully, so the schedule used by openHAB needs to be the same as the one seen in the app. WAF is very important here.
  2. I want my heating scheduling to still work if my openHAB instance breaks for whatever reason.

Is there a precedent for this in openHAB that I can replicate? I can’t find anything other than people basically setting up schedules via rules, which violates both constraints above.

At the moment, I’ve exposed the heating schedules as their raw json, which I’ve been advised in my PR is likely to result in the PR being rejected for exposing implementation details. I’m not averse to writing a translation layer that would convert the internal scheduling into something that openHAB could deal with, but I don’t even know if this is something that openHAB supports (or will support in the future).

There is no explicit interface for bindings to address device schedules. Afaik Other bindings are exposing a subset via channels or thing configurations via mapping the schedule to openHABs date time type.

I had thought of exposing them that way, but that would be a potentially ludicrous number of channels to support. The scheduler supports 8 events (temperatures or states) per day, per room, effectively meaning each room needs to have 56 new channels…

You can offer a thing where channels can be added dynamically, like the MQTT generic Thing where you add an arbitrary number of channels. In your case you could limit the number of channels. And you would ignore the 9th channel of a day for example or put the Thing offline with a warning message.

1 Like