I try to understand how to use the iCalender binding.
I want to turn on and off my car heater depending of my calender.
If I create calender events named “Car heater” and set a start and stop time in my Google calender.
What is best way to setup OH3 to turn on my car heater when the calender event starts and turn it off when the event ends?
I got my iCalender bridge working so I more need to understand how the iCalender binding is sopose to be used.
I based my implementation of iCal purely on the documentation here. Could you be more specific about which bit you didn’t understand?
Did you create calendar events with command tags in the text?
You need to add BEGIN and END tags as per the documentation into the calendar events text
I hoped the binding was smarter than that.
I want my openhab to do the decisions of what devices to turn on or off depending of calender event text by using a regular expressionism.
If there is an event with the word “car” and “heater” openhab will turn on the car heater when the event starts and turn it off when it ends.
Okey, it’s possible to do this by using command tags in the calender event but then I need to know item name. This may work for me, but how about the rest of my family?
Maybe I could give a better example but this is what just came up in my mind. The car heater is little bit special as it should turn on x minutes before you want to use the car depending of outdoor temperature.
Maybe it’s possible to solve this by run a transformation on the calender event text or using meta data state description to add the command tag? Is that possible?
You can use it that way when you use a separate calendar. Then you can use the event presence switch as source for your heater.
Yes I understand that. But it would be nice if it was possible with a filtered event thing.
Then I could filter out events with regex and just let my device item follow that filtered presence switch.
You can do it with the event filter and parse the next event tile +start date.
However you need to build a custom rule for it.
I’m using both: the begin and end tags in the calendar to change items state and using event filter + parsing of the text to show the next events
Please explain more detailed how that custom parsing rule would work?
I was thinking of creating a rule that check CurrentEventTitle on change.
On change it will do some end actions after parsing previous saved CurrentEventTitle from a temp variable. It will then parse CurrentEventTitle to do some begin actions and save CurrentEventTitle to the temp variable.
That would depend on your usecase, how the rule would look like.
From the event filter you can receive title, start and end date as channels and link your items accordingly.
I am using a JS profile to parse the title (e.g. I have " " in the title and with the JS profiles you can link one item that will only keep the room name and another item that will only store the temperature).
In your rule you can eg create a trigger that will run at start date of the event
How about creating a filtered event and then do map transformation on Result_0_Begin with:
Channel is a datetime type but linked item is changed to switch type and should be set as ON if there is a start datetime and OFF if it is set as UNDEF.
Then I only need to set my engine heater switch to follow above item.
I try to get this to work but I don’t know how to get filtered current event in Result_0_Begin.
So, how do I use the filter event to get current event status?
Is you just want to know if there is any event currently ongoing, than you can just use the calendar thing and using the current_presence channel.
If you want to differentiate by different event records you have to use the event filter thing. If you want to switch an item based on event filter you would need to build your own rule.
Can I use the event filter to get filtered current ongoing event at first begin, end, title channels?
If I filter datetime to start at 0 and end at 1 using minute type. No rounding. Max 1 event. Shouldn’t I get current ongoing event if there is one? Else UNDEF?
Then I add the regex filter to only react on specific event text.
A rule to poll every 1 min and see if there is any filtered current ongoing events just feel stupid. I prefer event based action. Even though the filtering thing poll at specified period.
If you set the event filter to start=0 and unit = minutes this maybe clashes with the refreshing time, that the filter will not refresh as often you need.
Try to use hours or days first to see if you get an event at all.
Agree that there should not be a rule that will run every minute, but if I understand your usecase correct, I would create a rule that will run once the event start time will change (=the next event record will be read) and then create a timer that will start at the right time
Thanks. Now it’s up and running for testing.
Didn’t know that you can create timers from javascipt.
Is it possible to see create timers somewhere or is it totally hidden? They are not shown under schedule anyhow.
There is no place where you can see scheduled timers, as they are internal java objects.
Please not that if you restart OH or change the rule the timer will be cancelled
In this video series, the integration of iCal is well described. You then only have to create the corresponding rules.
Thanks, I watched those videos before, but my German is limited. I prefer English.
Ok. I hoped it created a object you can see in openhab.
So I guess it’s very important to keep the handle to be able to reschedule or cancel.
However, the script is created so I can do some tests. I use the script to turn on my car heater. The script notice the end timestamp, check outdoor temperature and schedule a start time from that.
When turning on the heater it check outdoor temperature and schedule a turn off action.
I just started playing around with the iCalendar binding and I have some basic questions I want to clarify first.
My use case is as follows:
- If I leave the house for several days I currently have a switch which I toggle manually setting the heating to an away level etc.
- When I return usually I need to remember some hours before I will arrive to flip the switch again otherwise the heating does not catch up fast enough.
Thus the idea to plan the away time in a calendar having OH triggering the away settings itself and returning to the “normal” state in time as well.
Triggering is the keyword here.
In my understanding an eventfilter focusing on the “away” entries in the given calendar should be able to fire an event when it begins and ends.
In reality it looks like the event filter does only show the beginning and end time triggering exactly nothing, not even providing something like a presence switch like the binding. Instead I should write something like “BEGIN:Calendar_Test_Switch:ON” within the calendar entry in order to toggle a switch practically creating my own presence switch.
Is that about right ?