Airbnb automation (dynamic calendars based on guests)

@s.rodighiero I currently do this with a property but I do it with SmartThings using the RBoy Rental Control app.

I’m working on building out an integration for HA, as I’m trying to get completely off of SmartThings, that will leverage the KeyMaster integration for the lock control. The real missing piece of this puzzle is the calendar control with default check-in / check-out times that are also overridable.

I haven’t had a lot of time to work on it yet, but have already validated the calendar acquisition and modification (AirBnB doesn’t put in/out times in their entries so they have to be modified upon ingest). That was just some side scripting though. I need to make it a full fledged integration!

@tykeal
Hi Andrew,

Thanks for your reply, sounds interesting. Today I changed my flat lock with a brand new one supporting european cylinder, than internally I plan to attach a “AIRBNK” lock (model 521), that supports wifi/tuya/zigbee. I run hassio on a pi installed inside the electrical cabinet of the apartment, I’m waiting to receive the lock and the usb zigbee gw. I went for a zigbee lock because the zigbee integration supports locks, while tuya does not.

As I said, I would love to give them HA access to let autonomously manage the access, but at the same time let the user (or at least the password) expires within the checkout. Another “issue” is that at the present time, HA has not a users/group permissions feature yet.

Ah, you mention zigbee. At present KeyMaster (which my integration will depend on) doesn’t support zigbee locks. There’s an open feature request from some folks to get ZHA support in, but it’s pending a PR with support.

I see. Well, let’s see If I would be able to do something without, I’ll let you know if I found anything interesting to integrate with/to Airbnb :wink:

Hi Andrew,

Quick update: I had to discard the AIRBNK lock as I discovered that the zigbee integration on Tuya devices is in some way “crypted” by Tuya, and works only with Tuya gw: I purchased as well a Tuya usb zigbee gw, but is not recognized as valid zigbee gw by HA.

After few researches I ended up buying a Danalock V3 BT Z-Wave, that apparently looks like the best solution (at least for me), and being a Z-Wave device I will be able to manage it via Keymaster (thank you for the suggestion).

I’ve been able to import Airbnb calendar via Google calendar, and display it nicely on a card, next step is to test a reservation, and see if there is a way to change “guest” user password using some information from the guest.

I keep failing to find the time to write the integration that I think will make this all come together.

My current intent is to fork the iCal Sensor integration and make adjustments to it to do the following:

  1. Only poll AirBnB every 2 hours. I remember seeing somewhere that they’ll ban / block if you’re too aggressive on your polling and currently the iCal Sensor plugins refreshes the calendar on every refresh cycle (roughly every 30 seconds!)

  2. Add options for default check-in and check-out times

  3. Add options for what starting slot and number of slots to be used on the lock. That way you can have some permanent codes not managed by the calendar

  4. Make it aware enough of the managed slots so that if you change the start / stop time of a code slot it properly tracks that instead of resetting to the default ones

As for the door code, the easiest would be to “generate” the code based on the last 4 digits of the phone number which will be in the description of the booking. Alternatively, some sort of hashing function based upon the booking ID would be appropriate as well

Sorry for the off-topic add. Does anyone know how to create a sensor for a buried attribute? Such as:

attribute: description: phone number

@tykeal I saw you were playing with airbnb calendars and wondered if you had got over the issue that is bugging me which is that the calendar start & end date attributes switch to the next booking at midnight of the guests last night.
I want the heating to shut down after they’ve gone not at midnight when they are still there.

@ianadd yes I have been playing with an integration for AirBnB calendars. It’s intended to work hand in hand with Keymaster, but right now it’s not a strict requirement (and it may never actually be a hard requirement).

My current work is available here: GitHub - tykeal/homeassistant-rental-control: Rental Control system for Home Assistant

At present what you can do is the following:

  • Add an AirBnB calendar
  • Add prefixes to the Reserved events (in case you have more than one calendar you wish to configure)
  • Set a Check-in time (defaults to 16:00)
  • Set a Check-out time (defaults to 11:00)
  • Set how far into the future you wish to fetch in days (defaults to 365 / aka 1 year)
  • Select the Keymaster lock configuration you wish to tie against (though it doesn’t do anything right now and None is valid)
  • State what lock slot management will start at (defaults to slot 10) this is presently unused
  • Define the number of event sensors to create (defaults to 5) this will in the future be how many lock slots are actually managed

What this does it pull in the AirBnB calendar and refreshes it every 2 minutes.

It creates a calendar object and populates all of the events. Additionally, it rewrites the events to have actual start and stop times instead of being all day events. I’m pretty certain that this is what you’re really wanting.

In my personal HA I’ve also installed via HACS the Atomic Calendar Revive frontend which I’ve found makes it really easy to see the upcoming schedule when configured in event mode. Especially with the maxDaysToShow set to 30 or more so you can see the entire month. The Calendar view itself isn’t as useful as it doesn’t differentiate multi-day stays very well in that view.

Using the rudimentary integration as it is now would allow you to have better ability to control climate based on the calendar and sensor entities that get created by it given that you’ve got actual in/out times.

@tykeal I’ve copied the rental-control folder as instructed in your read-me.
I’ve restarted HA and no extra entry appears in integrations list.
I’m running 2021.12.7
Any other steps needed ?

Thanks for sharing

I take it this is your first time installing an integration? You’ll need to do two things for it to be available as a new integration:

  1. Restart your Home Assistant
  2. After it’s finished starting, on the integrations page you’ll need to do a force refresh for it to show up

Please note, that there is no icon available for it. I’m not an artist and I wasn’t expecting to release this to anyone just yet! :wink:

I would also recommend you get HACS installed if you haven’t done so already. When this integration is finally in a state I can consider it truly release worthy I intend to get it added there. As it is, right now I don’t pass all the needed validation tests for inclusion in HACS.

