evandcoleman / node-appletv

A node module for interacting with an Apple TV (4th-generation or later) over the Media Remote Protocol.
https://evandcoleman.github.io/node-appletv/
MIT License
178 stars 48 forks source link

Suspend command doesn't send CEC off to TV #6

Open ersan opened 6 years ago

ersan commented 6 years ago

I'm just starting to learn about this protocol, but what I wanted to do with it was replace my logitech harmony system by having commands to turn the TV's in my house on and off. When you hold the menu button and select sleep it will send a CEC command to turn off my TV, but when I do appletv command suspend via node-appletv it does not, it just puts the Apple TV to sleep without sending the command.

Sending any command will send the CEC wake command if the TV is off, as expected.

I guess what I wanted to know is: is it possible to script the 'hold down TV button, click sleep' sequence using this plugin (or Media Remote Protocol in general) or if I'm wasting my time?

octalmage commented 6 years ago

Can you do it with the iOS remote app? If it’s possible there then it seems like it should be possible here.

ersan commented 6 years ago

What I ended up doing was hook up RPi’s to each of my TV’s and use node-appletv to send the suspend command and then a CEC off command to the TV right after. It was the most consistent solution for me, I couldn’t get the key sequence working and IIRC any mediaremotetv command sent to the ATV wakes it up, which is undesirable.

ryanquinlan commented 6 years ago

Anyone sort this out? Digging through things now, it's not overly obvious where the actual commands/keys are defined. Seems like you could alter the key press duration. Just need the details on how to send the key that looks like a TV screen on the physical/app remotes it seems.