In my render template node, but Im unsure what I need to add to get it to filter multiple sources and trigger a call service node after that.
If anyone can share a value template that achieves this, would be much appreciated.
In case someone stumbles on this looking for something similar; here is my two node solution
Current state the Spotify entity with no value to pass along anything. then a function node with the following in the “On Message” tab;
// Define the sources you want to filter for
const allowedSources = ["Kitchen", "Living Room"]; // Add your allowed sources here
// Check if the incoming source is in the allowed list
if (allowedSources.includes(msg.data.attributes.source)) {
// Pass the message along if the source is allowed
node.send(msg);
}
You can also disallow so it will pass anything except for
// Define the sources you want to block
const disallowedSources = ["Kitchen", "Living Room"]; // Add your disallowed sources here
// Check if the incoming source is in the disallowed list
if (disallowedSources.includes(msg.data.attributes.source)) {
// Stop the message if the source is disallowed
} else {
// Pass the message along if the source is not disallowed
node.send(msg);
}
$entity().state = "playing" and $entity().state.attributes.source in ["Kitchen", "Living Room"]
So that should be; if the spotify entity is “playing” and the source attributes = either “Kitchen” or “Living Room” then send msg though the “if state” is true, gate
But no matter what source is playing it always triggers to debug 8?
I’ve restarted HA, no difference
Sorry to get you stuck in the weeds like this, you think its going to be a sample answer then BAM! HAHA
Oh ignore the sources on the screen shot ill fix all that when Im done