Any way to combine multiple entities into one garage door entity?

Hi folks, I made a DIY smart garage door with a relay running from a smart zigbee outlet to mimic pushing the garage door open button and then a zigbee door/window sensor to know when the garage door is open. (And I’m using ZHA FWIW).

Is there a way I can make these separate components seem like one smart garage door entity in home assistant? So that I will see a garage door listed there with appropriate icons (open or closed) instead of seeing two separate entities (the smart plug and the open/closed sensor. (And the automation I added to operate the door).

Ideally this would show up in the iOS Home app via the HomeKit integration as one entity too. (Although I imagine if I can figure this out in home assistant then iOS will just copy that).

Maybe able to use this:

1 Like

Okay thanks I think that should work! I can’t seem to figure out a couple of things though. It seems like the lovelace icons are back to front so that when the garage is closed the up arrow is greyed out and the down arrow is available. I might have something backwards in my configuration.yaml (posted below) but can’t figure out what.

Here’s what I have working: The square button (in the image below) operates the door and the icon updates correctly - ie whether the door is open or closed. I don’t think I have the position template configured properly but have tried a number of different position_ and value_template options and none seem to fit the bill… I may not have the open_ and close_cover pieces configured correctly - there wasn’t much info on them in the “covers” documentation…

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

As you can see in the photo the icon state is correct but I suspect it should be showing the up arrow as available and the down arrow as greyed out of the door is closed, no?

Try this, I think it will inverse the position template. I assume the magnet sensor is off when door is open ?

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
        friendly_name: "Garage Door"
        position_template: "{{ is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off', 'off') }}"
        open_cover:
          - condition: state
            entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
            state: "on"
          - service: switch.turn_on
            target:
              entity_id: switch.ewelink_sa_003_zigbee_on_off
        close_cover:
          - condition: state
            entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off
            state: "off"
          - service: switch.turn_on
            target:
              entity_id: switch.ewelink_sa_003_zigbee_on_off
        stop_cover:
          service: switch.turn_on
          target:
            entity_id: switch.ewelink_sa_003_zigbee_on_off
        icon_template: >-
          {% if is_state('binary_sensor.lumi_lumi_sensor_magnet_aq2_on_off', 'on') %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}
1 Like

Hi @Holdestmade, thanks for this. I’ve been slammed at work this week and so am only able to try this now. This looks like a step in the right direction, in that both arrows are now showing as white (ie “available to be pushed”).

Do you know how this is supposed to behave? I was assuming: if the magnet sensor is on the door is closed (yes, you were correct above) and only the up/open arrow should be available, and if the sensor is off the door is open and therefore only the down arrow should be available.

I suppose one could argue that if the door was partially open both arrows could be showing but my dumb “smart” relay isn’t going to know how to deal with that scenario : )