I have build two automations to synchonize the volume level of my sons tablet.
alias: David Tablet get Volume
description: ""
triggers:
- trigger: state
entity_id:
- sensor.david_tablet_volume_level_music
for:
hours: 0
minutes: 0
seconds: 1
conditions: []
actions:
- action: input_number.set_value
metadata: {}
data:
value: "{{ states('sensor.david_tablet_volume_level_music') }}"
target:
entity_id: input_number.david_tablet_volume
mode: single
alias: David Tablet Set Volume
description: ""
triggers:
- trigger: state
entity_id:
- input_number.david_tablet_volume
id: david-tablet-volume-helper
for:
hours: 0
minutes: 0
seconds: 1
conditions: []
actions:
- action: notify.mobile_app_david_tablet
data:
message: command_volume_level
data:
media_stream: music_stream
command: "{{ states('input_number.david_tablet_volume') }}"
mode: single
it works pretty fine, so i can see the volume level of the tablet on the dashboard and can control the volume level with the card.
but the Problem is: when I set the volume Level to 0 the command is not executed. The tablet just shows a notification.
The reason is; those numer values are sent as float. e.g. 15.0 or 5.0
that works fine, but 0.0 ist not acceptet. only 0 ist accepted.
How to solve that?