Better GUI scripting for state attributes. #18333
Unanswered
Bitwolfies
asked this question in
Automations / scripts / scenes
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wanted to create an automation that triggers when a specific device connects to my phone's Bluetooth, and through the the visual editor this does not appear to be possible.
I had set up my automation as follows:

This is the yaml given via this automation created in the GUI:
description: ""
mode: single
trigger:
entity_id:
attribute: connected_paired_devices
to: AC:3E:B1:63:57:23 (Pixel Buds A-Series)
condition: []
action:
data:
message: test
Fairly simple right? If my headphones are the only connected device, fire the automation off, despite this, it never worked once. (And yes, I triple checked the naming was right, it was a copy paste)
What did end up working was this template trigger here, even has the added benefit of firing when my headphones are simply connected, and not the only device.
value_template: "{{ 'AC:3E:B1:63:57:23 (Pixel Buds A-Series)' in state_attr('sensor.pixel_7a_bluetooth_connection', 'connected_paired_devices') }}"
My problem is that A: There was no reason for the GUI automation to fail, even though it only worked if my headphones were the only connected device, those was the conditions I was testing with, nothing else was connected, it still failed. I have no idea as to why it failed when the script that worked used all the same states and attributes, just with a slightly broader trigger.
B. There should be a method in the GUI to work as the script does, where you tell it to check for the device or string within the state, so users aren't forced to result to yaml scripting (Id have never figured this out on my own without someone already writing it, shouldn't have to rely on that.)
Beta Was this translation helpful? Give feedback.
All reactions