Skip to content

Feature request: allow mapping buttons to existing HA services/automations #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghvader opened this issue Oct 6, 2022 · 21 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@ghvader
Copy link

ghvader commented Oct 6, 2022

Feature Request:
My amazon remote sends IR codes to my receiver(s) to change the volume/mute/power on.
My receiver(s) are also in HA and it controls the volume/power. it would be great to be able to map volume up/down/mute buttons to the HA services
media_player.volume.down
media_player.volume.up
media_player.volume.mute
would need to be able to input a specific entity as I have a receiver on each floor of the house

Feature Suggestion:
additionally the power button could be mapped to trigger an automation which could turn on tv's, receivers, on/off lights. etc

@PRProd PRProd self-assigned this Oct 7, 2022
@PRProd PRProd added the enhancement New feature or request label Oct 7, 2022
@PRProd
Copy link
Owner

PRProd commented Oct 12, 2022

Would you prefer the ability to override specific buttons with specific commands and different entities, or would it be ok to simply override any button with a HA script? If I made every button able to be overridden by a named script, it could handle all of your requests at once.

@ghvader
Copy link
Author

ghvader commented Oct 12, 2022

Would you prefer the ability to override specific buttons with specific commands and different entities, or would it be ok to simply override any button with a HA script? If I made every button able to be overridden by a named script, it could handle all of your requests at once.

first. very kind of you to offer and work on this at all. I'm not quite sure how to answer. I only have specific needs, but others may have different needs. so if it's easier to override any button with a script, then i think that would work. I found this script on the forum.
script: volume_up: sequence: service: media_player.volume_set entity_id: media_player.YourPlayer data_template: volume_level: '{{ states.media_player.YourPlayer.attributes.volume_level + 5 }}'

so if that does indeed work, then i would be fine with that. I could create the 3 or 4 scripts I need and be happy.

@PRProd
Copy link
Owner

PRProd commented Oct 12, 2022

Thanks for the quick reply! I'm happy to give back to the open source community that has given me so much over the years! I'll never be able to repay the countless volunteers, but I want to give back by offering my best efforts in the hopes that it helps others. Your questions, requests, and fast feedback are a great contribution too! So again, THANK YOU!

I'm trying to work out in my mind what is the most user friendly/HA noob friendly way to tackle button function customization. Since each user will likely have different desires, it's not realistic to that I can build one simple config UI to handle everything. I think YAML will have to be required to add or change the normal functions, which is fair.

In my mind, I think that the most simple way for a new or average user would be to first build and test a script using the Home Assistant script building UI. Once the script is ready then type a small bit of YAML to attach it to a button the Firemote card. Essentially, I was thinking that with YAML I could allow something like this:

volume_up:
  script: your_script_name_here
power:
  script: your_other_script_name_here

Just because it seems like the easiest route for a user in my mind, doesn't mean that every user would agree. I'm glad you're cool with it! If you (or anyone else reading this) have an idea for a different approach that might make this sort of customization easier for a new Home Assistant user, I'd love to hear it!

Easy and stable is the main goal, all without sacrificing flexibility.

@toddsay
Copy link

toddsay commented Oct 14, 2022

