Profit2U
(Fred)
November 12, 2023, 4:22pm
1
Hi!
I’m trying to find out if it is possible to define a (global?) variable that identifies a mobile device entity (e.g. device_tracker.device_name_here ).
Since I have several Automations that use the Notifications service I’m looking for an easier way to make the Automation more generic and use a variable that defines the device to notify.
When you switch device, then you don’t need to update several Automations to send messages to the correct device.
Hope this makes sense…
And thanks in advance!
Dixey
November 12, 2023, 4:30pm
2
Maybe the Integrations add in called “Variable” may help.
Profit2U
(Fred)
November 12, 2023, 4:42pm
3
Thanks, have that already in my config.yaml, but I’ve not been able to get it working when using device notifications in Automations
Dixey
November 12, 2023, 4:47pm
4
Okay, I had similar issues that I finally solved (with much guidance here) by using the Config Template Card available in the “Frontend” add ins.
jazzyisj
(Jason)
November 12, 2023, 5:05pm
5
Depending on where/how you’re using it you can define your “variable” as a secret in secrets.yaml.
In your automation, script etc.:
icon_url: !secret ALARM_ICON
In secrets.yaml:
ALARM_ICON: /local/images/notification/alarm_icon.png
pedolsky
(Pedolsky)
November 12, 2023, 5:54pm
6
Poudenes recently posted an interesting observation: Variables.yaml file included in automation
NathanCu
(Nathan Curtis)
November 12, 2023, 6:10pm
7
Specific to your use case.
You can group notify services and you can have a group of one.
When I get a new phone I just update my group membership
Profit2U
(Fred)
November 12, 2023, 6:26pm
8
Use case is: when entering or leaving zone(s), notify several mobile devices.
NathanCu
(Nathan Curtis)
November 12, 2023, 6:45pm
9
yep.
#Notification Groups
notify:
- name: family_devices
platform: group
services:
- service: mobile_your_phone_here
- service: mobile_your_so_phone_here
- name: family_devices_verbose
platform: group
services:
- service: mobile_your_phone_here
- name: admin_devices
platform: group
services:
- service: mobile_your_phone_here
Profit2U
(Fred)
November 12, 2023, 7:26pm
10
Thank you for this - super!