Google Calendar Switches to Next Event Before End

Hi,

I run an airbnb and use HA and node red for pretty extensive automation of the thermostat. I have google calendar setup in order to automate when the thermostat should initially start and end. The start part works great however it seems to switch to the next event before the end of the initial event causing the thermostat to go into away mode while guests are still in the apartment. does anyone have any idea how to solve this?

Thanks!

Do you have whole day events or “timed” events? How close are the two events together?

They are all day events and typically the closest together they can be is if one were to say end at midnight on feb 13th the next one would not start until midnight on feb 14th.

another issue is it seems to happen at random intervals. like sometimes it might happen at 730 PM before the event end and other times it might happen at 614 PM before the event end so its really hard to predict otherwise I would just use delays to account for the difference.

It might be easier if you could provide your automation code.

1 Like

Hmm the automation is a flow in node red, so im not entirely sure I can post code like that. I will look into and post it if I can find a way. However the main issue seems to be that the entity called “calendar.airbnb_cal” in HA changes to the next event before the “end_time” attribute is reached for that entity in HA throwing off the entire automation. I guess I was really wondering if there is a way to force the google calendar component to not change to the next event before that “end_time” attribute is reached. I really appreciate you helping BTW.

Sorry I missed the node red part. I’ll set up something to test that on my instance.

1 Like

Ok great thanks alot!

Ok, so, as far as my simple test went it worked as expected.

I set up two calendar events back to back.

image

I set up two simple automation triggered by that calendar.

- id: test_reminder_on
  alias: Test reminder on
  initial_state: true
  trigger:
    - platform: state
      entity_id: calendar.home_assistant
      from: "off"
      to: "on"
  action:
    - service: notify.ios_iphone
      data:
        message: "Turn thermostat on"

- id: test_reminder_off
  alias: Test reminder off
  initial_state: true
  trigger:
    - platform: state
      entity_id: calendar.home_assistant
      from: "on"
      to: "off"
  action:
    - service: notify.ios_iphone
      data:
        message: "Turn thermostat off"

And it worked just as expected.

image

It fires not on the very second when the calendar event happens, but close enough to control a thermostat.

1 Like

Hmm ok thanks for looking into that. I have some guests checking out in the next few days so I’ll see if it happens again and try to give more detail if it does maybe it was some sort of fluke. I did change some tings in how my calendar syncs up so that might fix it.

Thanks!

2 Likes

Hey CGtobi,

So it looks like it happened again. however it does seem to be predictable as to what time it will happen so I can set a delay to resolve it in node red. I am not sure why it is happening but as you can see by the attached images the “airbnb_cal” switches to a new event before the end of the old event. causing the sensor to go into an off state and triggering an automation that should not happen for about another 16 hours.

InkedCapture_LI
The above reservation is the one that is still on going and as you can see it should not end until midnight tonight. however the following reservation seems to have taken its place and caused the sensor to go into an off state because HA things the current calendar event has not started yet.

InkedCapture2_LI

Appriciate the help.

As I don’t know what Node-Red is doing I’d suggest to implement those two simple automations (of course with slight adjustments for your setup) to see whether it is a problem with HA or NR. Just replace the calendar and whatever notification service you’ve set up.

Hey again CGtobi

its been awhile but I am still having this issue and I think i found some information that may be useful, yet I cant seem to figure out how to solve it.

So the calendar that is having this problem is a google calendar imported from airbnb thus it has a GMT timezone of 00 and I cannot change it. I live in GMT04 and my calendar seems to switch to the off position exactly 4 hours before it is supposed to indicating that for some reason it is using the google calendar of GMT00. I cannot seem to find a way to adjust this in home assistant nor is there a way for me to adjust this in google calendar due to it being an imported calendar from airbnb. I know this is an oddly specific senerio but I was wondering if you could point me in the right direction on how to solve this? I am currently useing delays in my automations but I would like to avoid this because if for some reason I need to restart my server the automation becomes null.

thanks,
Sac

Sorry for being late to this party, but I have a similar setup using google calendar, but I have one additional component, Integromat. I do have a central google calendar for each of my AirBnB rentals and have the AirBnB calendar is inserted into the central google calendar. Integromat reads that calendar and parses the information verifies that the rental information is not in the Database and passes it on the the individual google calendar for a particular rental. But with one distinction, when it is written to the rental calendar, I set the time of day that it will activate and deactivate. For example, 20 May 2019 0600 to 23 May 2019 1600. This then changes the mode to the appropriate setting and turns the AC on or off. Here is a screen shot of the integromat flow I am currently using.

Parsing the information requires a JSON pattern, here is the pattern that I am using;

[\s\S]?CHECKIN:\s(?.)\n[\s\S]?CHECKOUT:\s*(?.)\n[\s\S]?NIGHTS:\s*(?.)\n[\s\S]?PHONE:\s*(?.)\n[\s\S]?EMAIL:\s\s\S\n[\s\S]?PROPERTY:\s(?.*)

Here is a screen shot of the Text Parser in the integromat flow. The JSON code goes into the Pattern Field.

Hope this Helps
Tim