I’m a long-time OpenHab user, decided to try out HA over the summer to see what color the grass is over here. I’m trying to port over one of my more simplier automations but I can’t figure out how to access a value on the entity. The idea is to turn the lights off/on when the receiver turns on/off (this part is working OK, albeit a little slower than I’m used to) but I also want to be able to temporarily turn the lights on when I push the mute button and back off when unmuted. This is basically the “go to the bathroom” button so that I don’t have to turn everything off or stumble around in the dark. However, I can’t get the mute status, despite it existing in the UI.
From what I’ve read in the docs, an entity is supposed to be a singular value on a device. Temp, wind speed, etc would all be different entities in a weather device. Yet when I look at my Denon reciever, there is only 1 entity, and it looks like this:
There isn’t an existing Trigger for “When Receiver is Muted” so I figure I need to directly make something off the entity. However, I can’t figure out how to do so as this integration seems to cram everything into a single entity.
I feel like I’m missing something basic here, despite trying to read the docs. It may have something to do with me thinking along OpenHab terms and not using HA like it wants me to use it? Thanks in advance.
What do you see in Developer Tools under Attributes?
1 Like
Ah, OK, that’s got some stuff in it, along with what I’m looking for: is_volume_muted: false
.
From what I’m reading online it looks like I’ll need to make a template?
Those attributes should be available in Automations if you select Entity vs Device.
1 Like
Attributes can be finicky for media players, so If it doesn’t work, clear the Entity trigger and select Other Triggers and then Template
Then use something like this example…
{{ state_attr('media_player.monitor', 'is_volume_muted') }}
1 Like
Hah, I had a big post full of screenshots about how the state trigger wasn’t working and how I was pulling out all my hair, although I’m glad you pointed that out as I somehow missed its existence and it’ll be important for my next script. And then you went and one-upped yourself.
{{ state_attr('media_player.projector_receiver', 'is_volume_muted') }}
and
{{ not state_attr('media_player.projector_receiver', 'is_volume_muted') }}
ended up doing the trick for me. Maybe this will help someone else. Hopefully whatever is making the media stuff not obey normal rules is fixed soon, as it doesn’t seem right we had to dip into templating to fix this.
Thank you so much for all your help!
1 Like
Happy to assist! I agree the attributes field is not working as expected, at least for media_player entities. I was frustrated as well and it took me a minute to figure out an alternative method.
I’ll escalate the issue as templating definitely felt like a workaround.
1 Like