Hi everyone. I’m trying to write a script that takes a mobile device as a parameter and sends a notification message to it, but can’t seem to find a way to make it work. This thread indicates that it may not be possible until the notification system is overhauled, but as it’s asking a different question, perhaps there’s a way to do what I want.
Goal: I’d like to have a script that can send a message to any mobile device, which is passed as a parameter. (The reason for this is that I’d like to send Bluetooth LE command notifications such as ble_set_transmit_power to manage power on a variety of devices; the logic will do things like turn the transmitter on if it is currently stopped )
I can send a notification to a specific device, but if I try notify.notify and add the parameter as a target, it doesn’t like it and changes it to “[object Object]”: null. It would be helpful to know if there’s any clever way to get it to work. If not I’ll need to have an ugly set of Choose options (if target_device == “pixel_7a” then notify.mobile_app_pixel_7a etc).
Thanks in advance for suggestions, or confirmation that this just isn’t possible and I have to do it the hard way!
sequence:
- action: notify.mobile_app_pixel_7a # This works fine but is specific to a single device
metadata: {}
data:
message: Test
- action: notify.notify
metadata: {}
data:
target:
{{target_device}} # When I save, this line gets changed to "[object Object]": null
message: Test
alias: Test Parameterised Notification
description: ""
fields:
target_device:
selector:
text: null
name: Target Device
description: The device to send a notification
required: true