Just to add an opinion here: My guess is that most buttons could be handled by a single service call. Something like this example (although the data part would probably need to allow anything, as there are different forms for that.

If I'm right about that, I think it would be simplest to keep most button commands in a single yaml file, but it would be great if scripts were supported as well. Something like this maybe? Or does that complicate your side of things too much?

volume_up:
  service: harmony.send_command
  target:
    entity_id: remote.tv_room
  data:
    command:
      - VolumeUp
    device: 428297615
power:
  script: script_name_here

Basically this just avoids the need to create separate scripts for each button.

@PRProd
Copy link
Owner

PRProd commented Oct 14, 2022

Best of both worlds? Thanks for the input @toddsay.

@clinds34
Copy link

clinds34 commented Nov 8, 2022

Hi - just wanted to add my vote to allowing an override for volume commands through script or whatever is easiest to integrate. I like that the remote is exactly as the physical version.

Only other enhancement would be to add buttons based on apps that are not standard. But not as important as volume.

Thank you for this remote, it looks fantastic and works as expected.

@michaelhenningersrb
Copy link

Here is another vote for this feature 👍
We be greate if could send IR commands via service call to turn on my tv

@PRProd
Copy link
Owner

PRProd commented Nov 10, 2022

@clinds34 - Currently, Firemote supports more than the 4 apps that come pre-programmed into the physical remote controls. Here is the current list:

  • prime-video
  • netflix
  • disney-plus
  • hulu
  • jellyfin
  • hbo-max
  • showtime
  • starz
  • youtube
  • pandora
  • plex
  • tennis-channel
  • amc-plus
  • apple-tv
  • paramount-plus

If there is a specific (non-sideloaded) app or apps you would like added to this list, just let me know and I'll make it happen for you.

@clinds34
Copy link

Hi - it is the Bell Fibe TV app and the Crave tv app. Thank you!

PRProd added a commit that referenced this issue Nov 16, 2022
Added Part 1 of Button Overrides Request: #6
- You can now override any button with a Home Assistant Script (see
documentation)
 - YAML based scripts will be coming in part 2

Added app shortcuts:
 - Bell Fibe TV (Canada) @clinds34 #6
 - BBC iPlayer (UK) - (needs community sign-off ) @Scoff123 #5

Fixed button press animation scale issue when Firemote was not set at
100% scale

Began Device Type exhaustive list setup

Added support for Fire TV Toshiba V35

Fixed Power On / Power off issue for Fire Stick 4K 1st gen 2018
@PRProd
Copy link
Owner

PRProd commented Nov 16, 2022

Release v1.8.0 is now available!

Button Overrides are now possible through Home Assistant scripts. Take a look at the ReadMe file for usage instructions

YAML based script commands will be available in a future release. For now, this issue will be marked as closed.

@clinds34 - This release includes an app shortcut for Bell Fibe TV, but I was unable to complete your request for the Crave TV app shortcut. Please take a look at issue #13 to see if you can assist further.

@PRProd PRProd closed this as completed Nov 16, 2022
@craigrouse
Copy link

Confirming that this works beautifully for me, and I now have the volume buttons controlling my Sonos sound bar, and the power button toggling the TV on and off. BBC iPlayer also works. It took me a little while to figure out how to clear the very sticky frontend cache; for a long time, I thought it wasn't working, but it turned out to be just the cache. Thanks a lot for this @PRProd!

@broyuken
Copy link

Just commenting here to check in on using service calls for button overrides. I don’t want to make scripts for volume up, volume down, mute and power if this new version is coming soon.

@PRProd
Copy link
Owner

PRProd commented Dec 27, 2022

@broyuken - I've been taking some time off of this project during the holiday season, but I plan on resuming work fairly soon. My apologies for the delay.

@PRProd PRProd reopened this Mar 22, 2023
PRProd added a commit that referenced this issue Mar 23, 2023
What's new:
As discussed long ago in #6, the option to call Home Assistant services
directly through the YAML config has finally arrived!

Details can be found here:
https://github.com/PRProd/HA-Firemote#button-overrides

Special thanks to @ghvader, @toddsay, @clinds34, @michaelhenningersrb,
@craigrouse, and @broyuken for this additional override request, and
their patience with me to finally get it done.

NVIDIA Shield style 1 remote now includes the secret volume control
buttons in the "spine" area between the "wings" on the bottom of the
remote.  Click around and you might find them.
@PRProd
Copy link
Owner

PRProd commented Mar 23, 2023

I'M SOOOO SORRY for not getting the second part of this done months ago! To be honest, I might have forgotten about it. 😉

With the release of version 2.0.3 you are now able to directly override Firemote buttons using your YAML config without the need to write an additional script. Here is an example of how to make that work:

button_overrides:
  volume-up-button:
    service: light.toggle
    target:
      entity_id: light.bedroom_lamp
    data:
      color_name: red
      transition: 2
      brightness_pct: 100

I'm not sure why anybody would want to turn the bedroom lamp on and off while also making it red and bright, but there you go.
The complete documentation for the button override features can still be found in the README.md file.

Let me know what you think! ...or maybe yell at me for taking so long?? 😄 Enjoy!

@PRProd PRProd closed this as completed Mar 23, 2023
@toddsay
Copy link

toddsay commented Mar 23, 2023

Thanks for this! And for the example of how to enable "red light district" mode. 😆

You gave us the "best of both worlds" solution. This gives us lots of flexibility. 👍

It's working well for me, mapping the volume up/down/mute buttons to my receiver. The only oddities relate to how the media_player. commands work (so not specific to your work at all). The volume up/down options use a large interval, and the mute function isn't a toggle (need to specify on or off, which is weird). To get around this I'll probably target some Harmony remote commands rather than using the media_player/receiver commands directly. Or I could make a script. Many ways around it I'm sure.

@PRProd
Copy link
Owner

PRProd commented Mar 23, 2023

@toddsay - It's possible that I handled something incorrectly on my end.

One thing that could be useful for me to look at is if you could show me a Firemote YAML config section side by side with a YAML script, and explain precisely their difference in behavior. (if any)

I modeled my Firemote YAML config format to match how a script looks, but I didn't have a lot of examples to test with... maybe I got distracted by the red light? 😆 Either way, if you can make it work how you need it to work in a HA script, then likely it can be done in Firemote too.

@toddsay
Copy link

toddsay commented Mar 23, 2023

Thanks, I don't think there are any issues with your work (or none that I'm aware of). I only mentioned the media_player oddities because others might try similar settings. I'll let you know if I find issues but I think it's just normal behavior.

@Jeppedy
Copy link

Jeppedy commented Oct 13, 2023

With the release of version 2.0.3 you are now able to directly override Firemote buttons using your YAML config without the need to write an additional script. Here is an example of how to make that work:

button_overrides:
  volume-up-button:
    service: light.toggle
    target:
      entity_id: light.bedroom_lamp
    data:
      color_name: red
      transition: 2
      brightness_pct: 100

Not working for me outside of a Script. DOWN does not work when in-line; DOWN as a script, same service call, works fine.

type: custom:firemote-card
entity: media_player.fire_tv_192_168_3_45
device_family: amazon-fire
device_type: fire_tv_stick_4k_max
compatibility_mode: default
defaultRemoteStyle_override: ''
button_overrides:
  volume-down-button:
    service: webostv.button
    data:
      entity_id: media_player.lg_webos_tv_un8500auj
      button: VOLUMEDOWN
  volume-up-button:
    script: LR_FireTV_VolumeUp

Any suggestions?

@PRProd
Copy link
Owner

PRProd commented Oct 13, 2023

@Jeppedy - Give this a try:

button_overrides:
  volume-down-button:
    service: webostv.button
    target:
      entity_id: media_player.lg_webos_tv_un8500auj
    data:
      button: VOLUMEDOWN

@Jeppedy
Copy link

Jeppedy commented Oct 13, 2023

@Jeppedy - Give this a try:

button_overrides:
  volume-down-button:
    service: webostv.button
    target:
      entity_id: media_player.lg_webos_tv_un8500auj
    data:
      button: VOLUMEDOWN

You are waaay too kind, and I must have been working on it waay too late at night. SORRY to bother you... Of course that works... :-)

@PRProd
Copy link
Owner

PRProd commented Oct 13, 2023

No worries, @Jeppedy! I'm just glad that it's working for you now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants