Help me in automation

alias: Test
description: “”
trigger:

  • platform: state
    entity_id:
    • sensor.sm_g988b_bluetooth_connection
      attribute: connected_paired_devices
      condition:
  • condition: zone
    entity_id: device_tracker.sm_g988b
    zone: zone.nablus_home
  • condition: state
    entity_id: sensor.sm_g988b_bluetooth_connection
    attribute: connected_paired_devices
    state: C0:91:B9:B3:27:70 (Echo Dot-758)
    action:
  • device_id: 6d4cf24417a8bbc426e9c49a14cd7982
    domain: mobile_app
    type: notify
    message: Hi

The results Although I am connect with
C0:91:B9:B3:27:70 (Echo Dot-758)

Triggered by the state of

sensor.sm_g988b_bluetooth_connection at July 28, 2023 at 3:32:50 PM

Test Confirm SM-G988B is in Nablus Home zone

Test Confirm Connected paired devices of SM-G988B Bluetooth Connection is C0:91:B9:B3:27:70 (Echo Dot-758)

Stopped because a condition failed at July 28, 2023 at 3:32:50 PM (runtime: 0.00 seconds)

Hi, welcome to the forum!

Please format your code correctly.

1 Like

I don’t know how to do that

The issue is that connected_paired_devices returns a list, not a string. The easiest fix is to use a Template condition to check if your device’s name is within that list:


alias: Test
description: ""
trigger:
  - platform: state
    entity_id: sensor.sm_g988b_bluetooth_connection
    attribute: connected_paired_devices
condition:
  - condition: zone
    entity_id: device_tracker.sm_g988b
    zone: zone.nablus_home
  - condition: template
    value_template: |-
      {{'C0:91:B9:B3:27:70 (Echo Dot-758)' in 
      state_attr('sensor.sm_g988b_bluetooth_connection', 'connected_paired_devices') }}
action:
  - device_id: 6d4cf24417a8bbc426e9c49a14cd7982
    domain: mobile_app
    type: notify
    message: Hi

Many thanks

I want to make an automation if the mobile device is connected to a bluetooth device called vw. I check if it is in a specific area to open the garage door.

Please help me :pray:

Thanks but not work with me

We can’t help you if you don’t provide us any information.
Download the automation trace json file and post it so we can see what is going on.