Hello.
I’m fairly new to HA and while I’ve managed to crack many problems through searching and reading forums I’ve finally come across something that is perhaps too specific to find a clear answer from Google.
I’m setting up a script through pressing a phone icon on my floorplan to send a few commands through to help my girlfriend locate her phone because she’s the type to leave it on silent and then forget it in a bag or table somewhere.
alias: Fold 4 Notification
sequence:
- device_id: my_id
domain: mobile_app
type: notify
message: command_ringer_mode
data:
ttl: 0
priority: high
command: normal
- device_id: my_id
domain: mobile_app
type: notify
message: command_volume_level
data:
media_stream: notification_stream
ttl: 0
priority: high
command: "15"
- device_id: my_id
domain: mobile_app
type: notify
message: lost?
data:
ttl: 0
priority: high
timeout: 4
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- device_id: my_id
domain: mobile_app
type: notify
message: command_volume_level
data:
media_stream: notification_stream
ttl: 0
priority: high
command: "6"
mode: single
icon: mdi:cellphone-sound
While everything here works fine, the script turns up the notification volume to max before playing a sound through the “lost?” notification before disappearing and lowering the volume back to reasonable levels, I would like to have the script include an Entity State Snapshot in the beginning which stores the current ringer-mode and notification-volume and applies them afterhand. This way I could have her phone go back to silent if it was on silent before the notification. I don’t want to force silent mode in case she’s waiting for a phone call or something, and so setting it back to the previous state would be optimal. (I’m also using this for my phone and both our tablets, all of which have various settings depending on usage)
I tried to use Passing variables through scripts which Tom mentioned to someone, but I can’t find a way to pass the information through, because scenes can’t be used here (not that I know of)
message: command_ringer_mode
data:
command: "{{ how would I reach the variable here?}}