I am trying to get a simple garage door cover to work

I have a simple garage door (well two, but if I can get one working then…) I have a magnetic switch on the door to indiacte when it is either closed or open. The control motor needs a momentary contact ( I have a relay for this) to either open or close the door. I have this code that the switch on it will activate the relay (either on or off not momentary at the moment) And the status of the door isn’t working. I am at a loss as how to make this work.

cover:

  • platform: template
    covers:
    garage_door:
    device_class: garage
    friendly_name: “Honda Door”
    unique_id: “Honda Door”
    value_template: ‘{{ states(“binary_sensor.honda_door_contact_2”) }}’
    open_cover:
    - service: switch.turn_on
    target:
    entity_id: switch.honda_door_relay
    close_cover:
    - service: switch.turn_on
    target:
    entity_id: switch.honda_door_relay
    stop_cover:
    - service: switch.turn_on
    target:
    entity_id: switch.honda_door_relay
    icon_template: >-
    {% if is_state(‘binary_sensor.honda_door_contact_2’, ‘closed’) %}
    mdi:garage
    {% elif is_state(‘binary_sensor.honda_door_contact_2’, ‘closing’) %}
    mdi:garage-alert
    {% elif is_state(‘binary_sensor.honda_door_contact_2’, ‘opening’) %}
    mdi:garage-alert
    {% elif is_state(‘binary_sensor.honda_door_contact_2’, ‘error’) %}
    mdi:magnet-on
    {% else %}
    mdi:garage-open
    {% endif %}

template:

  • trigger:
    • platform: state
      entity_id:
      • binary_sensor.garage_door_open
      • binary_sensor.garage_door_closed
      • input_text.garage_rotary_state
    • platform: homeassistant
      event: start
      sensor:
    • name: “Garage Door Status”
      unique_id: “binary_sensor.honda_door_contact_2”
      state: >
      {% if is_state(‘binary_sensor.garage_door_closed’, ‘on’) and is_state(‘binary_sensor.garage_door_open’, ‘on’) %}
      error
      {% elif is_state(‘binary_sensor.garage_door_closed’, ‘on’) %}
      closed
      {% elif is_state(‘binary_sensor.garage_door_open’, ‘on’) %}
      open
      {% elif trigger.platform != ‘homeassistant’ %}
      {% if (trigger.to_state.state == ‘off’ and trigger.from_state.state == ‘on’ and trigger.entity_id == ‘binary_sensor.garage_door_open’) %}
      closing
      {% elif (trigger.to_state.state == ‘off’ and trigger.from_state.state == ‘on’ and trigger.entity_id == ‘binary_sensor.garage_door_closed’) %}
      opening
      {% elif is_state(‘input_text.garage_rotary_state’, ‘opening’) %}
      opening
      {% elif is_state(‘input_text.garage_rotary_state’, ‘closing’) %}
      closing
      {% endif %}
      {% else %}
      open
      {% endif %}

My door contact is : binary_sensor.honda_door_contact_2
My switch / relay is: switch.honda_door_relay

Any quidance is much appreciated

Hi,

have you been able to solve this?
I have a similar setup (z-wave relay to trigger up/down and z-wave contact sensor for state monitoring) and my cover with a switch works well.
The only thing I would like to do is to combine the contact and switch to open / close meaningfully.

My cover config is:

# Garage
- platform: cover_rf_time_based
  devices:
    my_garage_door_time_based:
      name: Garagentor
      travelling_time_up: 16
      travelling_time_down: 30
      close_script_entity_id: switch.garagentor_5
      stop_script_entity_id: switch.garagentor_5
      open_script_entity_id: switch.garagentor_5
      send_stop_at_ends: False #optional
      always_confident: False #optional
      device_class: garage #optional