#How to create a selector to select notify.<phone_name> actions?

1 messages · Page 1 of 1 (latest)

magic linden
#

I know I can use an action selector to let users create their own actions in a blueprint, but I want to do the following:

I want a selector that shows a list of notify.<phonename> to select the correct phone to send a message to. The blueprint will fill the data field automatically based on other !input variables. is this possible?

buoyant spear
#

🎉

#

(that's part of the reason notifications are getting overhauled)

magic linden
#

Can I do something with a text input and then concatinate that to let's say "notify." + !input phone_name ?

buoyant spear
#

yeah, you can, but it won't always work

#

you can have them attach a device_tracker entity and restrict it to mobile app

#

that should have the same object_id

#

Personally, what I do is even more complicated than that

magic linden
#

Okay. Not totally sure how to do this tbh.

buoyant spear
#

I have them add a single notification action

#

and then I replace that shit with my own information and just grab the action

#

using templates

magic linden
#

Ah okay. Yeah, that's way over my head...

buoyant spear
#

probably best to just have a field where they copy/paste the notification action from developer tools -> actions page.

magic linden
#

Thank you.

#

For now I solved it like this:

variables:
  phone: !input phone
  phone_action: "notify.{{ phone }}"

And use the action:

  - action: "{{ phone_action }}"

It works, but I think it might be tricky

buoyant spear
#
variables:
  phone: !input phone
  phone_action: "{{ phone[0].action }}"
#

keep the rest the same

#

unfortunately, you can't limit what they choose as an action, so the uninformed will mess it up

magic linden
#

Ah yes, I will try this! Thanks.

#

When I choose the action selector I cannot hide the action options and that might confuse people as well, but I think your example helps more in preventing mistakes.