@ianadd you might want to pull the latest version. I just closed a bug related to editing rental control entities that do not have a lock associated with them. That is, Keymaster configuration to manage is set to (none).

Hi, a full refresh of of the browser solved finding it. Hadn’t thought to do that.
However it then errors:
config flow cannot be loaded

I use hacs a lot, i use atomic cal revive.

I will download the updated code as suggested.

Do you have Keymaster installed? Rental Control does have it listed as a dependency and may not fully load if it isn’t installed. I haven’t tested it in that configuration at all.

Ok, Installed Keymaster - not that I anticipate using such - so would be nice if you didn’t bind your dev to it (for me at least).
Next the add integration brings up a list of unlabelled fields to enter in info.
Your initial message gives me a clue as to what it might expect but…
1st field …
airbnb calendar ? what format and - the exported one from airbnb or the google calendar created one I currently have in google-calendars.yaml
Can it be a Tripadvisor calendar ? I use both services.

2nd field …
‘prefixes to the Reserved events’ tbh I haven’t a clue what this means.

3rd field …
???

The rest of the fields I understand.

The tick box at the bottom ??

Finally, it looks like aborting the entry of data into this dialog by changing to another HA page seems to leave HA in a corrupt state requiring a power off reboot. tbh I suspect this version of HA 2021.12.7 has some fragility I’ve not seen before.

Sorry if I am being a hassle but if you are aiming to publish it to HACS you can consider me a beta tester !!

You might want to do a force refresh of the page when you’ve got the entries up. I’ve noticed that labels don’t always load in properly when they’re first added.

The canceling and leaving HA in a corrupt state, I can’t explain that. I’m using the standard workflows show it should cancel cleanly!

As for the fields. The labels are currently (from top to bottom)

  • Calendar Name
  • Calendar URL (this must be the airbnb exported calendar. The code currently will reject any ics URL that does not start with https://www.airbnb.com)
  • Prefix for events. At least on all of my AirBnB calendars a guest staying is always titled Reserved and I’ve got two units I’ve got in my system so it was confusing. This allows you to add a prefix to events so that it comes out like Unit 1 - Reserved. This defaults to an empty string and can be ingored
  • Default Check-in time (defaults to 16:00)
  • Default Check-out time (defaults to 11:00)
  • Maximum number of days into the future to fetch (how far into the future will the integration watch for events). This really isn’t something I worry too much about, we only allow booking about 8 months in advance for our units, but I figured it would be nice to have in there
  • Keymaster configuration to manage (the keymaster locks to integrate with, defaults to (none)
  • Starting lock slot for management (defaults to 10) This is is the door lock slot that when Rental Control is finally able to do it, will be managed for door lock codes for guests
  • Number of event sensors to create. Fairly self-explanatory but it will also (once the previous variable is working as expected) be how lock slots are put under control of the integration.
  • Verify SSL certificates - in truth I should probably remove this, but it’s mostly for the eventuality that in the future I allow for more than just AirBnB calendars and people are exporting custom ics URLs from someplace that isn’t using a valid SSL cert. Unchecking it means that the SSL validation of the calendar ics file would not be performed in the fetch

Now, on to your other asks. Not binding to Keymaster is likely not going to happen. My whole intent for this integration is to get me back capabilities that I will lose when I move my rental units off of SmartThings and thus the RBoy Rental Lock Manager. Keymaster gets me half-way with the fact it’s got full automation of locks, including scheduling around them (of which I got a feature merged to suppport this). My integration is intended to be the calendar driver part of that.

Now, if someone wants to propose a patch to my integration that makes it optional in a way that doesn’t break the integration to Keymaster I’ll definitely consider it.

On the topic of calendars. I do presently have a hard requirement on it being AirBnB. The only real reason for that is that is the only calendar I’ve got access to work with. If I get access to other standardized calendars I can work out a way to either auto-detect what needs to happen or handle it just like the AirBnB calendar. In particular, I don’t want check-in / check-out times to override times that may come in from another calendar. For AirBnB I had to have them because they only present all day events. I could relax the calendar to just require that it be an ics file, but I don’t want to deal with bug reports for someone using a calendar that gets all messed up because they had start / stop times on the events and they lost it because of the check-in/out overrides.

I would love to get off smartthings for the rentals. I use vrbo as well as smartthings.
I also use guesty for managing my 2 suites so if possible adding those calenders would be great. I would be glad to beta test. Also the option to use day-in day-out for door code. Vrbo does not publish the phone number to the calendar so I use that format for both.

I will load this on my current home assistant when I get a chance and play.

Awesome to see someone working on this.

Craig

As I’ve mentioned, I’m open to PRs for getting other calendars.

Alternatively, if folks want to DM me to share details so I can get direct access to calendars and other platform specific information I’m open to it.

I probably should go create a proper post about this project instead of having semi-hijacked @Greenhouse’s request :wink:

@ianadd and @iscraigh latest code version of the integration now supports any calendar URL with the following limitations:

  • URL is an https:// URL
  • The URL must return back a Content-Type of text/calendar which AirBnB, VRBO, and Guesty all do. I assume that TripAdvisor does the correct thing as well

The events that are retained from the calendar are any event that does not contain the following in the summary of the event: Blocked or Not Available, any other event should be retained.

The integration still doesn’t actually manage the lock codes at this time. I’m still noodling on how to do that sanely :wink:

Also, I haven’t tried this yet, but my repo is configured so it should be installable via HACS though it might have some issues since I haven’t actually done any releases yet :smiley:

Great to hear of the added features. Can I suggest that blanket ignoring ‘blocked’ and ‘not available’ will cause problems for those who might take a private booking. eg family, repeat booking coming to you direct, and the such like. I get a few each year.