Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Stability issues #46

Open
lukasroegner opened this issue May 27, 2020 · 69 comments
Open

Stability issues #46

lukasroegner opened this issue May 27, 2020 · 69 comments

Comments

@lukasroegner
Copy link
Owner

There are three main issues with the plugin in its current state:

Delayed messages
For some users, messages from the Apple TV to the plugin are delayed (sometimes for minutes), resulting in switches that are out of sync. As the on/off switch emulates remote input, it also cannot execute the correct action if the plugin state is out of sync with the Apple TV state.

On/off detection
The logic to detect whether an Apple TV is on or off is not correct, yet. Currently, three state variables are considered to check whether the Apple TV is on:

    /**
     * Tries to get the on/off state of the Apple TV
     * @param messagePayload The message payload that contains the information to check whether the Apple TV is on.
     * @returns Returns a value that determines whether the Apple TV is on.
     */
    private getIsOn(messagePayload: any): boolean {

        // If the Apple TV is not a proxy for AirPlay playback, the logicalDeviceCount determines the state
        if (messagePayload.logicalDeviceCount > 0 && !messagePayload.isProxyGroupPlayer) {
            return true;
        }

        // If the Apple TV is a proxy for AirPlay playback, the logicalDeviceCount and the AirPlay state determine the state
        if (messagePayload.logicalDeviceCount > 0 && messagePayload.isProxyGroupPlayer && messagePayload.isAirplayActive) {
            return true;
        }
        return false;
    }

Crashes of homebridge
For some users, connections to the Apple TV are suddenly closed, resulting in an unhandled exception when the plugin tries to send a message through the closed channel. The PR for fixing the request has also been submitted, but not accepted, yet: stickpin/node-appletv-x#3

@lukasroegner
Copy link
Owner Author

If you have new findings and want to share them here, please make sure to

  1. Name the issue that your findings are about
  2. Create a PR or post the affected part of the source code
  3. Post your hardware/software configuration (Apple TV version, Apple TV OS version, Homebridge host OS and version, node version, special router in network?)
  4. Not just post logs without explanation

I'll start extensive testing in my environment soon and try to reproduce the networking issues (delayed messages) first with fix for crashes of Homebridge applied.

@dmike3
Copy link

dmike3 commented Jun 11, 2020

Homebridge is crashing for me. If I send a command to fast together it will crash.

I tried reinstalling the plugin.

@sschuste
Copy link

I'm not sure if I'm right in this thread. Since a few days the plugin crashes very often, on average every 30 to 45 minutes, without me using it or any automation triggering it. The error message is:

[6/13/2020, 11:36:19] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>:null:null)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22

[6/13/2020, 11:36:19] Got SIGTERM, shutting down Homebridge...

Error: This socket has been ended by the other party. Which socket is meant and why there is a party on my Raspi? I've enabled the API of your plugin. I see that this error is triggered by node-apple-tv-x, so maybe I'm not only in the wrong thread, but I'm asking the wrong developer? :-D

@lukasroegner
Copy link
Owner Author

lukasroegner commented Jun 13, 2020

@sschuste You're at the right place! The PR has not been accepted by stickpin yet, I added a new comment, maybe he forgot about it. Anyways, if the PR is not not merged within the next days, I'll reference my fork of node-appletv-x in the plugin.

This should solve the issue of writing to the closed connection. I haven't found out why some people have this issue so often and others (including me) haven't seen this once.

@sschuste
Copy link

All right. I'll wait and see. Normally I would hardly notice a crash of the Homebridge, but I have a small monitoring system running and it generates an hearable acoustic signal when the Homebridge is down. At the moment the alarm is triggered very often.

Interesting might be the accumulation of alarms. I grep'd my logs starting at May 10th:
May 21: 1 crash
Jun 5: 1 crash
Jun 11: 2 crashes
Jun 12: 20 crashes
Jun 13: 20 crashes (today, in only 12 hours so far)

Something has changed. Apple TV update?

@kitsen13
Copy link

kitsen13 commented Jun 17, 2020

