#bluetooth automation

1 messages · Page 1 of 1 (latest)

kindred sage
#

hi so i have tried to create a automtion but i keep getting errors. ive been using the bluetoothctl connect F1:0E:55:0F:B9:4C to connect to my speaker because it will either disconnect or will do on reboot. is there a way to check if its connected and if not then enter in the shell the command and check every second

/homeassistant/automations.yaml

automation:
  - alias: Ensure Bluetooth Speaker Connection
    trigger:
      - platform: time_pattern
        seconds: "/1"  # Trigger every second
    condition:
      - condition: template
        value_template: "{{ not is_state('sensor.bluetooth_speaker_status', 'connected') }}"
    action:
      - service: shell_command.connect_speaker

/homeassistant/configuration.yaml


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml


bluetooth:

sensor:
  - platform: bluetooth_tracker

shell_command:
  connect_speaker: "bluetoothctl connect F1:0E:55:0F:B9:4C"



scenic kiln
#

What errors?

kindred sage
#

i rebooted and they have vanished but my speaker is still in pairing mode and its not connected

#

and it is saying it cant be edited as its not in the correct file when it is so maybe its just not being detected

scenic kiln
#

automations.yaml shouldn't have automation: as the first line

rotund loomBOT
scenic kiln
#

That command will help you fix broken YAML

kindred sage
#

ahh ok thank you i removed it and rebooted aswell as restarted the speaker

scenic kiln
#

Did you run the check command?

kindred sage
#

erm no where could i find that, in developer tools?

#

Configuration warnings
Platform error 'sensor' from integration 'bluetooth_tracker' - Requirements for bluetooth_tracker not found: ['PyBluez==0.22'].

scenic kiln
#

You run that command over SSH

scenic kiln
kindred sage
#

HAOS its on my proxmox server

scenic kiln
#

Based on memory I doubt bluetooth_tracker will work any time soon

kindred sage
#

ahh ok thank you. what could i do just have it repeat the command to connect every x seconds

scenic kiln
#

That's what your automation does

kindred sage
#

ahh yeh it is working lol it wasnt on boot but ill sort that out. there is no way then to just check if its connected or not yet

#

just as yea it pinging quite alot and my speaker keeps disconnecting so not sure whats going on there

#

yeah when it disconnects it says DEL how could i fix this

scenic kiln
#

The easy fix is to use a natively supported speaker 😄