Airbnb automation (dynamic calendars based on guests)

For the last year or so I’ve rented out my detached studio on airbnb and pretty soon after I saw the potential for a couple of smarts around the whole thing to help me and my guests.

My current things that I do are:

  • Sync my airbnb calendar with google calendar -> home assistant
  • Use this dynamic calendar to fire off automations
  • Use a kiosked tablet inside for them to access part of home assistant

My future wishlist includes wanting to send an automated email to a guest with a PDF of instructions. I don’t yet know a good way of sending an email with a PDF attachment (help anyone?). I don’t yet want to go the full electronic lock method with a rolling code as it needs to be 100% failsafe (which my analogue lock box is).

Syncing Airbnb calendar

In ‘availability’ settings on airbnb, you can get an export link here:
1

From here you can import it into Google Calendar and then bring that calendar into HA (I’m not going to reproduce the steps here because it’s quite simple).

Once that’s in, you can view the calendar in HA:

I split out the attributes by creating a couple of template sensors:

- platform: template
  sensors:
    event_title_airbnb:
      friendly_name: 'Guest'
      value_template: "{{ states.calendar.airbnb.attributes.message.split('(')[0]  }}"

    event_start_airbnb:
      friendly_name: 'Check In'
      value_template: "{{(as_timestamp(states.calendar.airbnb.attributes.start_time)) | timestamp_custom('%A, %d/%m') }}"

    event_end_airbnb:
      friendly_name: 'Check Out'
      value_template: "{{(as_timestamp(states.calendar.airbnb.attributes.end_time)) | timestamp_custom('%A, %d/%m') }}"   

From there I created a new group to display it nicely:
3

Automations

So it’s all well and good having sensors, but we need automations! I’m quite energy concious and have solar panels, so I want hot water going only when there is a booking and when the sun is above a certain angle (regardless of if it’s sunny/cloudy). Then I have a heater which dynamically turns on and off depending on my solar generation/household consumption.

The hot water automation is as follows:

  - alias: Hot Water On during stay
    hide_entity: False
    trigger:
      platform: numeric_state
      entity_id: sun.sun
      value_template: "{{ state.attributes.elevation }}"
      above: 24
    condition:
      condition: template
      value_template: "{{ states.calendar.airbnb.state == 'on' }}"
    action:
      - service: mqtt.publish
        data:
          topic: "/sensor/studio"
          payload: "hotwateron"
          retain: true            

  - alias: Hot Water Off during stay
    hide_entity: False
    trigger:
      platform: numeric_state
      entity_id: sun.sun
      value_template: "{{ state.attributes.elevation }}"
      below: 23
    condition:
      condition: template
      value_template: "{{ states.calendar.airbnb.state == 'on' }}"
    action:
      - service: mqtt.publish
        data:
          topic: "/sensor/studio"
          payload: "hotwateroff"
          retain: true 

I also turn the hot water heater on at 12pm the day before and off at 3pm the day before (to pre-heat if they arrive early). This one was tricky as I couldn’t get it working any other way than than by checking (triggering) at regular time intervals otherwise the automation would not fire:

  - alias: Hot Water On day before
    hide_entity: False
    trigger:
      platform: time
      minutes: '/1'
      seconds: 00
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: '{{ as_timestamp(now()) | int > (as_timestamp(states.calendar.airbnb.attributes.start_time)-43220) | int }}' 
        - condition: template
          value_template: '{{ as_timestamp(now()) | int < (as_timestamp(states.calendar.airbnb.attributes.start_time)-43180) | int }}' 
    action:
      - service: mqtt.publish
        data:
          topic: "/sensor/studio"
          payload: "hotwateron"
          retain: true 
##10:00AM - 79220 seconds = 11:59:40 on day before
       
        
  - alias: Hot Water Off day before
    hide_entity: False
    trigger:
      platform: time
      minutes: '/1'
      seconds: 00
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: '{{ as_timestamp(now()) | int > (as_timestamp(states.calendar.airbnb.attributes.start_time)-32420) | int }}' 
        - condition: template
          value_template: '{{ as_timestamp(now()) | int < (as_timestamp(states.calendar.airbnb.attributes.start_time)-32380) | int }}' 
    action:
      - service: mqtt.publish
        data:
          topic: "/sensor/studio"
          payload: "hotwateroff"
          retain: true          
##10:00AM - 66620 seconds = 3:29:40 on day before