Great plugin!!

But I have the same problem AppleTv 4k 32go v13.3.1 (not the latest), Homebridge 1.1.1 , raspbian buster 4.19.66-v7+ and an error message at the startup of homebridge. (same error socket than sschuste). The normal CPU charge is about 2% without plugin and with plugin on the first hour was 8%, and then I had some crashes of homebridge 40% (no refresh of the accessories and impossible commands).
API not activated.
Homebridge-mqttthing v1.1.16 installed.

Thanks in advance

@DJay-X
Copy link

DJay-X commented Jun 18, 2020

Looking forward to get this fix. Knowing it's not all in your hands @lukasroegner

[2020-6-18 18:17:07] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:08] Got SIGTERM, shutting down Homebridge...
[2020-6-18 18:17:08] [AppleTvPlatform] Shutting down Apple TV clients...
[2020-6-18 18:17:09] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:10] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:11] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:11] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:12] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:12] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22
[2020-6-18 18:17:13] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:454:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:153:33
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22

@cgerke
Copy link

cgerke commented Jun 20, 2020

Not sure yet if its relevant but I've been running this plugin for months without issue but last night updated from Jessie to Buster and immediately started seeing the socket issue above. Still poking around.

@cgerke
Copy link

cgerke commented Jun 20, 2020

Further to this, I simply removed the plugin from homebridge and re-added after the buster update and haven't seen the issue since.

Raspbian GNU/Linux Buster (10)
Node.js v12.18.1
NPM v6.14.5

@lukasroegner
Copy link
Owner Author

New version is now on NPM, which points to my fork of node-appletv-x. This fork contains the fix for the "writeAfterFIN" issue.

@RaymondMouthaan
Copy link

Hi @lukasroegner,

Upgrading the plugin to 0.8.6 gives the following error:

USER: root
DIR: /homebridge
CMD: npm install --save homebridge-apple-tv-remote@latest

npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > spawn-sync@1.0.15 postinstall /root/.npm/_cacache/tmp/git-clone-2a4912e7/node_modules/caporal/node_modules/spawn-sync
npm ERR! prepareGitDep > node postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > protobufjs@6.9.0 postinstall /root/.npm/_cacache/tmp/git-clone-2a4912e7/node_modules/protobufjs
npm ERR! prepareGitDep > node scripts/postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 prepare /root/.npm/_cacache/tmp/git-clone-2a4912e7
npm ERR! prepareGitDep > npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 build /root/.npm/_cacache/tmp/git-clone-2a4912e7
npm ERR! prepareGitDep > npm run clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated @types/ora@3.2.0: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm ERR! prepareGitDep npm ERR! missing script: clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T07_56_23_407Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 build: `npm run clean`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T07_56_23_421Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 prepare: `npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T07_56_23_474Z-debug.log
npm ERR! prepareGitDep 
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-21T07_56_23_645Z-debug.log

Command failed. Please review log for details.

@lukasroegner
Copy link
Owner Author

Have you tried with sudo?

@RaymondMouthaan
Copy link

Have you tried with sudo?

npm install --save homebridge-apple-tv-remote@latest runs as root, as you can see at the top of the log file. However running it as sudo just doesn't help either ...

@lukasroegner
Copy link
Owner Author

I think the issue is that the dependency "node-appletv-x" is already installed, but now re-installed and updated from a different source. Can you try to uninstall the plugin (which should also uninstall "node-appletv-x" and reinstall it?

@RaymondMouthaan
Copy link

I am sorry but that didn't help either ... I uninstalled 0.8.5, restarted Homebridge and tried installing 0.8.6, but the same error occures ... it complains about a missing clean script ???

@lukasroegner
Copy link
Owner Author

This is what I did to check if installation works:

npm uninstall -g node-appletv-x
npm uninstall -g homebridge-apple-tv-remote
sudo npm install -g homebridge-apple-tv-remote

@RaymondMouthaan
Copy link

Did exactly what you did ...

/homebridge # npm uninstall -g node-appletv-x
up to date in 0.043s
/homebridge # npm uninstall -g homebridge-apple-tv-remote

up to date in 0.048s
/homebridge # 
/homebridge # 
/homebridge # sudo npm install -g homebridge-apple-tv-remote
npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > spawn-sync@1.0.15 postinstall /root/.npm/_cacache/tmp/git-clone-2c257371/node_modules/caporal/node_modules/spawn-sync
npm ERR! prepareGitDep > node postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > protobufjs@6.9.0 postinstall /root/.npm/_cacache/tmp/git-clone-2c257371/node_modules/protobufjs
npm ERR! prepareGitDep > node scripts/postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 prepare /root/.npm/_cacache/tmp/git-clone-2c257371
npm ERR! prepareGitDep > npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 build /root/.npm/_cacache/tmp/git-clone-2c257371
npm ERR! prepareGitDep > npm run clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated @types/ora@3.2.0: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm ERR! prepareGitDep npm ERR! missing script: clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T08_31_21_165Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 build: `npm run clean`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T08_31_21_181Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 prepare: `npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /root/.npm/_logs/2020-06-21T08_31_21_233Z-debug.log
npm ERR! prepareGitDep 
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-06-21T08_31_21_275Z-debug.log

