Closed Nastras closed 4 years ago
Have you seen such an issue again with the next
version? This should be fixed as the next
version always tries to reconnect if commands cannot be sent to the Apple TV.
I just tested it.
But the plugin does not recognize that Apple TV is not available since several minutes?
I have repeated test 2. and the behaviour is the same. Plugin does not recognize that all tv is disconnected from the stream. When power is restored the plugin crashes.
Hi @Nastras,
I think I found the issue, I missed some try-catch-logic for errors when sending the heartbeat message to the Apple TV. I published a new version on the next
branch (also on NPM with next
tag).
Can you check it out?
I have made the update but unfortunately I can't test it because I will be back home at the weekend. Sorry.
Today I noticed something else with the first next version. When the Apple TV is embedded in a scene with the state off and the scene is triggered it turns on. But I could not test it extensively.
@Nastras, I added a check if the Apple TV is already on if switched on/is already off if switched off. This prevents actions if the Apple TV is already in the requested state. New version is on NPM.
Hello Lukas, I finally got a chance to try it out.
@Nastras, I added a check if the Apple TV is already on if switched on/is already off if switched off. This prevents actions if the Apple TV is already in the requested state. New version is on NPM.
It works!
I have repeated test 2. and the behaviour is the same. Plugin does not recognize that all tv is disconnected from the stream. When power is restored the plugin crashes.
The error still exists. But the error is not a problem because the instance restarts automatically. Therefore the question is whether it is worth the effort?
Hi @Nastras,
I really tried to find all usages of the node-appletv library and surrounded them with try-catch (so that the error is handled by the plugin). Either I missed one or this error occurs on a different "thread" and thus cannot be handled by the plugin.
I made several changes to my homebridge setup, I'm now using separate instances for each plugin and switched over to a Raspberry Pi 4. That should make it easier for me to go through the logs and detect issues with the plugins.
Honestly, I can't find a missing try-catch in the code of the plugin, that's why I assume that the exception is unhandled in a dependency of node-appletv-x. I'll keep an eye on that and update the dependencies as soon as updates are available.
Hello Lukas,
I'm just trying out a few things with the plugin. I noticed that when the Apple TV is not available and you send a command the Homebridge instance crashes.
Wouldn't it make sense to create a loop where the plugin waits until the Apple TV is available again and displays a message in the Journalctl that the command cannot be sent?
Best regards Nastra