[Custom Integration] Rental Control - for AirBnB, VRBO, etc

Showing my airbnb entities
image

Just for clarity, you’re not trying to drive the same KM slots with these different installs are you? That would be a very much unsupported configuration :wink:

For troubleshooting, first thing to do is check and make sure that all of the automations registered correctly.

Go to your automation dashboard and then put ‘Rental Control’ in the search box to filter to just the RC automations. You should find 4 automations per installation of the integration that is driving keyslots

Ummm they might be trying to drive the same slots, ugh I’ll go modify my KM and add more slots to this lock and then give each integration a range to use just to ensure that there is no conflicts. I’m going to kick myself in the butt if this is the cause.

You should definitely give each one it’s own range. I haven’t seen a smart lock yet that didn’t support at least 30 slots. I do the following on my locks:

Slot 1 - 5 (or 1 - 10 depending) are dedicated to static codes. These are the ones I directly manage.

For each RC that needs to drive slots you should have a minimum of 2 slots dedicated, the default is 5. The reason for the minimum is for those cases where you have a guest leaving and one coming on the same day, you need to cover for that because RC won’t clear the slot of a guest until the event is in the prior day (00:00 local time) so you need to have a slot for the guest that’s coming as well.

Ok got that and set the lock to 25 codes (it can go up to 200 but yeah no need for that type of nonsense)

Ok so when running the automation to update vrbo I get this

2022-09-22 15:54:53.654 ERROR (MainThread) [homeassistant.components.automation.rental_control_update_vrbo] Rental Control - Update vrbo: Error executing script. Error for call_service at pos 2: Error rendering data template: UndefinedError: 'base' is undefined
2022-09-22 15:54:53.669 ERROR (MainThread) [homeassistant.components.automation.rental_control_update_vrbo] Error while executing automation automation.rental_control_update_vrbo: Error rendering data template: UndefinedError: 'base' is undefined

Going to bounce my HA and see what comes from having it all fresh now. I know that between KM and RC I shouldn’t have to but we’ll see what happens with a nice fresh load

Probably wise. Also, what version of KM are you on? When was the last time you regenerated your KM configuration?

I ask because base is an automation variable the gets set depending on a few things that are dependent 100% on the name of the KM entity triggered the automation to fire.

@TheFuzz4 just curious if your restart fixed it up for you…

Sorry been loading up my truck. YES the restart did the trick.
VRBO:
image
AirBNB
image
Booking is still having an issue but i’m not terribly worried about booking (don’t care much for them lol) I ended up deleting vrbo and recreating it as well which I think helped

Glad that resolved the issue for you :slight_smile:

Well now it is showing the entities but it doesn’t appear to be generating the files that are needed. I don’t have any automations for VRBO or Booking
image
is there a way to trigger the build of the files?

nevermind, helps if you select a door lock

Hey there, the github references using custom calendars, however when I use a .ics calendar it does not appear that the integration can “see” any events.

From your earlier post it seems so far it only works for AirBnB, Guesty, VRBO, and TripAdvisor. (Saw this thread after I tried running it), is there any roadmap to allow use of a .ics from somewhere other than there (Like google)?

There is nothing technically stopping you from using Google calendars. They do, however, have to be public calendars. Other than that, any calendar that has events conforms to one of the already stated calendar types should work.

That being said, I have not explicitly tested this and will do so in the near future, but I don’t see any reason it wouldn’t work as long the calendar is accessible without authentication like all the other platform calendars are.

@T0ML so I did a quick test of this. It does work with Google calendars and they don’t even need to be made public. You can get a “private” URL from your calendar that works. Look for the “Secret address in iCal format” section on your calendar settings.

Now, as to why it isn’t working for you, it’s because to support all of the different calendar platforms intelligently the integration inspects the event for tell-tale signs of the platform it’s coming from. It doesn’t do it based on the URL as that breaks my ability to do testing in a sane manner (I did originally do that).

So, what you need to do is make sure that your events all conform to one of the various platforms event formats: I will be listing the required information, extra information outside of these may cause other issues

Airbnb:
Event name: Reservation the returned event name will always be ‘Reserved’
Description: The description must contain the following piece of information, a reservation ID that matches the following Regex: [A-Z][A-Z0-9]{9}

VRBO:
Event name: Reservation - [additional verbage] The returned event name will be the additional verbage

Tripadvisor:
Event name: Tripadvisor[extra characters]: [additional verbage] (the regex here is Tripadvisor.*: (.*) ) The returned event name will be the “additional verbage”