I monitor my electricity usage so turning a heater on and off dynamically was actually quite easy:

  - alias: MQTTStudioheateron
    hide_entity: False
    trigger:
      platform: numeric_state
      entity_id: sensor.excess
      above: 430
    condition:
      - condition: numeric_state
        entity_id: sensor.studio_temperature_inside
        above: 1
        below: 21
      - condition: template
        value_template: "{{ states.calendar.airbnb.state == 'on' }}"      
    action:
      service: mqtt.publish
      data:
        topic: "/sensor/studio"
        payload: "On"  
        #message to turn relay on

        
        
  - alias: MQTTStudioheateroff
    hide_entity: False
    trigger:
      - platform: numeric_state
        entity_id: sensor.excess
        below: 0
      - platform: numeric_state
        entity_id: sensor.studio_temperature_inside
        above: 21
    action:
      service: mqtt.publish
      data:
        topic: "/sensor/studio"
        payload: "Off"          
        #message to turn relay on

Both of the results in my electricity generation/consumption to closely follow each other on cold/sunny days which is exactly what I wanted:

4

Kiosked Tablet

I have an old Nexus 7 running Fully Kiosk Browser (highly recommended to buy it) which allows the guest to access some info including temperatures, real time train departures from nearby train station and allows them to manually turn on the hot water heater for 60 mins if they need more hot water (simple script):

9 Likes

That’s really cool how you are combining HA with your guest staying over via AirBNB. Good stuff!

Thank you ! I now have Airbnb integrated too. Plan to also add Next Guest group.

How do you measure power ?

Sorry for the delayed reply.

I do it with two methods:

A Fluksometer (shop | Flukso) reading the pulses from a pulse meter (https://www.aliexpress.com/item/5-65-A-230V-50HZ-reset-to-zero-show-voltage-current-power-Single-phase-Din-rail/1366282678.html) and then exporting MQTT values to HA.

An arduino (or similar) reading pulses from the same meter and then exporting MQTT values to HA.

I have tried using HA to read the pulses from the meter but ran into reliability/debounce issues after a bit of perservering.

Any luck on this one?

It should be easy enough if we could use a template for the calendar seach, i.e.:

- cal_id: [email protected]
  entities:
  - device_id: airbnb
    name: Airbnb
    track: true
    search: {{ CHECK IN:  [currentdate+5days]}}

Not the correct date syntax, but you get my drift? But I don’t think you can search for dynamic terms in this way.

Did you have another idea in mind?

Hello, really interesting idea. Can I ask you how you did to enter the train departures board and how you can split the guest screen and personal screen on your server HA? Thank’s

Train departures are entirely Sydney, AU specific, with discussion on it here: Transport NSW / Sydney Bus, Ferry and Train schedule

Also kiosk mode is discussed here: https://www.home-assistant.io/blog/2017/07/15/release-49/

Hi, I ran your tutorials and I managed to insert the calendar airbnb in the home assistant. Thank you very much for this. There is a small problem that I would like to stress. If I activate the Airbnb calendar button, I get the actual dates of the reservation. If I look at the Group the ceck in and the ceck out anticipate by one day. Can you help me?

Hmm, I’m not sure. It might be a time zone issue (different from airbnb servers to your HA)?? I’ve never had the problem.

Hey, very good !!!
It was enough to enter my timezone in config.yaml. Thank you!!!

Allow me another question: why in the section of all calendars, some calendars are active and others are off?
-“Airbnb”, is deactivated while in the group is active and works perfectly.

  • “Festività” is off while in google calendar is active


I’m not too familiar with google calendars, but I think it’s only ‘active’/on when there’s a calendar event on and ‘deactive’/off when there’s no calendar event.

1 Like

Very well everything is clear. Thank you so much for your precious support!!!

Hi Serra, at first I thought I had solved the problem of the next ceck in. In reality it does not work well. In the meantime, have you solved it?
Can you see the ceck-in the next 5 days?

I’m curious, has anyone used this to set a smart lock to the last 4 digits of the guests phone number? I am currently doing this manually and it would be neat to automate it.

3 Likes

Would be very easy to extract it from the calendar attributes, but airbnb are making a few changes in December which essentially make this thread useless (they’re not including details in synced calendars).

Bummer, it looks like there is an Airbnb API, but right now it’s not publicly available. I’m on a plane flying home from Hawaii right now and the wifi isn’t the best to do detailed searching with :slight_smile:

An Airbnb integration would be really great to have.

Hi
Can you explain how you made this “card”

Hi guys,

I’m planning to rent out my flat via Airbnb, I would love to be able to give access to guests to HA, by automatically generating for them credentials based on their bookings, anyone that has done something similar already? Any idea/suggestion?

Thank you!