The OpenGarage.io device uses sensors to detect the presence of a car. It also detects the garage door when it is fully opened, which blocks line of sight to the car’s spot. Thus, when opening the garage (often but not always to move the car into or out of it), the vehicle presence sensor goes to “Unavailable”.
This makes writing triggers difficult. I cannot write a trigger that checks the state of the car presence going from on to off, because unavailable shows up in the middle.
How can I make that work? How can I do something simple like “if car goes from away (off) to home (on), turn on light”?
Ideally the integration for OpenGarage would not change the car presence to unavailable when the garage door opens, but that’s just my opinion.
You can’t do it entirely via the UI, but if you edit the yaml of your trigger you can specify ‘not_from’. See the documentation here: Automation Trigger - Home Assistant
Here’s one of my automation triggers as an example:
trigger:
- platform: state
entity_id:
- alarm_control_panel.home_alarm
id: MANUALLY_DISARMED
to: disarmed
not_from:
- unknown
- unavailable
Does this keep waiting if it expects a wait trigger unavail → on, but instead gets off? If so, how can i make it stop waiting from unavail → any, but only move on when it’s the right bool?
This is what I have so far:
trigger:
- platform: state
entity_id:
- binary_sensor.car
to: unavailable
id: Home
from: "off"
- platform: state
entity_id:
- binary_sensor.car
to: unavailable
id: Away
from: "on"
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Home
sequence:
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.car
from: unavailable
to: "on"
timeout:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
continue_on_timeout: false
- service: dostuff
- conditions:
- condition: trigger
id:
- Away
sequence:
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.car
from: unavailable
to: "off"
timeout:
hours: 0
minutes: 10
seconds: 0
milliseconds: 0
continue_on_timeout: false
- service: dostuff
Maybe I just write the wait trigger for from unavail, leave the to blank, and then the next step be a check for the appropriate on/off. This is somewhat annoying to test as it requires me driving back and forth.
I want stuff to trigger when I leave or get home (turning off lights for my office/bedroom when I leave, opening the garage as I arrive). I want other stuff to happen if the garage is opened for any other reason (where my car does not leave or enter the garage). I might just be going about this the wrong way entirely.