Automation - ? what is wrong here?

Hi all,
I have the following automation, to open garage door when I am close to home. Lately I added some or conditions in order to open the door when I am in the car only. Last days something is wrong with the or conditions (I think) and nothing happens. Although I check and the status is in_vechicle or the person is away, when I use the debug mode it stops in the or conditions. Can someone check the automation please?

- id: Open Garage Door when close to home
  alias: Open Garage Door when close to home
  trigger:
    - platform: zone
      entity_id: device_tracker.makis_smartphone
      zone: zone.myhome
      event: enter # or "leave"
    - platform: zone
      entity_id: device_tracker.makis_smartphone
      zone: zone.myhome2
      event: enter # or "leave"
    - platform: zone
      entity_id: device_tracker.makis_smartphone
      zone: zone.myhome3
      event: enter # or "leave"
    - platform: zone
      entity_id: device_tracker.makis_smartphone
      zone: zone.myhome4
      event: enter # or "leave"
  condition:
  - condition: or
    conditions:
    - condition: state
      entity_id: device_tracker.makis_smartphone
      state: in_vehicle
    - condition: template
      value_template: "{{state_attr('device_tracker.makis_smartphone', 'speed') >= 3}}"
    - condition: template
      value_template: "{{ 'A0:56:B2:1F:87:36' in state_attr('sensor.makis_smartphone_bluetooth_connection', 'connected_paired_devices') }}"


  - condition: state
    entity_id: timer.garage_door_inputboolean
    state: 'idle'
  - condition: state
    entity_id: binary_sensor.garage_door_d1mini
    state: 'off'
  - condition: state
    entity_id: sensor.makis_home
    state: 'away'
    for: 
      minutes: '5' 

       
  action:
    - service: timer.start
      entity_id: timer.garage_door_inputboolean
    - service: switch.toggle
      data:
        entity_id: switch.sonoff_100082f95b

and here is the debug ( I saw statis on mobile HA and it was “in_vechcle”

Executed: September 2, 2022 at 00:09:15
Result:
result: false
conditions/0
Executed: September 2, 2022 at 00:09:15
Result:
result: false
conditions/0/entity_id/0
Executed: September 2, 2022 at 00:09:15
Result:
result: false
state: home
wanted_state: in_vehicle
conditions/1
Executed: September 2, 2022 at 00:09:15
Result:
result: false
entities:
  - device_tracker.makis_smartphone
conditions/2
Executed: September 2, 2022 at 00:09:15
Result:
result: false
entities:
  - sensor.makis_smartphone_bluetooth_connection

look at the attributes of the bluetooth connection.

there was a change in the mobile app that added the device name to the mac address string so you’ll need to change the mac address string you use:

- condition: template
      value_template: "{{ 'A0:56:B2:1F:87:36 (<some name here>)' in state_attr('sensor.makis_smartphone_bluetooth_connection', 'connected_paired_devices') }}"

I have no idea about the “in_vehicle” condition.

2 Likes

I’m guessing that should be for the activity sensor, which is a separate entity.

I will look into this. However I can not understand why the automation isn’t working. If this line regarding bluethooth is wrong, could potential stop all the other “or” conditions?

that’s right. It doesn’t work always right. In order to “help” the sensor when I approaching home the phone automatically opens google maps and most of the time the sensor reports in_vechicle (until then usually is “uknown”)