Using input_number. to set a send a notification to mobile phone volume

I would like to remotely control the volume of my phone within the dashboard. I created a slider “input_number.serenity_phone_volume_level” as shown in the screenshot.

In the dashboard, it looks like this.

image

In the automation, I am using this as a trigger.

platform: state
entity_id:
  - input_number.serenity_phone_volume_level
from: null
to: null
id: Serenity-Phone-Volume-Change

The trigger works because my mobile phone gets the notification.
Now, let’s look at the actions.

service: notify.mobile_app_moto_g_stylus_5g_antonio
data:
  message: command_volume_level
  data:
    media_stream: music_stream
    value: {{ states('input_number.serenity_phone_volume_level')| int }}

The above is not working. I really do not know how to bring in a value of an entity into an automation.
What I want to happen is that when I change the value from 0 to 20, it will change the volume on my phone to that changed number. I know that “command_volume_level” works when I set it within an automation using:

service: notify.mobile_app_moto_g_stylus_5g_serenity
data:
  message: command_volume_level
  data:
    media_stream: music_stream
    command: 20

The above sets it to the higher number.
What I want to do is set the volume from 0 to 20 based on what I changed in the entity “input_number.serenity_phone_volume_level”.

Any help would be appreciated. Thanks!!!

I’m no expert, but I think you need to enclose the value in quotes:

    value: "{{ states('input_number.serenity_phone_volume_level')| int }}"
1 Like

Good point. I added it and it did not work. It is something in value that needs changing, I think.

service: notify.mobile_app_moto_g_stylus_5g_antonio
data:
  message: command_volume_level
  data:
    media_stream: music_stream
    command: "{{ states('input_number.serenity_phone_volume_level')| int }}"

This actually worked. Thank you for the quotes. I do not know why I used value: but it is supposed to be command:. It works great. Thanks @Stiltjack