Homekit Garage Door & CarPlay

Hi All,

I recently added the HomeKit integration. I only want one thing out of HomeKit and that’s for my Garage door opened to appear on the CarPlay screen when I get close to home. It didn’t work out of the box unfortunately something isn’t right, I’m using an ESP Home device as the controller and I have the device class set as garage_door

I have my home address set in my contacts card and it recognises when i’m home. I have two switches one is the binary sensor from ESPhome and one is an input boolean which is my day to day control and it runs though my alarm state in node red as not to set the alarm off if I try to open the garage door and its armed.

My thinking is its somehow down to the device class definition between home assistants “garage_door” and HomeKits “garage”

Can anyone offer any advice or point me in the right direction?

Cheers
Matt

The device_class of ‘garage_door’ is for a binary_sensor. For the actual garage entity (garage.my_door) the device class is just ‘garage’.

Update the device class, remove it from HomeKit, add it again.

Thank you for helping !

I found a Cover template which has generated a “cover.garage_door” entity but its not working.

Here is the Config

switch.garage_control = The physical ESP switch to toggle on/off
binary_sensor.garage_door = The Sensor state on/off (open/close) status

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        position_template: "{{ states('binary_sensor.garage_door') }}"
        open_cover:
          - condition: state
            entity_id: binary_sensor.garage_door
            state: "off"
          - service: switch.toggle
            target:
              entity_id: switch.garage_control
        close_cover:
          - condition: state
            entity_id: binary_sensor.garage_door
            state: "on"
          - service: switch.toggle
            target:
              entity_id: switch.garage_control
        stop_cover:
          service: switch.toggle
          target:
            entity_id: switch.garage_control
        icon_template: >-
          {% if states('binary_sensor.garage_door')|float > 0 %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

I found the Garage template from here Template cover - Home Assistant

This is how it shows up now:

I just went out in the car and its now presending me with the control on the CarPlay screen. Just need to figure the control out.

1 Like

Try this template…

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        position_template: "{{ states('binary_sensor.garage_door') }}"
        open_cover:
          - service: switch.turn_on
            data:
              entity_id: switch.garage_control
        close_cover:
          - service: switch.turn_on
            data:
              entity_id: switch.garage_control
        stop_cover:
          service: switch.turn_on
          data:
            entity_id: switch.garage_control
        icon_template: >-
          {% if states('binary_sensor.garage_door') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

If this doesn’t work, replace “position_template” with “value_template” and see if that helps.

1 Like

The Buttons are working in HA under the “Cover” entity now but the sensor for open/closed isn’t. Its saying the door is open when its closed. It doesn’t flip to closed if I open it so its not inverted.

Where the binary sensor shows it as OFF

I had a look at the criteria for a value_template and this is looking for open/closed. Could this be the problem ?
image

@whoismoses I got it working, I found a few other posts in the general config section and managed to get it going ! State changes Open/Opening/Closing/Closed all work along with the icons.

Here is my config now;

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        value_template: "{{ is_state('binary_sensor.garage_door', 'on') }}"
        open_cover:
          service: switch.turn_on
          entity_id: switch.garage_control
        close_cover:
          service: switch.turn_on
          entity_id: switch.garage_control
        stop_cover:
          service: switch.turn_on
          entity_id: switch.garage_control
        icon_template: >-
          {% if states('binary_sensor.garage_door')|float > 0 %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}
5 Likes

old thread, but i hope i can get my question answered anyway.
I have managed to get my garage door to be visible in home app and i can open close the garage door via my iPhone, however, in CarPlay i get the garage door to pop up when close to my home, but the unit is stated as unavaliable so i cannot press the button in the car. if i look at my iphone at the same time, i can open and close. anyone know what to do?

You could try restaring your phone and if the car radio supports it that also. I have a VW and if I push the volume button for 10 seconds it reboots the audio system (its a computer after all)

Worth a try maybe

Realized that i was a bit wrong here. went to the car again and tried to get it working but it seems that when I’m not at my local wifi, the button gets offline.
The problem is that i connect my iPhone to my id3 using wifi to get CarPlay working.
But when I’m on wifi with CarPlay i cannot connect to my wifi in the household.
soooo, any suggestions on how to get HomeKit to work without wifi from my home network? (connect thru 4g instead)

I don’t know, it sounds like your almost there, does your data work ok in the car when your driving around loading maps and streaming music for example.

Is it using the iPhones data or does the car also have a built in Wi-Fi hotspot that separate?

in the car everything is working perfectly, i think it uses my iPhone data.
if i drive the car away from my house, my garage door button disappears, and when i return close to my house the button gets visible, so it seems to work, except that the button states (offline) due to the fact that i am not connected to my local wifi.
So i need to get HomeKit to talk outside my local wifi.
i am getting there :slight_smile:

Solved it, hard reboot on all apple products solved the issue! :slight_smile:

awesome glad you got it working :ok_hand:

1 Like

Anybody do this with a door lock? I’d love to have a lock on the carplay screen.

Hi mattcony, is it necessary to create a scene/automation in iOS home application, or does it work out of the box once covers are configured inside HA?
Thanks

I’ve got the same issue that my HA is local only so my iPhone/HomeKit loses connection to devices when off the home network but then I found this that may help others…….
Before you can trigger actions (via HomeKit)when you’re away from home, you need to designate a device as a home hub, which remains powered on and connected at your home when you’re away. Click on one of the links below to learn how to set up an Apple device as a home hub.…

link to follow

1 Like