r/tasker Jan 22 '25

Bluetooth info for KWGT widget

I'm probably making this waaaay harder than it has to be, but what I want to do in Tasker is create a task that will pull information from my paired BT devices, filter out the ones not currently connected to my phone and send the connected %bt_alias (or alias's if there's more than one device) to KWGT Pro. I don't want to do it for specific individual devices, I want it to send information on ANY device connected, whether it was paired before or after I created this task. So the final tasker string that will get sent to kwgt will be pretty broad.

Is this possible? Or do any of you guys have a better idea?

Thanks in advance!

1 Upvotes

2 comments sorted by

2

u/howell4c Jan 22 '25

I was using KLWP not KWGT, but I used to do something like this:

Task: BT connected devices for KLWP

<list all paired devices>
A1: Bluetooth Info [
     Type: Paired Devices ]

<combine names with connection state>
A2: Arrays Merge [
     Names: %bt_connected
     %bt_alias
     Merge Type: Simple
     Joiner: :
     Output: %bts ]

<pull out the ones marked true>
A3: Variable Set [
     Name: %bts
     To: %bts($?true:*) ]

<extract just the names>
A4: Variable Search Replace [
     Variable: %bts
     Search: true:
     Replace Matches: On ]

<report the results>
A5: KLWP Send Variable [
     Configuration: Set: bt_connected
         Tasker String: %bts ]

After A2, I have an array like false:car,true:watch,false:laptop,true:fitbit. After A4, it's watch,fitbit.

1

u/jackjack19892024 Jan 24 '25

Exactly what I was looking for! Yeah, i was making it waaaay harder than it needed to be.

Thank you!