xman111
(Craig)
February 3, 2021, 5:36am
1
hey guys trying to get the status of our car in our garage. i copied the config on the opengarage docs, got the rest working but this sensor. I just cut a bit of my config.yaml to show. Trying to understand how to arrange multiple binary sensors, getting duplicate mapped binary sensor. Any help would be much appreciated. After this, going to try to get it working with mqtt.
# OpenGarage Config
cover:
platform: opengarage
covers:
garage:
host: 192.168.70.119
device_key: xxxxxx
name: Garage Door
sensor:
platform: template
sensors:
garage_status:
friendly_name: 'Garage Door Status'
value_template: '{% if states.cover.garage_door %}
{% if states.cover.garage_door.attributes["door_state"] == "open" %}
Open
{% elif states.cover.garage_door.attributes["door_state"] == "closed" %}
Closed
{% elif states.cover.garage_door.attributes["door_state"] == "opening" %}
Opening
{% elif states.cover.garage_door.attributes["door_state"] == "closing" %}
Closing
{% else %}
Unknown
{% endif %}
{% else %}
n/a
{% endif %}'
binary_sensor:
platform: template
sensors:
subaru_in_garage:
friendly_name: "Subaru In Garage"
value_template: "{{ state_attr('cover.garage_door', 'distance_sensor') < 100 }}"
availability_template: >-
{% if is_state('cover.garage_door','closed') %}
true
{% else %}
unavailable
{% endif %}
icon_template: >-
{% if is_state('binary_sensor.subaru_in_garage','on') %}
mdi:car
{% else %}
mdi:car-arrow-right
{% endif %}
unique_id: binary_sensor.subaru_in_garage
delay_on: 5
delay_off: 5
# Notify Config
notify:
- name: family_devices
platform: group
services:
- service: mobile_app_richelles_s10_mobile_app
- service: mobile_app_craigs_s20_mobile_app
# Time Sensor Config
binary_sensor:
- platform: workday
country: CA
province: BC
tom_l
February 3, 2021, 6:09am
2
Like this:
binary_sensor:
- platform: workday
country: CA
province: BC
- platform: template
sensors:
subaru_in_garage:
friendly_name: "Subaru In Garage"
value_template: "{{ state_attr('cover.garage_door', 'distance_sensor') < 100 }}"
availability_template: >-
{% if is_state('cover.garage_door','closed') %}
true
{% else %}
unavailable
{% endif %}
icon_template: >-
{% if is_state('binary_sensor.subaru_in_garage','on') %}
mdi:car
{% else %}
mdi:car-arrow-right
{% endif %}
unique_id: binary_sensor.subaru_in_garage
delay_on: 5
delay_off: 5
Each binary sensor is listed under binary_sensor:
with a -
. They can be in any order.
xman111
(Craig)
February 3, 2021, 6:23am
3
thanks for the quick reply Tom, really appreciate it. I have the sensor listed on my page but it says Subaru in garage off… do you see anything wrong in my config?
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
http:
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
ip_ban_enabled: true
login_attempts_threshold: 5
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
google_assistant: !include g_assistant_integration.yaml
# Google Maps Integration Config
device_tracker:
- platform: google_maps
username: [email protected]
max_gps_accuracy: 200
scan_interval: 20
binary_sensor:
- platform: workday
country: CA
province: BC
- platform: template
sensors:
subaru_in_garage:
friendly_name: "Subaru In Garage"
value_template: "{{ state_attr('cover.garage_door', 'distance_sensor') < 100 }}"
availability_template: >-
{% if is_state('cover.garage_door','closed') %}
true
{% else %}
unavailable
{% endif %}
icon_template: >-
{% if is_state('binary_sensor.subaru_in_garage','on') %}
mdi:car
{% else %}
mdi:car-arrow-right
{% endif %}
unique_id: binary_sensor.subaru_in_garage
delay_on: 5
delay_off: 5
# Logger Config
#logger:
# default: debug
# OpenGarage Config
cover:
platform: opengarage
covers:
garage:
host: 192.168.70.119
device_key: xxxxxxx
name: Garage Door
sensor:
platform: template
sensors:
garage_status:
friendly_name: 'Garage Door Status'
value_template: '{% if states.cover.garage_door %}
{% if states.cover.garage_door.attributes["door_state"] == "open" %}
Open
{% elif states.cover.garage_door.attributes["door_state"] == "closed" %}
Closed
{% elif states.cover.garage_door.attributes["door_state"] == "opening" %}
Opening
{% elif states.cover.garage_door.attributes["door_state"] == "closing" %}
Closing
{% else %}
Unknown
{% endif %}
{% else %}
n/a
{% endif %}'
# Notify Config
notify:
- name: family_devices
platform: group
services:
- service: mobile_app_richelles_s10_mobile_app
- service: mobile_app_craigs_s20_mobile_app
# Timer Config
timer:
two_minute_timer:
duration: '00:02:00'
name: Two Minute Timer
icon: mdi:timer
five_minute_timer:
duration: '00:05:00'
name: Front Door Timer
icon: mdi:timer
# Lutron Config
lutron_caseta_pro:
bridges:
- host: 192.168.10.96
mac: 18:93:d7:e1:26:12
# Time Sensor Config
# Lifx Config
lifx:
light:
- server: 192.168.10.145
port: 56700
broadcast: 192.168.20.110
# Zwave Config
zwave:
usb_path: /dev/serial/by-id/usb-0658_0200-if00
network_key: "0x55, 0x78, 0x3e, 0x49, 0x1a, 0x99, 0xe4, 0xcd, 0x64, 0xa2, 0x4c, 0x12, 0x86, 0x41, 0x11, 0xe3"
config_path: /config/open-zwave/config
# Tplink Config
tplink:
discovery: false
strip:
- host: 192.168.70.107
- host: 192.168.70.108
- host: 192.168.70.112
dimmer:
- host: 192.168.70.111
- host: 192.168.70.109
- host: 192.168.70.113
- host: 192.168.70.118
tom_l
February 3, 2021, 7:02am
4
Maybe. Your template for the distance could be comparing a string to a number. To be sure it is a number, convert the attribute to a number like so:
value_template: "{{ state_attr('cover.garage_door', 'distance_sensor')|float < 100 }}"
Also your availability template needs to return either true or false. Try this:
availability_template: "{{ is_state('cover.garage_door','closed') }}"
Not an issue but your icon template can be simplified:
icon_template: "mdi:car{{ '' if is_state('binary_sensor.subaru_in_garage','on') else '-arrow-right' }}"
xman111
(Craig)
February 3, 2021, 7:15am
5
thanks for the suggestions Tom. not sure what’s going on. When the garage door is closed, it says Subaru in Garage Off, when i open the garage door and not move the car, it says Subaru in Garage Unavailable.
tom_l
February 3, 2021, 7:22am
6
That is what your availability template does (I was wondering why you had this). The sensor is only available when the door is closed. Remove this completely to prevent that happening:
availability_template: "{{ is_state('cover.garage_door','closed') }}"
xman111
(Craig)
February 3, 2021, 7:24am
7
that’s weird, I was just copying from the home assistant docs. will try, thanks.
tom_l
February 3, 2021, 7:24am
8
Can you post the link from where you copied it please?
xman111
(Craig)
February 3, 2021, 7:36am
9
of course. sorry if the formatting is weird, on my phone, in bed, lol.
xman111
(Craig)
February 3, 2021, 4:13pm
10
anyone see anything i missed?
tom_l
February 3, 2021, 4:17pm
11
What does your sensor look like now?
xman111
(Craig)
February 3, 2021, 4:31pm
12
hey Tom, i just made the changes you suggested. the car isn’t there now and the garage is closed. Here is a screenshot of the actual opengarage interface and one of my home assistant card.
xman111
(Craig)
February 3, 2021, 4:38pm
14
will do, just heading into a meeting… thanks for trying to help Tom.
tom_l
February 3, 2021, 4:41pm
15
I guess we can’t actually test it until the car is back in the garage.
xman111
(Craig)
February 3, 2021, 4:46pm
16
probably not, lol… im sure you may still find an error though, trying to understand the configuration.yaml has been challenging to say the least. HA does everything i want but everytime i try something new, it takes me about a week… here is the code
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
http:
ssl_certificate: /ssl/fullchain.pem
ssl_key: /ssl/privkey.pem
ip_ban_enabled: true
login_attempts_threshold: 5
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
google_assistant: !include g_assistant_integration.yaml
# Google Maps Integration Config
device_tracker:
- platform: google_maps
username: [email protected]
max_gps_accuracy: 200
scan_interval: 20
binary_sensor:
- platform: workday
country: CA
province: BC
- platform: template
sensors:
subaru_in_garage:
friendly_name: "Subaru In Garage"
value_template: "{{ state_attr('cover.garage_door', 'distance_sensor')|float < 100 }}"
icon_template: "mdi:car{{ '' if is_state('binary_sensor.subaru_in_garage','yes') else '-arrow-right' }}"
unique_id: binary_sensor.subaru_in_garage
delay_on: 5
delay_off: 5
# Logger Config
#logger:
# default: debug
# OpenGarage Config
cover:
platform: opengarage
covers:
garage:
host: 192.168.70.119
device_key: xxxxxxxxxxxx
name: Garage Door
sensor:
platform: template
sensors:
garage_status:
friendly_name: 'Garage Door Status'
value_template: '{% if states.cover.garage_door %}
{% if states.cover.garage_door.attributes["door_state"] == "open" %}
Open
{% elif states.cover.garage_door.attributes["door_state"] == "closed" %}
Closed
{% elif states.cover.garage_door.attributes["door_state"] == "opening" %}
Opening
{% elif states.cover.garage_door.attributes["door_state"] == "closing" %}
Closing
{% else %}
Unknown
{% endif %}
{% else %}
n/a
{% endif %}'
# Notify Config
notify:
- name: family_devices
platform: group
services:
- service: mobile_app_richelles_s10_mobile_app
- service: mobile_app_craigs_s20_mobile_app
# Timer Config
timer:
two_minute_timer:
duration: '00:02:00'
name: Two Minute Timer
icon: mdi:timer
five_minute_timer:
duration: '00:05:00'
name: Front Door Timer
icon: mdi:timer
# Lutron Config
lutron_caseta_pro:
bridges:
- host: 192.168.10.96
mac: 18:93:d7:e1:26:12
# Time Sensor Config
# Lifx Config
lifx:
light:
- server: 192.168.10.145
port: 56700
broadcast: 192.168.20.110
# Zwave Config
zwave:
usb_path: /dev/serial/by-id/usb-0658_0200-if00
network_key: "0x55, 0x78, 0x3e, 0x49, 0x1a, 0x99, 0xe4, 0xcd, 0x64, 0xa2, 0x4c, 0x12, 0x86, 0x41, 0x11, 0xe3"
config_path: /config/open-zwave/config
# Tplink Config
tplink:
discovery: false
strip:
- host: 192.168.70.107
- host: 192.168.70.108
- host: 192.168.70.112
dimmer:
- host: 192.168.70.111
- host: 192.168.70.109
- host: 192.168.70.113
- host: 192.168.70.118
xman111
(Craig)
February 4, 2021, 11:56pm
17
anything else? about ready to give up on this, lol…
calypso
November 21, 2021, 7:29am
18
Since the update which brought OpenGarage in as an integration that is configured by the front end, this has now broken the sensors which were in place before.
Unfortunately, there is no updated documentation. Has anyone been able to update the sensors for garage door state and if there is a car in the garage?
3 Likes
xman111
(Craig)
November 21, 2021, 10:06pm
19
my car in garage seems to work with “binary_sensor.garagedoor_vehicle”, but it says on and off, need to try to change that to yes/no.
for the garage door status, i left the old things in my config.yaml and it seems to work, not sure if it would work if I deleted them.
tried getting rid of the garage door status in my config.yaml and it didn’t work as intended. put it back in and now it says closed or open, not opening and closing, so at least it’s working.
jayw
(Jay)
February 6, 2022, 4:22pm
20
I deleted all the YAML from my conigs and now the cover is not reading correctly. This is despite it showing correctly in the OpenGarage interface itself through the web browser.