can this be done and should it be done and how can it be done
HA knows when I start the car
HA knows if the car is in garage
HA knows if a open a the sidedoor to my house
HA can open the garge door (well building that now)
So Question logic is (How would HA do this)
if I have the car park out side the garge NOT inside i open the sidedoor with in 3min and I start the car how would I get HA NOT to open the garge door
as HA knows car is not inside garge as I sensor
MR2 Clear or Detected OFF/ON using HC-SR04 Ultrasonic Sensor
so my logic is if MR2 = clear OFF and I open side door/closed within a 3min window and start the car dont open the door.
which manual should I be reading to work out time differance between door open and car start
Some details could help here. E.g., you imply that an automation already exists that opens the garage door, but that it’s opening the door in this case when you don’t want it to. What is that automation?
In any case, is this what you want: Open garage door when car starts, but not when car is outside garage AND side door closed within the last three minutes? If so, then that is basically equivalent to: open garage door when car starts, but only if car is in garage, or side door is open, or it closed more than three minutes ago.
So, maybe something like this (since I’m guessing at most of the details):
automation:
- alias: Open garage door
trigger:
platform: event
event_type: my_car_turns_on
condition:
condition: or
conditions:
# Car is either in garage ...
- condition: state
entity_id: binary_sensor.car_in_garage
state: 'on'
# or side door is open ...
- condition: state
entity_id: binary_sensor.side_door_is_open
state: 'on'
# or side door closed more than three minutes ago
- condition: template
value_template: >
{{ (as_timestamp(now()) -
as_timestamp(states.binary_sensor.side_door_is_open.last_changed)) >
3 * 60 }}
action:
service: cover.open
entity_id: cover.garage_door
Actually, thinking about it some more, I suspect what you really want is: open garage door if car is started, but only if car is in garage, or side door hasn’t been opened or closed in the last three minutes. This is actually a little simpler:
automation:
- alias: Open garage door
trigger:
platform: event
event_type: my_car_turns_on
condition:
condition: or
conditions:
# Car is either in garage ...
- condition: state
entity_id: binary_sensor.car_in_garage
state: 'on'
# or side door last opened or closed more than three minutes ago
- condition: template
value_template: >
{{ (as_timestamp(now()) -
as_timestamp(states.binary_sensor.side_door_is_open.last_changed)) >
3 * 60 }}
action:
service: cover.open
entity_id: cover.garage_door