Hypothetical Calendar question - Heating Mode changes


I’ve got a 3 zone heating system setup (a baby system) in a church and community center, which uses OpenRemote and 56 time events to give 2 X 4 time events per day, which roll over each week.

They are coping very well, but I wondered if it would be possible to make it better / easier if I swapped them to OpenHab2?
(But it does have to be utterly fool proof)

So my hypothetical question is this…

If I set them up a Google (or other) calendar for each zone (mainly the church and community center, so only two) could they enter any event information in, so that OpenHab2 can read ahead by a couple of hours.

I know that it’s possible to create specific events, with very specific text to fire all kinds of events within OpenHab2, but I’m thinking far more simpler than that.

Do you think its possible to…

Read ahead in a calendar by a preset time (possibly variable if weather dependency is included) and if there is an event present (of any kind) the heating will be put to Day (ON) mode.

When the event finishes, the Heating will roll back (be set to) Night Mode (OFF).

I’d probably add a failsafe state in there, (a counter) so that if there are overlaying events, the first finish time is ignored.


The start of an event adds 1 to a counter.

The end of an event deducts 1 from the counter.

Counter >0.9 the heating is switched ON

Counter <0.5 the heating is switched off and counter set to 0

This simple logic works well with their current setup, and provides a visual indication that it is aware of any overlapping events. (This was a user concern)

I’m thinking this might be a nice way for them to document events in their buildings (more than 6 days in the future), also I could roll it out as a way to control more zones as they expand their system. (IE adding bedrooms etc in the priest’s house.)

They could add room / zone names in a subject line, but that means that correkt spelling becomes vital. :wink:

This might be doable. I don’t have any experience with the CalDav binding but it appears you can get a list of upcoming events in a String Item .The binding README leaves a lot out unfortunately so you will have to experiment a bit.

Alternatively, you could implement a script on the Google side to run periodically and poll the calendar and push updates to OH. I used to have a script like this in a Google Sheets that would search through my email, find those that are bill notifications, and update a calendar entry for when the bill is due and how much is due. I suspect you can do something similar to achieve this if the CalDav binding isn’t sufficient.

You could also code up something in Python to do the same thing. As part of that script I mention above I had a Python script that would log into and screen scrape my account balances from Mint and populate the entries in that Google Sheets. For awhile I had a pretty good automated system for keeping up with my account balances and bills. But Mint keeps changing their login approach and breaking my Python script so I finally gave up.

Maybe. Again, as part of my automated script above I created a Google Form where I would make updates (e.g. create new scheduled transactions, mark a bill as paid, etc) to update the calendar. To avoid the misspellings I used drop down lists to select from. You could use a similar form for adding new events to the calendar. Then all you would have to worry about is mistakes made when events are manually edited. The form populates a Sheet and the script creates/updates events based on those entries.

Before I ever got into home automation, I did a lot of phone automation and financial automation. I’m still amazed at what I was able to do with Sheets scripting.

Thanks for those thoughts Rich

It seems that it’s far more possible than I considered :smile:

I’ll see if my minimal programming skills can do anything.

Now that’s a good idea :smile:

Google forms I’m okay with, but scripting to move data around is something new to me.

Again, I’ll give it all a try and see how far I get :slight_smile:

Open a new Google Sheets spreadsheet.

Under Tools select Script Editor. A new tab will open.

From there you can start creating JavaScript code to do what you want. You can create more than one file and call functions across the files.

The Spreadsheet becomes the central clearinghouse for all the Google system processing.

Under Help on the Spreadsheet Script editor you have access to lots of tutorials and the API reference. If you’ve been able to figure out OH Rules you should have no problem managing this.

And if this is something you need to do again all you have to do is get a copy of your spreadsheet and Forms in the new account’s GDrive and set up what triggers the script to run.

I’m happy to help if you run into any problems. Probably better through PM since it isn’t strictly related to OH.

1 Like