@lukasroegner
Copy link
Owner Author

If you try to install the previous version of the plugin, does that still work?

@RaymondMouthaan
Copy link

Yes that still works:

/homebridge # sudo npm install -g homebridge-apple-tv-remote@0.8.5

> protobufjs@6.9.0 postinstall /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/protobufjs
> node scripts/postinstall


> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/spawn-sync
> node postinstall

+ homebridge-apple-tv-remote@0.8.5
added 210 packages from 170 contributors in 11.567s

@lukasroegner
Copy link
Owner Author

What about

npm install -g node-appletv-x

vs.

npm install -g https://github.com/lukasroegner/node-appletv-x.git

@RaymondMouthaan
Copy link

The first command executes successful, but the second causes the error, apparently the fork doesn't want to get installed ...

@lukasroegner
Copy link
Owner Author

That is super strange. The only thing that I changed is a line of code and the version number...

@RaymondMouthaan
Copy link

RaymondMouthaan commented Jun 21, 2020

Let me setup a new homebridge container to see if that solves the issue of installing the fork..

[update] in a container where neither node-appletv-x nor lukasroegner/node-appletv-x.git nor homebridge-apple-tv-remote has been installed before:

npm install -g https://github.com/lukasroegner/node-appletv-x.git still fails :(

@lukasroegner
Copy link
Owner Author

In the same container, does node-appletv-x install properly?

@RaymondMouthaan
Copy link

RaymondMouthaan commented Jun 21, 2020

yes it does:

/homebridge # npm install -g node-appletv-x
/usr/local/bin/appletv -> /usr/local/lib/node_modules/node-appletv-x/bin/appletv

> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/node-appletv-x/node_modules/spawn-sync
> node postinstall


> protobufjs@6.9.0 postinstall /usr/local/lib/node_modules/node-appletv-x/node_modules/protobufjs
> node scripts/postinstall

+ node-appletv-x@1.0.17
added 164 packages from 142 contributors in 7.602s

@DJay-X
Copy link

DJay-X commented Jun 21, 2020

@lukasroegner I tried to update with config-ui-x and run into this error.

USER: pi
DIR: /usr/local/lib
CMD: sudo -E -n npm install homebridge-apple-tv-remote@latest