Booking:
Event name: Closed - [additional verbage] the returned event name will be “additional verbage”

Guesty:
Event name: [Location name]-[Guest name]-[trip start and end dates which are ignored] The event name will be the Guest name

In all cases, if you want to use the last 4 digits for code driving then you must have the following in the event description:
(Last 4 Digits): XXXX

It must match against the following regex: \(Last 4 Digits\):\s+(\d{4})*

Now, you might be asking, can I make this a little more forgiving. Possible, but I will have to figure out how to fix the logic around getting the “slot name” which is what’s actually blowing up on random event definitions. I’ve created this issue for it.

Thanks for the tips!

I went and tried making some events on the calendar (Integration verifies it can see it):

But I am not having any luck with the integration. Logs show an error that I am not sure how to find (Im still new to HA, transitioning from SmartThings):

Any help would be appreciated. In the config I have it set to use the lock configured in lockmaster (confirms to work and works with setting codes / unlock / relock etc. If it makes a difference, I set the slot choice to 7. Errors occur both with it set to Ignore events that are not standard, and with that unchecked.

For some reason the code is trying to evaluate the slot name as a Booking event which would match the following regex: \\s\*CLOSED - (.\*) but it should only do that if the word CLOSED is in the Summary which I don’t see. Since you seem to be trying for the Guesty style event try setting the event Summary to this:

HOME-Test Renter-06 Oct-10 Oct

That is the format that Guesty put their summaries into. To be specific on what I’m matching for the regex it’s this: -(.\*)-.\*-

Alternatively, you might try something a little more simple, which is what I did with my initial tests. Do this:

Reserved - Test Renter

This should get you a slot named Test Renter

Now, as the the ignore events that are not standard. That’s a reference to the method in which all of the platforms seem to indicate that the block of time is not available. They do that with a Summary of either: Blocked or Not available. The option to not ignore those so that they end up in the sensors was a much requested feature. However, the primary use case of this is to drive locks and you really don’t care to have those events then.

@T0ML good news! I just released v0.8.0 and it now handles generic calendars significantly better. You no longer need to format the event summary like one of the platform calendars, just name the event the name you actually want the sensor / lock slot to get. Please note that if the integration detects a summary line similar to one of the platforms it will assume it’s from that platform though, so best to just name your reservations as an actual name :smiley:

Additional new features, variable length PIN codes. The software now supports codes of 4+ digits (in even increments) which should make it useful for people that have locks that require codes to be 6+ digits in length

ETAs are now more accurate and we have ETA in days, hours, and minutes and they’re actually accurate instead of being off by one like it was previously.

Finally, I fixed a major bug that I found in my own usage that could cause a lock slot to get dropped and then redeployed. This happened in cases of restarts where the calendar wasn’t fully ready before the integration flagged itself as ready and so if we could be in a situation where the calendar had no data and therefore it was detected that all the slots needed to be purged. Now, we don’t enable any of the features until the calendar has fully been loaded (successful retrieval from the calendar platform in question).

There has to be something I am missing here …

I am receiving a slightly different error now. I had gone and removed the previous integration and re-started from scratch (Error occurs when having something like: “John Smith Rental” and “Reserved - John Smith Rental”. Seems its a pathing error? Is there a path I am supposed to update in the config? I did have it adding it as an event before re-doing the integration , now im back at square one it seems

Digging into the logbook it looks like it thinks it changed the lock code, however I had gone and tried the code (did not show up in Keymaster) with no luck:

After a restart of the HA instance, it has nothing showing up in Logs. Any thoughts? I feel like im missing something absolutely silly… config below, I have changed to a public calendar address (both “secret” address from google and the public register as allowed per the integration. Had to combine the image above for the log book with info on the config:

Thanks again for any assistance you can provide!

Did you have Keymaster working properly before you started playing with RC?

I do have to say, I’m a little confused as to why it’s trying to put something into /config/packages/rental_control/renters/renters I’m assuming the integration you added you named Renters so I would expect it to try to put something in /config/packages/rental_control/renters.

You might consider removing the integration configuration, making sure that that the /config/packages/rental_control directory gets properly cleaned up, give HA a restart, and then try again. Do make sure that your lock is working properly with Keymaster first and that the starting slot + number of sensors is all configured in Keymaster. I see you’re doing starting slot 10 with 7 sensors. So you need to have at a minimum 16 slots defined in Keymaster starting at slot 1.