PRProd / HA-Firemote

Apple TV, Amazon Fire TV, Fire streaming stick, Chromecast, NVIDIA Shield, onn., Roku, Xiaomi Mi, and Android TV remote control card for Home Assistant
GNU General Public License v3.0
448 stars 67 forks source link

Mute Button Script not executing for Apple TV #501

Closed parchmaf closed 3 weeks ago

parchmaf commented 3 weeks ago

Describe the bug

I have button overrides configured to execute scripts on my Apple TV remote. This works perfectly for volume up and volume down, but for the mute button, I get a error that states the script cannot be found. If I manually run the mute script in HASS, it runs as expected. This behavior happens on both my gen2 and gen3 Apple TV 4k. For some reason it appears Firemote cannot find and execute the script even though it is there.

Screenshot 2024-09-04 at 12 59 50 PM Screenshot 2024-09-04 at 1 02 11 PM

To Reproduce

Create script in HASS for muting Apple TV and assign the button override to 'mute-button' Execute on the Apple TV Firemote and get cannot be found error

Expected Behavior

Script should be executed when button is pushed, therefore toggling Mute on Apple TV

Which Type of Device Do You Own?

Apple TV 4k Gen 2 and Gen 3

Troubleshooting Steps Completed

Manually execute script in HASS works correctly

Additional context

No response

PRProd commented 3 weeks ago

Weird! Let's figure it out...

Could you copy/paste (not a screenshot) the YAML from your master_bed_mute_toggle script and the YAML from your Firemote config into this issue? I'm hoping there is just a weird space or character out of place or something.

parchmaf commented 3 weeks ago

As requested:

Screenshot 2024-09-04 at 4 33 20 PM

But please keeo in mind that the specific error that I am getting is that the script cannot be found. Strange because Firemote has no issue finding the scripts I created for volume up and down.

IMG_0770

PRProd commented 3 weeks ago

Since you've only sent screenshots I cannot confidently diagnose what the issue might be, but let's try one (unusual) thing.

image

parchmaf commented 3 weeks ago

Sorry about that. Same error. Here is the YAML text for the script:

alias: Master Bed Mute <TOGGLE>
sequence:
  - if:
      - condition: template
        value_template: >-
          {{ state_attr('media_player.master_bed_sonos', 'is_volume_muted') ==
          True }}
    then:
      - data:
          is_volume_muted: false
        target:
          entity_id: media_player.master_bed_sonos
        action: media_player.volume_mute
    else:
      - data:
          is_volume_muted: true
        target:
          entity_id: media_player.master_bed_sonos
        action: media_player.volume_mute
mode: single
icon: mdi:volume-mute
PRProd commented 3 weeks ago

Not the exact same error though, right? The error you see now has the new script name in it?

parchmaf commented 3 weeks ago

And the YAML for Firemote (with change):

type: custom:firemote-card
entity: media_player.master_bed_apple_tv
device_family: apple-tv
device_type: appletv-4k-gen2
compatibility_mode: default
apple_tv_remote_entity: remote.master_bed_apple_tv
scale: '100'
app_launch_1: ''
button_overrides:
  volume-down-button:
    script: master_bed_volume_down
  volume-up-button:
    script: master_bed_volume_up
  mute-button:
    script: masterbedmutetoggle
parchmaf commented 3 weeks ago

IMG_0771

PRProd commented 3 weeks ago

Helpful hint ~

If you write your response containing YAML with the three ` backtick characters and the word yaml, then close it with three ` characters like this: image then Github won't change the formatting of your properly spaced YAML file. 😄

PRProd commented 3 weeks ago

Do you have File Editor installed? If so, can you do this for me?

parchmaf commented 3 weeks ago

Your renaming idea got me thinking and just for the heck of it, I did check scripts.yaml as you just now suugested. I'm not sure how the GUI can show one thing and the YAML another but in my case the script was named differently. When I made that change, it now works. This definitely was not a Firemote issue but I really do appreciate the help troubleshooting. Many thanks!

PRProd commented 3 weeks ago

YAY! That's exactly what I suspected. If I had to guess, I wonder if it happened when you used a < and a > in the name of your script when you created it? Just a guess. If so, you might have come across a Home Assistant bug.

Either way, I'm very happy that it's working for you now!