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"