Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only AirBnB iCalendars are supported #73

Closed
IanAdd opened this issue Jan 31, 2022 · 3 comments
Closed

Only AirBnB iCalendars are supported #73

IanAdd opened this issue Jan 31, 2022 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@IanAdd
Copy link

IanAdd commented Jan 31, 2022

I went to change the timezone of my two calendars which were working fine.
Amended airbnb no problem, just selected the timezone from the list and submitted, no other items touched.
Amending my Tripadvisor calendar's timezone and the message above popped up. Actually I'm unable to 'submit' even without making any change.

@IanAdd
Copy link
Author

IanAdd commented Jan 31, 2022

As an aside...
Having changed the timezone on airbnb...
The event sensor state shows the date and time unchanged but the start and end attributes have the timezone and hence will show the HA user local time in a browser when the event will happen.
I am happy with this, I just wanted to confirm this was your intention so I could code appropriately from these.
Eg.

ab reservation

@tykeal tykeal added the bug Something isn't working label Feb 2, 2022
@tykeal tykeal self-assigned this Feb 2, 2022
@tykeal tykeal moved this to Backlog 🪣 in Rental Control Feb 2, 2022
@tykeal tykeal moved this from Backlog 🪣 to In Progress 🚧 in Rental Control Feb 2, 2022
@tykeal tykeal added this to the v0.75 milestone Feb 2, 2022
tykeal added a commit that referenced this issue Feb 2, 2022
The error string for a URL that returns bad data incorrectly states that
AirBnB is the only supported calendar. This is incorrect as we now
verify that the data returns is of type text/calendar and accept any
calendar that passes this.

Additionally, the error string for invalid URLs was not giving a reason
why it was considered invalid.

Issue: #73
Signed-off-by: Andrew Grimberg <tykeal@bardicgrove.org>
@tykeal
Copy link
Owner

tykeal commented Feb 2, 2022

@IanAdd the error isn't actually very clear as to what is happening. When you try to submit the integration validates that the provided URL complies with the following two rules (text for both is being updated in #75)

  1. the URL is an https url. Non-https URLs are rejected
  2. the URL returns a content type of text/calendar. I would expect TripAdvisor to do this properly. To figure out what is happening we need to know what the 'Content-Type' that TripAdvisor is returning. The easiest way is the following (assuming a Linux or Mac with the appropriate utilities installed)

HEAD the_url | grep -i content-type

For instance AirBnB returns the following with that command:

Content-Type: text/calendar;charset=utf-8
X-Content-Type-Options: nosniff

Whiel VRBO and Guesty return the following (respectively):

Content-Type: text/calendar;charset=UTF-8
Content-Type: text/calendar

Alternatively, you can email me (or PM me on the HA forums) a URL that I can go and inspect for any oddities.

As to your aside. Yes, that is sort of intended. What happens is that the selected timezone is applied to the calendar on the next calendar refresh (roughly every 2 minutes). Sensors refresh every 30ish seconds. The state description when it is being built is ignoring the the timezone in the date and time string conversion for the status. So it's going to effectively treat it as the timezone of the object is the "local" timezone for output.

However, the start and end times are timezone aware and are treating everything correctly.

Personally, I don't have calendars that are in timezones other than my local, but in my manual testing I've been adding one and sticking it on the other side of the world from me so that I can make sure that the objects that it really matters for are updating correctly. Having the status show the date time as the local to property makes it easier to know that it's doing the correct(ish) thing, particularly in the case where you might need to talk to a guest. You don't have to do the timezone conversion yourself then.

@tykeal
Copy link
Owner

tykeal commented Feb 4, 2022

This issue was resolved with a combination of #75 and #77

@tykeal tykeal closed this as completed Feb 4, 2022
Repository owner moved this from In Progress 🚧 to Done ☑️ in Rental Control Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

2 participants