Hey everyone, I wanted to share a handy solution I came up with to manage the TV volume in my household. It’s been a lifesaver, especially with the kids enjoying their favorite shows while I try to get some rest. Let me walk you through how I tackled this issue using Home Assistant and Node-RED.
The Problem
I noticed that the kids often turned up the TV volume too loud, which would disrupt our peace, especially at night. I’d end up repeatedly adjusting the volume myself, which was frustrating. I knew there had to be a smarter way to handle this without constantly intervene.
The Solution
After some research, I decided to set up an automation in Home Assistant to limit the maximum volume on our TV. I’m using a Sonos Playbar connected to a Sony TV, and Node-RED for the automation workflow. Here’s how I did it:
-
Creating a Volume Sensor
I started by creating a template sensor to track the TV volume level.
yaml- platform: template
sensors:
living_room_tv_volume:
friendly_name: Living Room TV Volume
value_template: ‘{{state_attr(‘media_player.living_room’, ‘volume_level’)}}’
- platform: template
-
Adding a Slider Control
Next, I added an input number slider to adjust the maximum allowed volume.
yaml
input_number:
tv_volume_slider:
name: TV Volume Slider
initial: 1
min: 0
max: 1
step: 0.05 -
Setting Up the Automation
Using Node-RED, I created a flow that monitors the TV volume sensor. If the volume exceeds the slider’s set value, it immediately adjusts it back down.- Node-RED Flow: The flow listens for changes in the TV volume sensor. If the volume is too high, it sends a command to set it to the slider’s value. This ensures the volume never goes beyond the desired limit.
- Morning Reset: I also added an automation to reset the slider to maximum volume every morning at 5 AM, so the kids can enjoy their shows without restrictions during the day.
The Result
This setup has been a game-changer! It keeps the TV volume at a reasonable level without me having to constantly intervene. Plus, it’s been a fun project to work on, thanks to the helpful community here. If anyone has questions or suggestions, I’d love to hear them!
Happy automating! ![]()
![]()