Add AppleTV to HASS

Right. Did you by any chance remove and re-add the Apple TV at some point lately?

Hi @postlund - i am not sure what led to this disconnection. so I don’t know if I can help answer than. However, in my attempts to fix the issue, I did reinstall the appleTV integration. So, I think that led to the name change. Thanks for your support!

What I mean is: did you go to the integration page, remove the Apple TV from there and then add it again (doing pairing and all that)? I have an idea of what is wrong, related to handling of unique identifiers, and I guess you might have experienced that. It will be one of the things I try to solve before final version of the component.

So far, it’s working like a charm. Thank you! I just wished I saw this first.

I just spent an hour trying to configure using the main HA documentation. If none of those configurations work anymore, I’d wish it would just be taken down or heavily edited. I don’t think it’s right to have “documentation” full of non-working, out-of-date configurations.

1 Like

Yes, sorry about that! Documentation has not been my priority here. The documentation per se works, but only for pre-tvOS 13 device. This should have been stated. It is only announced via the alerts page:

I will however re-write the documentation soon! Thanks for trying it out btw!

1 Like

Just tried it out and, wow, rather easy to get working. Thanks!!

No problem! Thank YOU for doing all that hard work. So far, the only quirk I see is that whenever I am playing something via the Sling app, it reports the state as “not playing.” I don’t know if this would be considered an “issue” necessarily, more like something to assess to get the kinks out, if possible.

Thanks again!

Thanks again for testing, it helps sorting out the quirks :smile:

That sounds like a bug to me. State should always be correct, other metadata like title, artist and so on might be missing because the app doesn’t provide it. If you can either run Home Assistant with these log points enabled and provide some logs:

logger:
  logs:
    pyatv: debug
    custom_components.apple_tv: debug

Or use atvremote --debug ... playing to extract logs, that would help a lot!

Im stuck if I want to integrate my AppleTV and I didnt know why. :frowning:
After I type the PIN from my AppleTV in HA it just shows a windows with “Canceled”.
Any Idea what I can do?

I put logger in my configuration.yaml, but not sure, where I see this logs. :sweat_smile:

The log is available under Developer Tools -> Logs in the side pane.

The only log I find about the apple tv is:

You are using a custom integration for apple_tv which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

Make sure you have this in your config:

logger:
  logs:
    pyatv: debug
    custom_components.apple_tv: debug

Try to add your device. Then press “Load full
Home assistant log” to get the full log.

2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.srp] Client (Proof=35cb6527cda16f719d007e0452dd44cced835485f101ebb75aff5d52458a9fead4f242d1701c48cad4d506893d6e17b02b7a4f3d6e6c43d228621384c9e6a4ef, Public=ee6796002882d284d9b69104ec9791fbca1083bdbb1d1e8dacb30ef59334b082c0e30501bf2cb9336bb588795d541cb433da7523f34e5ab22eab9dbd8453bc45b138103b59d717c331abdc99efad52f416dc1cad714cc5ef8194ffc64162a5cec13f98485e11911c0954d48bc12019153f19e3e5cb1eb1c8a482887a25d58f2948bc9ab825e30fd6046bfc075f1e4278c8f20e7041bcbbed924d91e0b610759dfe9c64dca2cc9bd60f1f00401cb36e6db5ecc3681028758a8461d2ab5f312ad772bb222c60c86e404467514acd2f17ebdeb9dfe321a52d51cd41f72520ed73d5d92e2b6cb3cc360d65d780aaea15c270faa51ac70497bc79583ac811a3011...) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] >> Send (Data=08222000ba02d4030ac90306010303ffee6796002882d284d9b69104ec9791fbca1083bdbb1d1e8dacb30ef59334b082c0e30501bf2cb9336bb588795d541cb433da7523f34e5ab22eab9dbd8453bc45b138103b59d717c331abdc99efad52f416dc1cad714cc5ef8194ffc64162a5cec13f98485e11911c0954d48bc12019153f19e3e5cb1eb1c8a482887a25d58f2948bc9ab825e30fd6046bfc075f1e4278c8f20e7041bcbbed924d91e0b610759dfe9c64dca2cc9bd60f1f00401cb36e6db5ecc3681028758a8461d2ab5f312ad772bb222c60c86e404467514acd2f17ebdeb9dfe321a52d51cd41f72520ed73d5d92e2b6cb3cc360d65d780aaea15c...) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] >> Send: Protobuf: type: CRYPTO_PAIRING_MESSAGE priority: 0 [cryptoPairingMessage] { pairingData: "\006\001\003\003\377\356g\226\000(\202\322\204\331\266\221\004\354\227\221\373\312\020\203\275\273\035\036\215\254\263\016\365\2234... status: 0 isRetrying: false isUsingSystemPairing: false state: 0 } 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=5608222000ba024f0a4506010404405cbe46f6e2eabaabb5a0340855ddeafe09961ff935b1b07952b376e97feaea282792ea00479d75a0cb23d768e979bfa7837d67e5a0eefcd5137e26c6afdda0b81000180020002800) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf: type: CRYPTO_PAIRING_MESSAGE priority: 0 [cryptoPairingMessage] { pairingData: "\006\001\004\004@\\\276F\366\342\352\272\253\265\2404\010U\335\352\376\t\226\037\3715\261\260yR\263v\351\177\352\352(\'\222\352\000... status: 0 isRetrying: false isUsingSystemPairing: false state: 0 } 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.auth] Device (Proof=5cbe46f6e2eabaabb5a0340855ddeafe09961ff935b1b07952b376e97feaea282792ea00479d75a0cb23d768e979bfa7837d67e5a0eefcd5137e26c6afdda0b8) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.srp] Data (Encrypted=0f6e7d6264e6ed1d9e151cb5985a2455347aec7df57daf108bad79db887560a06f5bc3336cc3dafe11aaaa64dcf58a01da9e08aa5e5c8d62a816428251c9838a440e5a34c5ea8ab88fa744cab59df2a4a8a2277e671bac71c987366fe795063824d6a668c2aaf5a5297dbe1ec47d72e40718c0bf48bdcb8bb51aa66737bae3d7fa0e02930573983b54d1ffb718f58ea9e278da468365354b4ad6) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] >> Send (Data=08222000ba02aa010a9f01060105059a0f6e7d6264e6ed1d9e151cb5985a2455347aec7df57daf108bad79db887560a06f5bc3336cc3dafe11aaaa64dcf58a01da9e08aa5e5c8d62a816428251c9838a440e5a34c5ea8ab88fa744cab59df2a4a8a2277e671bac71c987366fe795063824d6a668c2aaf5a5297dbe1ec47d72e40718c0bf48bdcb8bb51aa66737bae3d7fa0e02930573983b54d1ffb718f58ea9e278da468365354b4ad61000180020002800) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] >> Send: Protobuf: type: CRYPTO_PAIRING_MESSAGE priority: 0 [cryptoPairingMessage] { pairingData: "\006\001\005\005\232\017n}bd\346\355\035\236\025\034\265\230Z$U4z\354}\365}\257\020\213\255y\333\210u`\240o[\3033l\303\332\376\021\... status: 0 isRetrying: false isUsingSystemPairing: false state: 0 } 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=b20108222000ba02aa010a9f01059aefa35fbaacbc43390d39400dc7250d3e0c1710f58fd4ecae26eb428f70ab45f606c821d9ec2cd34b011f4a931543a4408ebf4d35965d240d47b4da481981c026bf52d30faec15bad60645d79c2e6c29eb3c99f436b6dae3326f67c1aa599b06753b61323a90aba2091e153b70f46f55ca32bd069bd9a9e2bb56b11fe2e83ec5d043077bdf6a19a0e15fbc66c284f53d389fa50590a10ea0d45d70601061000180020002800) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf: type: CRYPTO_PAIRING_MESSAGE priority: 0 [cryptoPairingMessage] { pairingData: "\005\232\357\243_\272\254\274C9\r9@\r\307%\r>\014\027\020\365\217\324\354\256&\353B\217p\253E\366\006\310!\331\354,\323K\001\037J\2... status: 0 isRetrying: false isUsingSystemPairing: false state: 0 } 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.srp] PS-Msg06: {'1': b'1ca1fb77-a570-4fcd-b6ac-713a49b0f81b', '3': b'\x1f\x9dc\xb6\x03\xce\xf1)\xe7l\xfa\xa0\x94Zu\x14U%\x1f\xd3X9Q\x13\x90\xd8\xb7\x97\x0e\xc5\x9a\x91', '10': b"\x0e\x9a\x9f\xef\x13|=q\x10\xb9\xcfJ\x02'X\xea\x94\xe2\x1c\x8f\x82DX\xbfG\n\xc9@r\x9a\x1e\x92\xbel\xecD]<p1\x1dk\x9c\x03D{\xab\\G\xaa\x8f\x87\xff\tu\x05U\xbc\xdd\xa4\x82\xd0^\x08"} 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.srp] Device (Identifier=31636131666237372d613537302d346663642d623661632d373133613439623066383162, Public=1f9d63b603cef129e76cfaa0945a751455251fd35839511390d8b7970ec59a91, Signature=0e9a9fef137c3d7110b9cf4a022758ea94e21c8f824458bf470ac940729a1e92be6cec445d3c70311d6b9c03447bab5c47aa8f87ff09750555bcdda482d05e08) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.airplay.srp] Authentication keys (Private=79c85ac9a7b31267e5fd8a111cb00ec988ba25e1536a5b7bcb62f3aded1ab3de, Public=738596a5c5701fa256b0550efa1186baab29cddcd336351414a9cab3b9a7f3ae) 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.airplay.pairing] Starting AirPlay pairing with credentials AFB030D8B944D8AA:79C85AC9A7B31267E5FD8A111CB00EC988BA25E1536A5B7BCB62F3ADED1AB3DE 
2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.net] POST URL: http://192.168.178.113:7000/pair-pin-start 2020-02-13 16:19:37 DEBUG (MainThread) [pyatv.mrp.connection] Disconnected from device: None

I hope this is the correct log. :sweat_smile:

Looks ok :blush: I believe this behavior has been seen before. Open the AirPlay settings menu on your Apple TV and make sure airplay access setting is set to “Everyone on the same network”, then try again.

1 Like

That was it!!! Thanks so much. :relaxed: :relaxed:

Great! :smile: Do you remember the more “exact” phrasing of the error message you got? Would be got for future references, since this will likely happen again.

Yeah, it was just “canceled” but in German. And I could only click on “ok”.
I have a screenshot at home, if this helps. :slight_smile:

Yes, screenshot would be good :smile:

Its not more.

Ah, I see it now. I missed the “auth” translation string. I will have to add that. Thanks for providing feedback :blush: