ward0
1
Hello,
This is a copy of : Invalid data for call_service at pos 1: expected float for dictionary value @ data['value']
I tried to build this automation myself but I’m doing something wrong…
alias: TV volume sync
description: Match TV Vol to Sonos Playbar when TV Vol has Changed
triggers:
- trigger: state
entity_id:
- media_player.lg_webos_tv_oled55b16la
conditions:
- condition: template
value_template: >-
value: "{{ states.input_number.tv_kamer_volume.state !=
states.media_player.lg_webos_tv_oled55b16la.attributes.volume_level}}"
actions:
- action: media_player.volume_set
metadata: {}
data:
volume_level: "{{ states.input_number.living_room_volume.state }}"
target:
device_id: 0d0ffcda13e1a81ff2961ce9d23f51ac
mode: single
I have created 2 sensors to help me further, but I don’t know if I really need them:
sensors:
LG_volume:
value_template: >
{{ state_attr('media_player.lg_webos_tv_oled55b16la', 'volume_level') }}
sensors:
playbar_volume:
value_template: >
{{ state_attr('media_player.tv_kamer', 'volume_level') }}
These sensors pass me the correct information.
Playbar volume: 18
LG volume: 8
I want to sync my Playbar volume with my LG volume.
Any help would be appreciated.
regards,
Ward
ward0
2
Hoping to get some response, I can’t find a solution
complex1
(Frank)
3
Try this:
- condition: template
value_template: >-
{{ states.input_number.tv_kamer_volume.state !=
states.media_player.lg_webos_tv_oled55b16la.attributes.volume_level }}
or remove the condition rule completely to test whether the Sonos soundbar takes over the volume of the TV.
ward0
4
Hello,
Deleting the " " got me a step further.
In traces I now have:
Stopped because an error was encountered at November 5, 2024 at 9:01:04 PM (runtime: 0.00 seconds)
expected float for dictionary value @ data[‘volume_level’]
alias: TV volume sync
description: Match TV Vol to Sonos Playbar when TV Vol has Changed
triggers:
- trigger: state
entity_id:
- media_player.lg_webos_tv_oled55b16la
conditions:
- condition: template
value_template: >-
value: {{ states.input_number.tv_kamer_volume.state !=
states.media_player.lg_webos_tv_oled55b16la.attributes.volume_level}}
enabled: true
actions:
- action: media_player.volume_set
metadata: {}
data:
volume_level:
"[object Object]": null
target:
device_id: 0d0ffcda13e1a81ff2961ce9d23f51ac
mode: single
ward0
5
Fixed:
id: '1730196532805'
alias: TV volume sync
description: Match TV Vol to Sonos Playbar when TV Vol has Changed
triggers:
- trigger: state
entity_id:
- media_player.lg_webos_tv_oled55b16la
conditions:
- condition: template
value_template: >-
value: {{ states.input_number.tv_kamer_volume.state !=
states.media_player.lg_webos_tv_oled55b16la.attributes.volume_level}}
enabled: true
actions:
- data_template:
entity_id: media_player.tv_kamer
volume_level: '{{states.media_player.lg_webos_tv_oled55b16la.attributes.volume_level }}'
action: media_player.volume_set
mode: single