lprhodes / homebridge-apple-tv

Apple TV 4th & 5th gen plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
105 stars 15 forks source link

HDMI-CEC commands #24

Open crzdg opened 6 years ago

crzdg commented 6 years ago

The sleep and suspend command does only turn the ATV off. The TV will stay on. If I turn off the ATV with the remote (long press on TV button, then sleep) also the TV goes off over HDMI-CEC.

MrDrache333 commented 6 years ago

Look for the Plugin homebridge-cec-accessory...its because the AppleTV sends another cec command to the TV...with this Plugin you send only one Command...with this cec Plugin you can add all HDMI Devices to homekit and for example control them over Scenes

crzdg commented 6 years ago

I have seen this. But Homebridge isn't connected to the TV setup. Also not a real option for me here.

I thought more about the chance to send a long press command, if not possible already. That way I could send the ATV and TV to sleep over user interaction and that should do the trick.

MrDrache333 commented 6 years ago

Hmmm...see your Problem here...in the Documentation of this plugin is only something to send Commands with Pause, Repeat and Interval...you can of cause try it if you send the TV Command like 2-3 Seconds very often and look what the ATV answers you to that :)

joshbish commented 6 years ago

Is there by chance a homebridge plug-in for your TV that can turn it off? I was able to find a plugin for my receiver which then turns off my TV. Just a thought if this can’t be fixed.

jungopro commented 6 years ago

Hi @crzdg I might have a solution for you...

I'm using the plugin and when pressing sleep in the home app it turns off / on both ATV and the TV (Samsung)

I played with the CEC plugin before and it didn't work for me, but I did install the cec-client as prereq to the npm plugin... maybe the fact that I have the cec-client is what making it work...

So bottom line, install the cec-client plugin sudo apt-get install cec-utils on your homebridge device and see if this solves the issue (it may be an implicit dependency)

I will be happy to know if this solves your issue as I want to include it in my backup process

Thanks Omer

jmaver commented 6 years ago

I couldn't get a combination of repeat/interval to work for having sleep do CEC. My TV is too dumb to handle any commands itself, sadly. And my onkyo receiver isn't supported in the ONkyo plugin.

So, for now, I have a wake button. Maybe someone will figure out a CEC sleep later one.

crzdg commented 6 years ago

Thanks for the replies!

@jmaver: Yes same for me. Wasn't able to find any information about Node-appletv for interval or repeat. So this workaround isn't working.

@jungopro: Hi! Just installed the dependencies. But I'm not at home in the moment, so can't actually see if the TV is turning off. Will let you know as soon I can check. It does sound interesting, though. But you haven't connected your homebridge to the HDMI installation. As I stated before, the RPI with Homebridge is running downstairs in the data center.

DarKOrange75 commented 6 years ago

Same issue here, sending sleep command to TV won't turn off the TV. It does with the TV remote.

jungopro commented 6 years ago

I’m using a combination of the ATV and HB CEC Plugin Basically I created an automation in the home app that once ATV sleep command is pressed it triggers the TV power off function of the CEC plugin. I will test it and let you know how this works

ersan commented 5 years ago

Ah, glad I found this thread - same problem here. I was hoping to replace my Harmony Hubs with a simple toggle to turn the TV on and off.

As stated above, if you hold down TV on the remote and select 'sleep' it will send the CEC command - so if there were some way to script that sequence of actions I think that could be a workaround. But there is no long press command in homebridge-apple-tv currently.

Installing cec-client on the Homebridge device isn't going to do anything unless it's connected to your TV by HDMI - mine (and probably most others') are not.

I think maybe the Samsung TV that is working is more sophisticated or has some function to turn off the TV when the connected device goes to sleep. I don't think that is the norm.

MsCopernic commented 5 years ago

After reading the comments from @jungopro, I did something similar without CEC, I didd it using automation in Apple HomeKit and is working perfectly. Now I can turn on/off all the required equipments needed for AppleTV and the Apple TV, so I hope that the following code can help some one:

First, I created two buttons in the Apple TV Plugin as follows (4TH generation APTV can be turned on using any button)

    {
      "deviceID":"Alcoba",
      "name":"APTV On",
      "command":"select"
    },
    {
      "deviceID":"Alcoba",
      "name":"APTV Off",
      "command":"sleep"
    }

I also created a new button in the Broadlink plugin section

    {
      "name":"Apple TV Uno",
      "type":"switch",
      "data":{
        "on":[ Turn on/set amplifier, TV ....  ],
        "off":[ Turn off amplifier, TV, .....] 
      }
    }

Finally, in the HomeKit App, I created two automations that define what happens when the last button (Apple TV Uno) is turned on/off

When turned On: Add the APTV On button and turn it on When Turned Off: Add the APTV Off button and turn it on

Regards

danielrobinson95 commented 5 years ago

Hey @crzdg check this out. This simulates long pressing the TV button to put the ATV in sleep, you can combine the newly added action with an OK press. works beautifully for me. https://github.com/lprhodes/homebridge-apple-tv/issues/34#issuecomment-433197391