Trying to work this out but my head hurts just thinking about it.
I have a Yamaha Reciever which records volume in dB. When in media player this appears as a percentage 0-100%
I would like to use my Tuya dimmer switch to control the volume. Both appear in Home Assistant successfully.
I can’t work out if I should attempt to use a compensation integration so that the states keep in sync or if I will need a template.
Having been through the maths and using desirable volumes from -60dB (which should be 0% dimming) to -20dB I am looking at 4dB for every 10% volume increase. This will also need to be rounded to the nearest 0.5dB
Does anyone have any clues on the best way to implement this? Should I be looking to set media_player.volume_set to percentage (i.e. 0.5 = 50%) or using dB?
Update: Light brightness is 0 -255 so I have tried creating a compensation but no luck so far:
compensation:
media_player_db_volume:
source: media_player.yamaha_rx
attribute: volume_level
unit_of_measurement: dB
data_points:
- [-20.0, -60.0]
- [1.0, 0.0]
dimmer_light_brightness:
source: light.dimmer_light
attribute: brightness
#unit_of_measurement: dB
# Ensure that the sensor's value will not have a state lower than -80.0
# when the source sensors value is less than 0.2
lower_limit: true
# Ensure that the sensor's value will not have a state greater than 0.0
# when the source sensors value is greater than 1.0
upper_limit: true
data_points:
- [255.0, 0.0]
- [1.0, 0.0]