npm ERR! prepareGitDep 1> 
npm ERR! prepareGitDep > spawn-sync@1.0.15 postinstall /home/pi/.npm/_cacache/tmp/git-clone-36d51fed/node_modules/caporal/node_modules/spawn-sync
npm ERR! prepareGitDep > node postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > protobufjs@6.9.0 postinstall /home/pi/.npm/_cacache/tmp/git-clone-36d51fed/node_modules/protobufjs
npm ERR! prepareGitDep > node scripts/postinstall
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 prepare /home/pi/.npm/_cacache/tmp/git-clone-36d51fed
npm ERR! prepareGitDep > npm run build
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep > node-appletv-x@1.0.18 build /home/pi/.npm/_cacache/tmp/git-clone-36d51fed
npm ERR! prepareGitDep > npm run clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 
npm ERR! prepareGitDep 2> npm WARN install Usage of the `--dev` option is deprecated. Use `--only=dev` instead.
npm ERR! prepareGitDep npm WARN deprecated @types/ora@3.2.0: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm ERR! prepareGitDep npm ERR! missing script: clean
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/pi/.npm/_logs/2020-06-21T09_42_37_260Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 build: `npm run clean`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 build script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/pi/.npm/_logs/2020-06-21T09_42_37_359Z-debug.log
npm ERR! prepareGitDep npm ERR! code ELIFECYCLE
npm ERR! prepareGitDep npm ERR! errno 1
npm ERR! prepareGitDep npm ERR! node-appletv-x@1.0.18 prepare: `npm run build`
npm ERR! prepareGitDep npm ERR! Exit status 1
npm ERR! prepareGitDep npm ERR! 
npm ERR! prepareGitDep npm ERR! Failed at the node-appletv-x@1.0.18 prepare script.
npm ERR! prepareGitDep npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! prepareGitDep 
npm ERR! prepareGitDep npm ERR! A complete log of this run can be found in:
npm ERR! prepareGitDep npm ERR!     /home/pi/.npm/_logs/2020-06-21T09_42_37_673Z-debug.log
npm ERR! prepareGitDep 
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-06-21T09_42_37_971Z-debug.log

Command failed. Please review log for details.

2020-06-21T09_42_37_971Z-debug.log
2020-06-21T09_42_37_359Z-debug.log

@MsCopernic
Copy link

MsCopernic commented Jul 21, 2020

Hi, I don't know what OS is being used by the persons that are reporting problems with this plugin, in my case I downloaded the Raspberry PI Raspbian image (from https://github.com/homebridge/homebridge-raspbian-image) and it's been running with 0 errors now for many months. I really appreciate the work done by lukasroegnser, I was using another software for my apple tv's (https://github.com/lprhodes/homebridge-apple-tv) that at the end gave me nothing but problems.

@rohan-buechner
Copy link

First time installing this plugin.
The device pairing worked fine (via node-appletv-x)
The TV switch is appearing on my Apple Home views (see below)

2020-07-28 at 18 32

