maxileith / homebridge-appletv-enhanced

Homebridge plugin that exposes Apple TVs with features that should be native to Apple HomeKit.
MIT License
138 stars 1 forks source link

Volume Support #103

Open drewspmartin opened 7 months ago

drewspmartin commented 7 months ago

Current Situation

Right now there is no way to mute/unmute appletv nor set volume via HomeKit.

Proposed Change

Have a mute/unmute switch that acts as a toggle (if possible, no toggle is fine too). Have volume of the AppleTV represented as a brightness slider.

Additional Context

No response

maxileith commented 7 months ago

Hi @drewspmartin ,

thank you for the enhancement request. In version v0.7.0-0 I have added the functionality to control the volume from the iOS remote or via a switch (up and down event). I am currently uncertain about the best way to implement the slider functionality since it depends on the audio setup wether or not this is even possible. I will keep you updated here.

drewspmartin commented 7 months ago

@maxileith thanks! Can you do a mute/unmute?

maxileith commented 7 months ago

@drewspmartin currently I do not have an option to get the current volume. So I can set the volume to 0 to mute. However, I cannot unmute since I do not know the volume that was set before.

drewspmartin commented 7 months ago

@maxileith well thanks again for the feature. Much appreciated!

maxileith commented 7 months ago

This message is to everybody who likes to see the volume feature and has development experience.

Feel free to develop the volume feature and open a PR. Here are some key points to tackle:

I currently do not have an audio setup to test this ... so I cannot develop that myself.

ukiews commented 6 months ago

Take a look here: https://github.com/Ghawken/appleTV-indigoPlugin

I am able to set the volume using the Indigo Plugin in a different home setup.

You might need to add an option for the user to select if they have a CEC-enabled remote audio receiver. Once the volume control is limited to CEC (absolute volume) devices, the user can specify what is the maximum integer (x) volume their audio receiver supports.

drewspmartin commented 6 months ago

You rock! Thank you!!!

jsiegenthaler commented 4 months ago

This message is to everybody who likes to see the volume feature and has development experience.

Feel free to develop the volume feature and open a PR. Here are some key points to tackle:

  • How to handle audio setups where the Apple TV has no control over the volume (no HDMI CEC)
  • How to handle audio setups where the Apple TV can only control the volume in relative steps
  • How to handle audio setups where the Apple TV can control the volume absolut
  • Is there a way to automatically detect which of the above is present?

I currently do not have an audio setup to test this ... so I cannot develop that myself.

I implemented this in my Samsung TV plugin, where the Volume Up/Down and Mute are implemented as network remote commands. You can control the volume from the iOS Remote Control, using the Volume buttons on the side of the iPhone

maxileith commented 4 months ago

@jsiegenthaler this is implemented in Apple TV Enhanced as well. But this is not what the feature request is all about.

switey commented 2 months ago

Could you please provide a hint on how pressing iPhone volume buttons in Apple TV enhanced remote could fire an event? I’m trying to set those as network automation trigger

vmarks commented 5 days ago
How to handle audio setups where the Apple TV has no control over the volume (no HDMI CEC)

Nothing to do here. The audio output device controls volume. For example, An HDMI audio extractor that breaks out audio to optical or stereo RCA - Apple TV doesn't control the volume, unless the user programs the remote to imitate the output device's volume controls.

How to handle audio setups where the Apple TV can only control the volume in relative steps

two options:

  1. discrete UP/DN keys/switches, probably placed side by side in a combined switch OR
  2. create it as a fan switch that maps the % of fan speed to increments.
How to handle audio setups where the Apple TV can control the volume absolute

fan switch speed. This is the most desirable option.

Is there a way to automatically detect which of the above is present?

Not that I can think of, seems like a configuration option to set in homebridge plugin config. The majority of people do not change audio setups that frequently.

vmarks commented 5 days ago

I would accept the volume up down keys as a grouped/combined pair of switches in Apple Home app - but the fan speed dimmer is much more desirable.

drewspmartin commented 5 days ago

If it's fan speed, then I can detect the speed it's at, mute it, then return to the same fan speed. This essentially gets me the long awaited "Mute/Unmute" button which I can assign to Flic. Then at any point a commercial is on, my elderly dad can press the button to mute and press the button again to unmute. Using standard AppleTV volume here (no CEC).

maxileith commented 5 days ago

Using standard AppleTV volume here (no CEC).

What do you mean by that? To my knowledge, there are only two options ... HDMI-CEC and IR. There is no way my plugin can control IR. It is just technically not possible.

drewspmartin commented 5 days ago

I have HomePod speakers which means the AppleTV audio is controlled in absolute? I think that's the way you put it. Apple TV controls the volume and its on a slider not stepped.

maxileith commented 6 hours ago

v1.5.0-0 does have the option to enable a fan for volume control. Set the configuration option absoluteVolumeControl to true if you want to try it.

However, there is one problem. There is a race condition which can possibly set the volume to 100% after unmuting (activating the fan). I think that is a homebridge issue. I have opened an issue for that here: https://github.com/homebridge/homebridge/issues/3645