OpenGarage and car in garage sensor issue

Hello All,

I am fairly new to Home Assistant and I have been cobbling my HA environment together from examples found on the web. I am currently running 2020.12.1 in a docker container.

I just purchased an Open Garage to add to HA and it is mostly working using the example from here: https://www.home-assistant.io/integrations/opengarage/

But, I am having an issue getting the car in garage sensor to show up at all in HA.

Here is the entries from my configuration.yaml file:

cover:
  platform: opengarage
  covers:
      garaged1:
        host: 192.168.102.21
        device_key: !secret opengarage_key
        name: toyota
      garaged2:
        host: 192.168.102.22
        device_key: !secret opengarage_key
        name: tesla
sensor:
  - platform: template
    sensors:
      garaged1_status:
        friendly_name: 'Toyota Door Status'
        value_template: '{% if states.cover.toyota %}
            {% if states.cover.toyota.attributes["door_state"] == "open" %}
              Open
            {% elif states.cover.toyota.attributes["door_state"] == "closed" %}
              Closed
            {% elif states.cover.toyota.attributes["door_state"] == "opening" %}
              Opening
            {% elif states.cover.toyota.attributes["door_state"] == "closing" %}
              Closing
            {% else %}
              Unknown
            {% endif %}
            {% else %}
            n/a
            {% endif %}'
        icon_template: >-
          {% if states.cover.tesla.attributes["door_state"] == "open" %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}
      garaged2_status:
        friendly_name: 'Tesla Door Status'
        value_template: '{% if states.cover.tesla %}
            {% if states.cover.tesla.attributes["door_state"] == "open" %}
              Open
            {% elif states.cover.tesla.attributes["door_state"] == "closed" %}
              Closed
            {% elif states.cover.tesla.attributes["door_state"] == "opening" %}
              Opening
            {% elif states.cover.tesla.attributes["door_state"] == "closing" %}
              Closing
            {% else %}
              Unknown
            {% endif %}
            {% else %}
            n/a
            {% endif %}'
        icon_template: >-
          {% if states.cover.tesla.attributes["door_state"] == "open" %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

binary_sensor:
  - platform: template
    sensors:
      toyota_in_garage:
        friendly_name: "Toyota In Garage"
        value_template: "{{ state_attr('cover.toyota', 'distance_sensor') < 100 }}"
        availability_template: >-
          {% if is_state('cover.toyota','closed') %}
            true
          {% else %}
            unavailable
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.toyota_in_garage','on') %}
            mdi:car
          {% else %}
            mdi:car-arrow-right
          {% endif %}
        unique_id: binary_sensor.toyota_in_garage
        delay_on: 5
        delay_off: 5
      tesla_in_garage:
        friendly_name: "Tesla In Garage"
        value_template: "{{ state_attr('cover.tesla', 'distance_sensor') < 100 }}"
        availability_template: >-
          {% if is_state('cover.tesla','closed') %}
            true
          {% else %}
            unavailable
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.tesla_in_garage','on') %}
            mdi:car
          {% else %}
            mdi:car-arrow-right
          {% endif %}
        unique_id: binary_sensor.tesla_in_garage
        delay_on: 5
        delay_off: 5

The door status, open/close, etc work fine. What isn’t working is the toyota_in_garage or the tesla_in_garage sensors. They don’t appear to be created and as a result, I get an error in the group.

There are no errors in the logs either.

I have checked the yaml in a yaml online checker and it looks good, so I feel like I am just missing something minor. Any suggestions what might be wrong/missing?

Ok. I got this to work. here is my final config

cover:
  platform: opengarage
  covers:
      garaged1:
        host: 192.168.102.21
        device_key: !secret opengarage_key
        name: toyota
      garaged2:
        host: 192.168.102.22
        device_key: !secret opengarage_key
        name: tesla

group:
  garage:
    name: Garage
    entities:
      - cover.toyota
      - sensor.garaged1_status
      - sensor.toyota_in_garage
      - cover.tesla
      - sensor.garaged2_status
      - sensor.tesla_in_garage

sensor:
      garaged1_status:
        friendly_name: 'Toyota Door Status'
        value_template: '{% if states.cover.toyota %}
            {% if states.cover.toyota.attributes["door_state"] == "open" %}
              Open
            {% elif states.cover.toyota.attributes["door_state"] == "closed" %}
              Closed
            {% elif states.cover.toyota.attributes["door_state"] == "opening" %}
              Opening
            {% elif states.cover.toyota.attributes["door_state"] == "closing" %}
              Closing
            {% else %}
              Unknown
            {% endif %}
            {% else %}
            n/a
            {% endif %}'
        icon_template: >-
          {% if states.cover.toyota.attributes["door_state"] == "closed" %}
            mdi:garage
          {% else %}
            mdi:garage-open
          {% endif %}
      garaged2_status:
        friendly_name: 'Tesla Door Status'
        value_template: '{% if states.cover.tesla %}
            {% if states.cover.tesla.attributes["door_state"] == "open" %}
              Open
            {% elif states.cover.tesla.attributes["door_state"] == "closed" %}
              Closed
            {% elif states.cover.tesla.attributes["door_state"] == "opening" %}
              Opening
            {% elif states.cover.tesla.attributes["door_state"] == "closing" %}
              Closing
            {% else %}
              Unknown
            {% endif %}
            {% else %}
            n/a
            {% endif %}'
        icon_template: >-
          {% if states.cover.tesla.attributes["door_state"] == "closed" %}
            mdi:garage
          {% else %}
            mdi:garage-open
          {% endif %}
      toyota_in_garage:
        friendly_name: "Toyota in Garage"
        value_template: >
          {% if is_state('binary_sensor.toyota_in_garage', 'on') %}
            Yes
          {% elif is_state('binary_sensor.toyota_in_garage', 'off') %}
            No
          {% else %}
            Unknown
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.toyota_in_garage','on') %}
            mdi:car
          {% else %}
            mdi:car-arrow-right
          {% endif %}
      tesla_in_garage:
        friendly_name: "Tesla in Garage"
        value_template: >
          {% if is_state('binary_sensor.tesla_in_garage', 'on') %}
            Yes
          {% elif is_state('binary_sensor.tesla_in_garage', 'off') %}
            No
          {% else %}
            Unknown
          {% endif %}
        icon_template: >-
          {% if is_state('binary_sensor.tesla_in_garage','on') %}
            mdi:car
          {% else %}
            mdi:car-arrow-right
          {% endif %}

binary_sensor:
  - platform: template
    sensors:
      toyota_in_garage:
        friendly_name: "Toyota In Garage"
        value_template: "{{ state_attr('cover.toyota', 'distance_sensor') < 150 }}"
        availability_template: >-
          {% if is_state('cover.toyota','closed') %}
            true
          {% else %}
            unavailable
          {% endif %}
        unique_id: binary_sensor.toyota_in_garage
        delay_on: 5
        delay_off: 5
      tesla_in_garage:
        friendly_name: "Tesla In Garage"
        value_template: "{{ state_attr('cover.tesla', 'distance_sensor') < 150 }}"
        availability_template: >-
          {% if is_state('cover.tesla','closed') %}
            true
          {% else %}
            unavailable
          {% endif %}
        unique_id: binary_sensor.tesla_in_garage
        delay_on: 5
        delay_off: 5

Hopefully this will help someone in the future.

1 Like