But upon clicking the switch my homebridge dies with the following logs. (I've also seen this heartbeat issue mentioned elsewhere in here)

2020-07-28 at 18 34

My apply TV is currently on the latest tvOS14.

I've also seen this log printed after another failed attempt.

[7/28/2020, 6:32:39 PM] Error: This socket has been ended by the other party
    at Socket.writeAfterFIN [as write] (net.js:455:14)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:154:37
    at new Promise (<anonymous>)
    at Connection.sendProtocolMessage (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:134:16)
    at Connection.send (/usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/connection.js:130:21)
    at /usr/local/lib/node_modules/homebridge-apple-tv-remote/node_modules/node-appletv-x/dist/lib/appletv.js:182:22

@sschuste
Copy link

After I noticed that there is a new update, I started the next attempt. I had this stupid load problem all the time and the temperature rise. In the end I had to uninstall your plugin.

I am thrilled! Now your plugin runs even with my setup. Load is stable, and so is the temperature of the Raspi.

Lukas, thank you very much for the effort you put into this plugin. My apartment has become a little more beautiful again. I only use the plugin to switch the ATV on and off. I can't say anything about all the other functions, but what I need works just fine.

@try-and-error-and-repeat

Hey are you still on the part with the delayed messages since tvOS 14 it happens very often?
Thank you for your work 😁

@lukasroegner
Copy link
Owner Author

@try-and-error-and-repeat I haven't had issues with delayed responses from the Apple TV in the past and cannot reproduce this issue on tvOS. It still seems to depend on the host system and/or network configuration.

I'm running the plugin on a Raspberry Pi 4, connected via Ethernet, plain Homebridge (no HOOBS), Amplifi router. The switches are updated within milliseconds.

@try-and-error-and-repeat

@lukasroegner I had no problem until the update to tvOS 14. It worked fine and was 99% reliable.

I use a Raspberry Pi 3, connected via Ethernet (Gigabit on the same network switch as the Apple TV 4K) also plain homebridge, FRITZ!Box 7490 Router and homebridge with Version 1.2.2. Node.js with version 12.18.4 and npm 6.18.4. home hub is also the Apple TV 4K

@brj5
Copy link

brj5 commented Sep 26, 2020

Plug-in is causing homebridge to give error sigterm command received and causing it to not be able to start, homebridge will not even start up with the plugin installed.

@lukasroegner
Copy link
Owner Author

@brj5 Can you please provide debug logs so that the cause of your issue can be investigated?

@brj5
Copy link

brj5 commented Sep 28, 2020

INFO: Homebridge Version: 2.6
INFO: SmartThings-v2 Plugin Version: 2.3.8
INFO: Checking Package Version for Updates...
[9/27/2020, 9:41:52 PM] [Alexa] Initializing Alexa platform...
[9/27/2020, 9:41:52 PM] [Alexa] homebridge-alexa v0.4.74, node v12.18.4, homebridge v1.2.3
[9/27/2020, 9:41:52 PM] Initializing platform accessory 'Alexa'...
[9/27/2020, 9:41:52 PM] [Apple TV Platform] Initializing AppleTvPlatform platform...
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] Configuring cached accessory: [Sylvia TP] 8006D708D3FB3181C5047D0F92AD1DCE1CC71E79 efea0c2a-deae-47c1-877d-713ba7beb6c3
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] Configuring cached accessory: [George] 80063216504BED33259330D033C900271CC8DF9F d5471697-7289-4bed-9228-9d9b427dcae3
[9/27/2020, 9:41:52 PM] [SengledHub] configureAccessory: B0CE1814033A6325
[9/27/2020, 9:41:52 PM] [SengledHub] configureAccessory: B0CE18140320C9B5
[9/27/2020, 9:41:52 PM] [SengledHub] DeviceDiscovery invoked
INFO: Fetching SmartThings-v2 Devices. NOTICE: This may take a moment if you have a large number of device data is being loaded!
GOOD: Refreshing All Device Data | Source: (First Launch)
[9/27/2020, 9:41:52 PM] [Apple TV Platform] Initialing platform...
[9/27/2020, 9:41:52 PM] [Apple TV Platform] No devices configured.
Setup Payload:
X-HM://0023ISYWY9B5J
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ 031-45-154 │     
└────────────┘     

[9/27/2020, 9:41:52 PM] Homebridge v1.2.3 is running on port 52108.
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] New Device Online: [Sylvia TP] plug [8006D708D3FB3181C5047D0F92AD1DCE1CC71E79] 192.168.1.128 9999
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] Adding: [Sylvia TP] plug [8006D708D3FB3181C5047D0F92AD1DCE1CC71E79]
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] New Device Online: [George] plug [80063216504BED33259330D033C900271CC8DF9F] 192.168.1.100 9999
[9/27/2020, 9:41:52 PM] [TplinkSmarthome] Adding: [George] plug [80063216504BED33259330D033C900271CC8DF9F]
NOTICE: Temperature Unit is Now: (F)
WARN: Devices to Remove: (0) []
INFO: Devices to Update: (3)
GOOD: Devices to Create: (0) []
ALERT: Total Initialization Time: (1 seconds)
NOTICE: Unknown Capabilities: []
INFO: SmartThings DeviceCache Size: (3)
INFO: WebServer Initiated...
INFO: Sending StartDirect Request to SmartThings | SendToLocalHub: (false)
INFO: Direct Connect Active | Listening at 192.168.1.107:8000
Error: timeout of 2000ms exceeded
at createError (/homebridge/node_modules/homebridge-sengled/node_modules/axios/lib/core/createError.js:16:15)
at Timeout.handleRequestTimeout [as _onTimeout] (/homebridge/node_modules/homebridge-sengled/node_modules/axios/lib/adapters/http.js:207:16)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
config: {
adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 2000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
headers: {
Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json;charset=utf-8',
'User-Agent': 'axios/0.17.1',
'Content-Length': 125
},
baseURL: 'https://us-elements.cloud.sengled.com:443/zigbee/',
withCredentials: true,
responseType: 'json',
method: 'post',
url: 'https://us-elements.cloud.sengled.com:443/zigbee/customer/remoteLogin.json',
data: '{"uuid":"d0452dbd-f03d-094f-6c8d-e72fc36a7d8e","isRemote":true,"user":""pwd":","os_type":"ios"}',
maxRedirects: 0,
[Symbol(COOKIEJAR_SUPPORT_LOCAL)]: { backupOptions: [Object], jar: [CookieJar], redirectCount: 5 }
},
code: 'ECONNABORTED',
request: ClientRequest {
_events: [Object: null prototype] {
response: [Function],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 125,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'us-elements.cloud.sengled.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 11,
connecting: false,
_hadError: false,
_parent: null,
_host: 'us-elements.cloud.sengled.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: [HTTPParser],
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 115,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 368,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'us-elements.cloud.sengled.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 11,
connecting: false,
_hadError: false,
_parent: null,
_host: 'us-elements.cloud.sengled.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: [HTTPParser],
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 115,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 368,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /zigbee/customer/remoteLogin.json HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'Content-Type: application/json;charset=utf-8\r\n' +
'User-Agent: axios/0.17.1\r\n' +
'Content-Length: 125\r\n' +
'Host: us-elements.cloud.sengled.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
insecureHTTPParser: undefined,
path: '/zigbee/customer/remoteLogin.json',
_ended: false,
res: null,
aborted: true,
timeoutCb: null,
upgradeOrConnect: false,
parser: HTTPParser {
'0': [Function: parserOnHeaders],
'1': [Function: parserOnHeadersComplete],
'2': [Function: parserOnBody],
'3': [Function: parserOnMessageComplete],
'4': null,
_headers: [],
_url: '',
socket: [TLSSocket],
incoming: null,
outgoing: [Circular],
maxHeaderPairs: 2000,
_consumed: false,
onIncoming: [Function: parserOnIncomingClient],
[Symbol(resource_symbol)]: [HTTPClientAsyncResource]
},
maxHeadersCount: null,
reusedSocket: false,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array]
}
},
response: undefined
}
Error: timeout of 2000ms exceeded
at createError (/homebridge/node_modules/homebridge-sengled/node_modules/axios/lib/core/createError.js:16:15)
at Timeout.handleRequestTimeout [as _onTimeout] (/homebridge/node_modules/homebridge-sengled/node_modules/axios/lib/adapters/http.js:207:16)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7) {
config: {
adapter: [Function: httpAdapter],
transformRequest: { '0': [Function: transformRequest] },
transformResponse: { '0': [Function: transformResponse] },
timeout: 2000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
headers: {
Accept: 'application/json, text/plain, /',
'Content-Type': 'application/json;charset=utf-8',
'User-Agent': 'axios/0.17.1',
'Content-Length': 125
},
baseURL: 'https://us-elements.cloud.sengled.com:443/zigbee/',
withCredentials: true,
responseType: 'json',
method: 'post',
url: 'https://us-elements.cloud.sengled.com:443/zigbee/customer/remoteLogin.json',
data: '{"uuid":"d0452dbd-f03d-094f-6c8d-e72fc36a7d8e","isRemote":true,"user":"","os_type":"ios"}',
maxRedirects: 0,
[Symbol(COOKIEJAR_SUPPORT_LOCAL)]: { backupOptions: [Object], jar: [CookieJar], redirectCount: 5 }
},
code: 'ECONNABORTED',
request: ClientRequest {
_events: [Object: null prototype] {
response: [Function],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 125,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'us-elements.cloud.sengled.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 11,
connecting: false,
_hadError: false,
_parent: null,
_host: 'us-elements.cloud.sengled.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: [HTTPParser],
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 115,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 368,
[Symbol(connect-options)]: [Object]
},
connection: TLSSocket {
_tlsOptions: [Object],
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
secureConnecting: true,
_SNICallback: null,
servername: 'us-elements.cloud.sengled.com',
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events: [Object: null prototype],
_eventsCount: 11,
connecting: false,
_hadError: false,
_parent: null,
_host: 'us-elements.cloud.sengled.com',
_readableState: [ReadableState],
readable: false,
_maxListeners: undefined,
_writableState: [WritableState],
writable: false,
allowHalfOpen: false,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: [HTTPParser],
_httpMessage: [Circular],
[Symbol(res)]: [TLSWrap],
[Symbol(verified)]: true,
[Symbol(pendingSession)]: null,
[Symbol(asyncId)]: 115,
[Symbol(kHandle)]: null,
[Symbol(kSetNoDelay)]: false,
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: null,
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kCapture)]: false,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 368,
[Symbol(connect-options)]: [Object]
},
_header: 'POST /zigbee/customer/remoteLogin.json HTTP/1.1\r\n' +
'Accept: application/json, text/plain, /\r\n' +
'Content-Type: application/json;charset=utf-8\r\n' +
'User-Agent: axios/0.17.1\r\n' +
'Content-Length: 125\r\n' +
'Host: us-elements.cloud.sengled.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 443,
protocol: 'https:',
options: [Object],
requests: {},
sockets: [Object],
freeSockets: {},
keepAliveMsecs: 1000,
keepAlive: false,
maxSockets: Infinity,
maxFreeSockets: 256,
maxCachedSessions: 100,
_sessionCache: [Object],
[Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
insecureHTTPParser: undefined,
path: '/zigbee/customer/remoteLogin.json',
_ended: false,
res: null,
aborted: true,
timeoutCb: null,
upgradeOrConnect: false,
parser: HTTPParser {
'0': [Function: parserOnHeaders],
'1': [Function: parserOnHeadersComplete],
'2': [Function: parserOnBody],
'3': [Function: parserOnMessageComplete],
'4': null,
_headers: [],
_url: '',
socket: [TLSSocket],
incoming: null,
outgoing: [Circular],
maxHeaderPairs: 2000,
_consumed: false,
onIncoming: [Function: parserOnIncomingClient],
[Symbol(resource_symbol)]: [HTTPClientAsyncResource]
},
maxHeadersCount: null,
reusedSocket: false,
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
accept: [Array],
'content-type': [Array],
'user-agent': [Array],
'content-length': [Array],
host: [Array]
}
},
response: undefined
}
ERROR: uncaughtException: abort(Error: timeout of 2000ms exceeded). Build with -s ASSERTIONS=1 for more info.
No stack trace
[9/27/2020, 9:41:54 PM] Got SIGTERM, shutting down Homebridge...
[9/27/2020, 9:41:54 PM] [Apple TV Platform] Shutting down Apple TV clients...
INFO: INFO: Your plugin version is up-to-date
NOTICE: Sending Plugin Status to SmartThings | UpdateAvailable: false
[9/27/2020, 9:41:59 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null

@Post404
Copy link

Post404 commented Oct 4, 2020

I never had problems with the delay that people are talking about here, it always worked instantly for me. But since the updates from last weekend there is a big delay. Everything is updated to it's latest version. Nothing has changed in the network.

@Post404
Copy link

Post404 commented Oct 4, 2020

I reinstalled the plugin and now the problem is only related to the play Pauze buttons, I added the application related buttons for Netflix and YouTube as well. But they behave the same way.

@try-and-error-and-repeat
Copy link

try-and-error-and-repeat commented Oct 4, 2020

Same problem. Running it on a separate RPi 3 with just this plugin and homebridge UI X. So the Problem is not related to other plugins.

I can send debug logs if this would help.

@uspino2
Copy link

uspino2 commented Oct 5, 2020

I get this error every 7 seconds for 15 to 20 minutes every time I restart HomeBridge, until it finally connects to my Apple TV. I'm on a clean UniFi network. Anything I can do about it? Thanks!

[10/5/2020, 11:26:11 AM] [AppleTvPlatform] [ATV Projector] Error while connecting: Error: Apple TV not found while scanning.

@shahrafique
Copy link

shahrafique commented Oct 15, 2020

Greetings to all. Not sure whether it is the right place to post my issue or not. Please help and advise. I have installed homebridge-apple-tv-remote in my RP Hoobs.

But stopped the server frequently. Any suggestion? Also, like to know if there is refresh option for the connection.
please help. Thank you very much!

@brj5
Copy link

brj5 commented Oct 22, 2020

@brj5 Can you please provide debug logs so that the cause of your issue can be investigated?

I provided the logs in a post above, I retried this again and got the same error, I really want this to work so I can use Alexa with my tv.

@njuart
Copy link

njuart commented Nov 4, 2020

Hi, looks like I also have a delay issue, at least it’s related to Play / Pause button. So when I press Play / Pause on AW, remote, AirPods I see that in Home app it changes state only after 30-40 seconds. Problem is that I have some automations in which this switch is involved and those are also being executed with the same delay which is quite annoying =( Besides that, if I press Play / Pause when it’s out of sync (during these 30-40 seconds) playback starts (or stops) and at the time it is synced it might be already in wrong state, meaning if playback is on, switch shows Pause state. Thx for any help in advance @lukasroegner

My setup is:
RPi 3+ with native HB 1.2.3
Node.JS 12.19.0
NPM 6.14.18

@kevinjohncutler
Copy link

I'm also experiencing the same delay issue as @njuart, same setup as well. Strange thing is that it worked flawlessly for the first hour.

@JDBem
Copy link

JDBem commented Dec 4, 2020

@lukasroegner Thanks so much for this plugin, it's a great plugin!

I'm experiencing this same delay/out of sync play/pause button issue as @njuart has mentioned.

MacOS
Node.js Version | v14.15.0
Npm Version | v6.14.8

@try-and-error-and-repeat

Today I tried to connect my second Apple TV and did not gave him a unique Name for the Play Pause and the On Off Switch and it worked. So I tried the same with my first Apple TV with the "Out-Of-Sync-Problem" and it worked also. I'll take a closer look to that in the next few days but maybe it helps others also. My Config looks like this right now:
{
"name": "Apple TV 4K",
"credentials": "4....a0e5",
"isOnOffSwitchEnabled": true,
"isPlayPauseSwitchEnabled": true
}

@iogitio
Copy link

iogitio commented Apr 15, 2021

has anyone gotten on/off detection to work super reliably? It's not perfect on my end but hoping to figure this out so I can layer automation on top :)

@Luke2kk
Copy link

Luke2kk commented May 31, 2021

I do also experience a delay with the atv turn on/off switch. Is there a know reason behind?

@linkx2252
Copy link

Today I tried to connect my second Apple TV and did not gave him a unique Name for the Play Pause and the On Off Switch and it worked. So I tried the same with my first Apple TV with the "Out-Of-Sync-Problem" and it worked also. I'll take a closer look to that in the next few days but maybe it helps others also. My Config looks like this right now:
{
"name": "Apple TV 4K",
"credentials": "4....a0e5",
"isOnOffSwitchEnabled": true,
"isPlayPauseSwitchEnabled": true
}

Just wanted to give this more visibility. I was having problems, I removed the unique name and it fixed it!

@EvoSems
Copy link

EvoSems commented Oct 2, 2021

No Apple TVs found on the network. Try again. latest TVOS any work around? TIA

@meltinsands
Copy link

meltinsands commented Nov 6, 2021

Like many others I have the connection problem since OS15:
Apple has dropped the direct Media Remote Protocol support with iOS15 #114

Will you get your plugin working again?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests