-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessory "Apple TV" does not "turn on" with native remote #155
Comments
Do you use HomePod(s) as your default speaker(s)? |
No i'm not using my HomePod as default speaker, my projector has a built-in soundbar. |
Please post debug logs from the initial start of the plugin until the problem occurs. Mark the spots where you turn on or off your Apple TV with the original remote in the logs. |
So, it is working at your place? Do you know how i can turn on the debug logs? |
You can change the log level of the plugin in the configuration.
I cannot reproduce the issue on my side. |
@rvetere any updates? |
Today I started to experience the same problem described her. Everything works e.g automation with lights, when i turn the Apple TV on through the Accessory, or with the "Turn On" command - but it's not working when i just use the native remote. Logs show no special errors, but the "New Active State: on/off" in the logs is missing when using native remote. Edit: After making some changes in the plugin (enable/disable some motion sensors) and restarting the plugin, I now see the "New Active State: on/off" in the logs when I use the native remote, and everything is now working. |
Hey @maxileith, I've changed to Log Level 4 (Debug) as you suggested however any kind of log appears when I use the native remote controller. |
Please post the debug logs here. |
We are not looking for errors. Please post debug logs here and mark the point where you are turning on / off the Apple TV with the physical remote. |
@mufler I've tried what you said but it didn't work. 😢 @maxileith the logs bellow:
|
Do you guys have any HDMI hops between the Apple TV and the television? AV Receiver / HDMI Hub / Hue Sync Box ... |
And it would also be nice if you @felipehjcosta and @mufler could answer this question :) |
@maxileith I use 2 HomePods as speakers. |
@felipehjcosta from the README:
|
@maxileith I don't have any HDMI hops between the Apple TV and the television but I have enabled HDMI-CEC on my TV. |
That's sad. 😢 I will follow the original issue on pyatv thanks!
|
Hi, I dont have any HDMI hops between the Apple TV and the television. I dont have HomePod either, my speakers are connected to TVs line/headphone out. |
What did you change exactly? |
Since I didn't have any sensors enabled, I enabled some and disabled all "Remote Keys as Switches" (mainly turn_off and turn_on). I also updated plugin to v1.0.1. Here is my working config:
|
Weird that shouldn't change anything regarding the active state. Thanks for letting me know. |
Hey everybody, here i deliver my debug logs as i found out now what is the debug-level (4!, it's nowhere documented here..) I can already say - no, i have no HDMI hops between my Apple TV and my Epson Beamer, but i too activated "HDMI-CEC" to sync the volume from my apple-tv remote to my beamer. After i personally started investigation "how to determine if an Apple TV is running", i came up with the idea to develop a small App for Apple TV, which then could be used to expose something like an API for this plugin - maybe much stabler..? How did you implement your "active" state anyway? So, my homebridge is running since ~4 hours now, apple TV is turned off and the Accessory in Homebridge has "active state = false". Now i just hit my apple remote power button, Apple TV turns on, the Accessory doesn't change at all and these are my logs:
Nothing special to see i guess, except the "event deviceState: null", null is not the state i'm looking for as the device is running :-/ Update: i can see in the logs how the "device discovery" is started again and still no luck to determine the correct state of "active = true", but my Apple TV is still turned on 😢 Update2: Now if i restart the childbridge of "Apple TV Enhanced", it detects the correct state with "idle", these are the logs:
PS: maybe to cheer you up a bit - i have tried all available "Android TV" plugins too as my beamer would have an android tv platform... Not one of them can determine an active state reliably, it is the same behavior with everyone... it works from the beginning, and just breaks silently after one day running :D I'm now investigating if there are smart plugs available for homekit where i can trigger on a certain amount of power consumption (THAT would be the ONLY reliable trigger i guess which also works after one year running :D) @mufler cool you got it working at your place now - but just wait now for 3-4 hours or a day... and, does it still work then? i'm pretty sure it will break again (i'm in the same situation, it works from a fresh start, but not anymore after 1 day active) |
@rvetere thank you for providing the logs 👍🏻
It is documented in the
Way too much overhead ... this can definetly be determined the way I am currently doing it. At my side it is rock solid.
Just look at the source code, this is what FOSS is all about 😉
What do you mean with "running"? Is music/video playing? If not, this is the expected behaviour. What I need you to do @rvetere: Send me the output of It may be the case that the output of this script differs wether or not one has a HDMI CEC setup or not. |
oh, when i just execute this script you told me, i become an exception:
Ah no, nothing was playing, so then the state would be correct :) And sorry about the loglevel rant :D i was only in the json config and never checked the UI again, and here in the readme i was looking for a little description about logLevel and couldn't find one |
@rvetere maybe there is something wrong with the credentials ... can you delete the file |
ok i killed all stored credentials, also resetted the cached accessory and also recreated the venv... but i still get the same exception when i try to execute the |
Mhm, after playing around more i got this error now when i turned the apple tv on with the accessory (it turned on successfully, but did not change state to "on")
|
Sorry for the confusion, but the command I mentioned here is wrong. You need to use |
Ok cool, this is working :) Here is the output:
|
@rvetere Can you do this again and turn on / off the Apple TV? P.S. I have added descriptions for each configuration parameter to the README 😄 |
Of course i can do that, but, it doesn't show anything new to me... I turn on my Apple-TV, and just execute the command:
Turn it off again and execute the command
And when i repeat this 5 times, it always shows the correct "power_state", but my Accessory looks like this: Because the script seems to work perfect and always returns the correct state, i went this far that i wrote my own little plugin that just polls this script in an interval of 4 seconds and just gives me a motion sensor that triggers when it turns on... Surprisingly, this is working pretty well even after a day and it always detects it right (yeah, the script is truly working)... Fun fact, while my "ATV Poller" plugin is active, then the state of the Accessory "Apple TV" seems to be correct too! :D Well, after two days of running i disabled my poller again as it eats up all the ressources and makes my Raspberry Pi pretty unstable (well, no wonder why :D) I'm a programmer myself and i just wanted to investigate further with this little "poller" - but of course, this is not the setup i'm looking for. Meantime, i also wrote Apple in the official "Apple TV Feedback Form" that they should just implement this "power-on" state in their native integration! I would love to get back to the native integrations once Apple has fixed that (and it COULDN'T be hard for them, as the apple tv app on iphone is already giving me these states and triggers when i use the Shortcut app, but just not in HomeKit -.-) Maybe we should all do this and spam apple until they can deliver :/ Sometimes i hate this friggin company to be such a monopol... https://www.apple.com/feedback/apple-tv/ PS: the best trigger i've got so far is to use a Meross Smartplug that can measure power consumption, and with the "homebridge-meross" plugin i can get a "in use" trigger at a certain threshold of power consumption - this way i can truly see when my whole beamer-system is running and it would be perfect! downside, it takes 30 seconds to trigger -.- totally unusable... |
Oh, another interesting find in the logs:
I really don't like to see |
next i'm going to build a tiny esp32 board with a low-tech camera and just watch the tiny LED that starts shining on the device with tensor flow :D there's already a project in place to do that ^^ https://github.com/jomjol/AI-on-the-edge-device |
Hi @rvetere, I think I have found the root cause. However, before that I want to say something … Way of communication
You can always do your own projects if you do not have the trust into this project. No software project is perfect, there are always some bugs. You will just not get around this! What is bugging me here is that you are only complaining all the time and providing suggestions for solutions that are ridiculous, like …
or
… which is kind of concerning. Nevertheless, you have really found a bug here and I am willing to fix that bug with you, but I need you to cooperate on this with me. Open-source should be fun, and I do not have the feeling that you are appreciating what I am doing here … I want this issue to be fixed for you and potentially others, too. I just cannot reproduce the error with my setup. This is why I need you to provide the exact outputs that I need to investigate the problem. You truely need to work on your tone. This is by far the most disrespectful way of dealing with an issue that I have experienced in this project.
I did not ask you to turn on your Apple TV, then execute the I think I have found the root cause …I think I have found the root cause. Let us look at the following: {"result": "success", "datetime": "2024-01-11T19:45:57.122827+01:00", "power_state": "on"}
{"result": "success", "datetime": "2024-01-11T19:45:57.123138+01:00", "output_devices": [{"name": "Apple TV", "identifier": "D4ED48E4-4C88-47C0-B05C-077747F85C5D"}]}
{"result": "success", "datetime": "2024-01-11T19:45:57.125393+01:00", "hash": "ca496c14642c78af6dd4250191fe175f6dafd72b4c33bcbab43c454aae051da1", "media_type": "unknown", "device_state": "idle", "title": null, "artist": null, "album": null, "genre": null, "total_time": null, "position": null, "shuffle": "off", "repeat": "off", "series_name": null, "season_number": null, "episode_number": null, "content_identifier": null, "app": null, "app_id": null}
{"result": "success", "datetime": "2024-01-11T19:45:57.126692+01:00", "volume": 50.0} There are 4 lines in this log, that have different JSON schemas, let just refer to them as line 1, 2, 3 and 4. I did only know of the schema of line 1, 3 and 4 since 2 never appeared on my setup. So this is an unexpected pattern to me. As it turns out, the developer of sebbo2002/node-pyatv did not know of that either (I suppose). I am using this dependency to integrate pyatv into my plugin. Just recently I have discovered a bug in this dependency which resulted in a very similar error pattern, see #147. In order to fix that, I have opened sebbo2002/node-pyatv#291 (if you want to know the details about the root cause, please take a look into the PR, this will apply for this issue as well). I think we will need a similar fix for this issue, so I have created an issue here: sebbo2002/node-pyatv#295 So now we need to wait for the developer to review the issue, provide a fix and release it. But I am confident that this is the problem we were looking for. |
@rvetere any questions or suggestions adding to this? |
Wow, that's fantastic news! I'm really pleased to hear that you've successfully identified the root cause. I want to apologize for my tone in our previous interaction. I wasn't in the best frame of mind to engage constructively and I realize now that I shouldn't have written in that state. My apologies for any inconvenience caused! |
Hi again guys, good to see that you have not given up on this issue! Edit: Looks like I have found a repeatable situation when this issue occurs. It happens when I connect my bluetooth headphones to AppleTV. Here is my process with AppleTV native remote:
|
@mufler Nothing to do on your side. I will update you guys here once the fix to the problem is released ... |
@mufler thanks for the steps to reproduce. This might seem like the same problem we are looking at here in this issue since the symptom is the same. However, this is another issue which is most likely related to postlund/pyatv#1667. Could you please open a new bug report with the title "connected to temporary audio device --> power state incorrect". |
@maxileith I have submitted the bug report here: postlund/pyatv#2331 |
@rvetere Could you check wether or not v1.1.1-2 works for you? |
I just discovered a bug because of which there is still a possibility for mediaType, deviceType and powerState to be reported as null: sebbo2002/node-pyatv#301 |
@rvetere Can you check if v1.2.0-2 resolves your issues? |
Hi @maxileith, thanks for your work on this plugin. I’ve been lurking here because my setup is having a similar issue—the plugin tracks the on/off state of my Apple TVs at first, but then it stops and the only thing that seems to get it working is a fully resetting everything (reinstalling the plugin, deleting the credentials, etc.). Unfortunately, v1.2.0-2 does not seem to resolve it. What I have noticed is that it is reliable on my 2nd generation Apple TV 4K. It’s the 3rd generation unit that is having issues. I would be willing to provide whatever logs you need if you think they will help, but I may not have time for a few days. Just wanted to offer some feedback on the most recent beta. |
@poopmagic Could you please open a new issue for that. If it is not fixed in v1.2.0-2 it is likely to be a different root cause. Please ensure that you answer the follwoing questions when filling out a new bug report:
|
@maxileith No, still no luck with v1.2.0-5, even after a complet fresh setup, the same behavior - the accessory breaks after a few hours uptime |
@rvetere Thanks for the reply. Sorry to say that, but could you please provide logs once more. Set the log level to verbose (level 5) and turn on / off your Apple TV. Mark the spots where you turned on / off your Apple TV in the logs. I really thought that the issue solved in v1.2.0-2 was the cause ... |
Ok i did that, and i think i found a whole new root cause, but first things first.
This
Well, so far, nothing special in the boot-log i think... So i went further and turned on my Apple TV Gen3 4k:
And after that, i tunred it off again:
And now it's getting really interesting - search trough the logs for the name "MacBook Pro", and at least in the "turn-off" log, you find it! Does that mean that my Macbook Pro is somehow registered as the Apple TV? Seems like! This could also explain the "can be reached on OSI Layer 2 but not on 3" i guess |
No, the plugin is just searching for devices and finds your MacBook. As you can see from the log, the plugin is not adding your MacBook as an Apple TV, just the actual Apple TV. Verbose log removed:
So from the logs that you have provided, I cannot see anything wrong. It would be intresting to get the verbose logs of the moment the unexpected behaviour appears. Regarding |
ok, strange that nothing wrong can be seen then... well, i guess as i am the only one with this issue, from my side, you can close this ticket and i'm good so far... i will replace my apple tv remote with something working and deinstall the plugin then (sorry, really no offense) |
@rvetere I'm sorry that the issue is still there on your side. I hope you find a solution that works out for you. |
@maxileith All good so far and sorry for my passive aggressive tone i stumbled into meanwhile 🙏 I can get very emotional with tech stuff and that's not good in open source communities (i basically should know that after 20 years of programming -.-) I have a solution now - it's the Flirc USB dongle and the Flirc Skip Remote:
For anybody curious, here is my virtual-button plugin: https://github.com/rocket-monkey/homebridge-virtual-button |
Analysis
I have successfully installed v1.0.0 of the Plugin, all logs are looking good, the Apple TV is discovered and no error shows up. I also get the Accessory running so far and i can turn it on/off successfully by using the Accessory trough Homebridge.
Now, the thing that i actually want to achieve - i have an automation in place that declines the canvas and turn off all lights when the Apple TV is getting activated.
The automation works great when i turn the Apple TV on trough the Accessory, or with the "Turn On" command - but it's not working great when i just use the native remote.
Expected Behavior
I would like to have a reliable "active state", especially when i use the native remote.
Steps To Reproduce
Logs
Configuration
Environment
Additional Context
Sometimes when i come home after a day, i see the following Warning in the Logs:
Of course, this can be a reason why it suddenly stops working - i just don't know what to fix in my network, because, the network is working fine! I see my Apple TV online in my connected wifi devices with the static IP it always gets
The text was updated successfully, but these errors were encountered: