Combine two entity for homekit bridge

hello, I have two entity one is Broadlink rf to open the garage and the other one is a contact sensor to know the state of the garage open/close

i want to combine them to looks like this image, notice bottom right corner with a click I can open and close the garage while knowing its state.

is there’s a way to achieve that?
it’s easy to achieve that in Lovelace but when using Homekit Bridge it’s a different story :frowning:

Have you tried a template cover?

i did after reading your comment never knew about such thing
here’s my code

  - platform: template
        friendly_name: "Garage Door"
        position_template: "{{ states('binary_sensor.contact_garage') }}"
          service: switch.toggle
            entity_id: switch.switch_garage_door
          service: switch.toggle
            entity_id: switch.switch_garage_door
        icon_template: >-
          {% if states('binary_sensor.contact_garage') == "on"%}
          {% else %}
          {% endif %}

it work on my lovelace but on homekit it show the state of the switch not the sensor :frowning:
does my code need changing?

Replace this:

position_template: "{{ states('binary_sensor.contact_garage') }}"

With this:

value_template: "{{ is_state('binary_sensor.contact_garage', 'on') }}"

The position template requires a number from 1 to 100. The value template is used with binary on/off open/closed sensors

thanks, but the main problem still the same it show the state of the switch not the sensor :frowning:

It shouldn’t. The template determines the state. Maybe there’s an issue with the template cover. This person is having the same issue:

Is your sensor on or off when the cover is open?

yeah just tested opening the sensor do change to open and closing change to close
but when clicking it will change from open to close even though the sensor is open
but when closing the sensor the state remain close so that a good thing

now that i know the sensor do change the state how can i disable the switch from changing the state XD

As I said, the switch should never change the state, only the value template should. There could be an issue with the integration. You can open an issue here:

FYI, I created an Issue as suggested by tom_I.

Please add any additional info you might have