lukasroegner / homebridge-apple-tv-remote

Plugin for controlling Apple TVs in homebridge.
MIT License
131 stars 13 forks source link

Random command problem #41

Closed remy42 closed 4 years ago

remy42 commented 4 years ago

hi I meet a strange bug with the plugin json configuration is OK I activated the ON / OFF and PLAY / PAUSE button

When I click to activate the pause, it works.

But when I move the button back to ON it does not restart reading. I have to put it back on PAUSE then PLAY to make it work. I have the same behavior with ON / OFF

Thank you in advance for your help

lukasroegner commented 4 years ago

But when I move the button back to ON it does not restart reading. I have to put it back on PAUSE then PLAY to make it work. I have the same behavior with ON / OFF

Can you explain what you means with "it does not restart reading"? Which HomeKit app are you using?

remy42 commented 4 years ago

I use the native home app at Apple

When I lower the yellow button, the film pauses (no problem)

As I go up the button to restart the movie playback, the button is yellow, but the movie doesn't restart. I have to put on pause then play and there it restarts.

lukasroegner commented 4 years ago

Which app do you use on the Apple TV when this happens? Have you tried it out on other apps on the Apple TV? Does it behave the same way?

remy42 commented 4 years ago

I use Netflix , Molotov TV or Share screen of my iphone and it's the same issue.. :(

lukasroegner commented 4 years ago

Ok, at least Netflix should work properly. Please start Homebridge in debug mode (parameter -D) and provide logs, starting when you change the play/pause switch to off.

remy42 commented 4 years ago

sorry Yes. netflix is OK but not molotov TV and share screen (video) from iphone. And for button ON/OFF apple TV ok for log. please wait

remy42 commented 4 years ago

I can't find how to start homebridge in debug mode. can you tell me the command line please. because the service starts alone when I launch my raspberry

lukasroegner commented 4 years ago

This is something I cannot provide a simple answer to. Depending on your OS and configuration, there are several ways to manage services. If you use systemd for services, you can stop the homebridge service with the command sudo systemctl stop NAME_OF_YOUR_HOMEBRIDGE_SERVICE.

After you've stopped the service, you can start homebridge with parameter -D to enable debug output.

remy42 commented 4 years ago

ok I find. thank's

which log file do you want? where are they located?

lukasroegner commented 4 years ago

The logs are printed out in the console when you start Homebridge.

remy42 commented 4 years ago

HERE I CLICK "PAUSE" ##### it's OK

[2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Play/pause switch changed to false [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Pressing key pause... [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Connecting... [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Force reconnect: false [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Retry count: 10 [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Already connected [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Now playing info received: playing [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Play/pause switch updated to true [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Now playing info received: paused [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Sending heartbeat... [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Connecting... [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Force reconnect: false [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Retry count: 10 [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Already connected [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Play/pause switch updated to false [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Message received: logicalDeviceCount - 1 | isProxyGroupPlayer - false | isAirplayActive - false [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] On/off switch updated to true [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Now playing info received: paused [2020-5-10 23:55:28] [Apple TV Platform] [AppleTV Chambre] Play/pause switch updated to false

HERE I CLICK "PLAY" ##### NOT OK

[2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Play/pause switch changed to true [2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Pressing key play... [2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Connecting... [2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Force reconnect: false [2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Retry count: 10 [2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Already connected

HERE I CLICK "PAUSE"

instantly the button goes DOWN then UP and Molotov TV restart

[2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Play/pause switch changed to false [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Pressing key pause... [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Connecting... [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Force reconnect: false [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Retry count: 10 [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Already connected [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Now playing info received: playing [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Sending heartbeat... [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Connecting... [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Force reconnect: false [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Retry count: 10 [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Already connected [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Play/pause switch updated to true [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Now playing info received: playing [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Play/pause switch updated to true [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] Message received: logicalDeviceCount - 1 | isProxyGroupPlayer - false | isAirplayActive - false [2020-5-10 23:55:39] [Apple TV Platform] [AppleTV Chambre] On/off switch updated to true [2020-5-10 23:55:39] [ConbeeII] Phoscon-GW: gateway request 133: get /sensors [2020-5-10 23:55:39] [ConbeeII] Phoscon-GW: gateway request 133: ok [2020-5-10 23:55:39] [ConbeeII] Phoscon-GW: gateway request 134: get /lights [2020-5-10 23:55:39] [ConbeeII] Phoscon-GW: gateway request 134: ok

lukasroegner commented 4 years ago

I assume that there are no missing log entries between the three snippets?

[2020-5-10 23:55:33] [Apple TV Platform] [AppleTV Chambre] Pressing key play...

I can see from the logs that the virtual pressing of the "play" key works and there is no error reported by the Apple TV. Although, the Apple TV does not start playback and also does not report that it is playing (Now playing info received: playing).

Can you make sure that the exact same issue occurs when you are using Netflix? I just want to make sure that is it not an issue of the Motolov TV app.

remy42 commented 4 years ago

no I did not delete a log between the 3 stages

I wrote it a little above. with netflix everything works fine.

lukasroegner commented 4 years ago

That really sounds like an issue with the app itself.

I suggest that you try to send commands with the appletv command line tool included in node-appletv-x to check whether the app reacts properly to the play command.

Example:

appletv --credentials '<your_pairing_token>' command play
robboz4 commented 4 years ago

I’m experiencing weird behavior also. I only have the power button exposed. However, it will turn on the AppleTV but the status is not reflected as being on in the Homebridge app or the UX interface. Pressing power again sometimes gets the button to reflect that the TV is on. But then I can’t power it off, it steps through the Apple menu. Last night everything was functioning and properly reflected in the menus. I then used a scene command to turn everything off which worked. A bit later the Apple Tv turned back on. I get “ returning cache power state false” in the log file when I tested this morning.

robboz4 commented 4 years ago

OK. More testing. Powering on from Homebridge does turn on the Apple TV but after a few seconds turns the icon back to power off. If you power on again Apple TV navigates to Apple TV. And then after a few seconds the icon goes back to power off state. Either Apple TV has changed something or there is a coomincation issue with the current version of this plugin 0.8.5

sergoo-lbt commented 4 years ago

@robboz4 Exactly the same situation. Unfortunately, this plug-in can't be used in Apple tv automation. Everything is not stable. Replaced this plugin with management via broadlink. Good luck to the developer in bringing it to perfection!

mese16 commented 4 years ago

Hi Same problem here, status (Power On/off) is flapping. I use also "Homebridge Harmony" perhaps a problem related to this plugin?

lukasroegner commented 4 years ago

@robboz4 That seems the like the same issue as in #37, where the Apple TV does not send back the new state. Currently, the priority is to prevent crashes (Socket.writeAfterFIN), afterwards, I can concentrate on fixing possible issues in the detection logic for ON/OFF.

You can already enable the debug log (start homebridge with parameter -D) and post the logs from when you're powering on but the switch flips back to off. Thus I can check whether your issue is related to the detection logic or Apple TV not sending back the new state.

@mese16 No, it should not be an issue due to combination of plugins.

robboz4 commented 4 years ago

I tried to test With the debug flag set, but Homebridge kept crashing before I could do a test. I had to turn off the debug flag to get Homebridge to stay up. I’ll see if I can get a copy of the log file posted although without the test it probably won’t help. Sorry.

lukasroegner commented 4 years ago

@robboz4 Ok, let's wait until crashes are fixed (see #37), then we can get back to check the logic for detecting on/off state.

lukasroegner commented 4 years ago

I've created an issue that merges several other issues. This new issue will be used to track the instability issues: #46