Sonoff 4 CH switch as garage door

Hi, I’m new to this.

I have a Sonoff 4 channel switch which is connected to both my garage doors. The switch only sends a toggle signal, not a dedicated ‘on’ or ‘off.’

I also have a Wyze contact sensor which is connected to Home Assistant, I want to know if you can maybe write a configuration so it becomes one ‘garage door’ entity?

My end goal is to have my garage doors as a homekit accessory which shows ‘open or ‘close’ if someone has the time, can you please help me? It will be much appreciated!

Yes you can.

Thanks, I will look into it! Do you think it will work with Homekit then?

(Will it show up as a garage door?)

Yes, it’s in the supported components: https://www.home-assistant.io/integrations/homekit/#supported-components

Thank you very much! :grin::+1:

Hi, I tried out the template cover and the icon shows up in Home Assistant the state shows up, but when I press the button to open it gives out this message:

‘Failed to call service cover/open.cover. Unable to find service switch/sonoff_leftgarage.’

My configuration.yaml file looks like this

And my entities:

I would really much appreciate if you could help!

Please read the document, your configuration is wrong.


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

Hello, thank you for replying so fast!
I changed my configuration.yaml and it’s now this:

But when I look on Home Assistant it doesn’t show the open button?

And when I open it, it keeps on showing “Opening…” and never saying “Opened”.

And when closing it does nothing, I think it may be because I’m using a Sonoff switch and sending a “off” command does nothing. Do you maybe know how I can fix this?

And it keeps saying it’s open when it is closed?

Is there maybe a way to reverse it?