In NodeRED, I build a global variable which is an array of entities based upon whether or not a boolean is on for each entity.
The purpose is to be able to selectively mute each zone on my amplifier to prevent or allow any audio enabled entity to trigger a sound through that zone. If the boolean for a zone is off, it is removed from the array that is passed to the media_player service call.
When the grandfather clock (audio files) is triggered, the target for the media_player (6-zone amp) is an array of the zones that I want to be activated. I can choose in which rooms the clock chimes based upon this array passed to the service call node as the targeted entities.
What I can’t seem to do is add data to control each individual zone’s audio level with a single service call.
The input properties for a service call node need to be found under msg.payload
. So, I load the global variable array into the payload on the fly and assign it to msg.payload.target.entity_id
.
Here’s an example of what the message looks like on the input side:
{
"domain": "homeassistant",
"service": "play_media",
"target": {
"entity_id": ["media_player.zone_11", "media_player.zone_12"]
}
"data": {
????
}
}
Now in the example in NodeRED, it shows that we can turn on multiple lights with one service call all to the brightness of 50%.
But, what if we want light 1 to be 25% and light 2 to be 60%? Is it possible to achieve, or will I need to come up with another routine to control the volume for each zone?