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:
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:
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:
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):