Unlike using the media_player.volume_set this method will adjust the main output of the raspberry pi regardless of the platform that is outputting the audio. Therefore you could use this as a volume limiter to your media player running on your Raspberry Pi through Home Assistant.
You can add Raspberry Pi Volume Central in two ways. By adding some components (Automation, Shell Command, Group, Script, Input Slider) or simply by adding a package using the packages feature in Home Assistant.
configuration.yaml file.configuration.yaml under homeassistant:packages: raspberry_pi_volume_central: !include raspberry_pi_volume_central.yaml3. restart home assistant find out how in the documentation or restart your raspberry pi sudo reboot
Home Assistant is going toward having a yaml file for every component (see Splitting up the configuration). I have structured my configuration.yaml so it takes advantage of !include to decorate the clutter in the configuration file. click here to see how I did it. (coming soon)
- action: - service_template: shell_command.pi_volume_{{ trigger.to_state.state | int }} alias: Pi Volume condition: [] id: 'pi_volume' trigger: - entity_id: input_slider.pi_volume platform: statepi_volume: icon: mdi:volume-high name: Volume initial: 70 min: 0 max: 100 step: 10pi_volume_0: amixer cset numid=1 -- -10238pi_volume_10: amixer cset numid=1 -- -5675pi_volume_20: amixer cset numid=1 -- -3820pi_volume_30: amixer cset numid=1 -- -2740pi_volume_40: amixer cset numid=1 -- -1976pi_volume_50: amixer cset numid=1 -- -1383pi_volume_60: amixer cset numid=1 -- -942pi_volume_70: amixer cset numid=1 -- -525pi_volume_80: amixer cset numid=1 -- -195pi_volume_90: amixer cset numid=1 -- 118pi_volume_100: amixer cset numid=1 -- 400pi_volume: icon: mdi:timer entities: - input_slider.pi_volume - script.mute_pi_script name: Raspberry Pi Volume view: falsemute_pi_script: alias: Mute Pi sequence: - data: entity_id: input_slider.pi_volume value: 0 service: input_slider.select_valuerestart home assistant find out how in the documentation or restart your raspberry pi sudo reboot