Apple TV error: Establishing a connection to

Ok, that’s good! Can you enable debug logs like this ```yaml
logger:
default: info
logs:
pyatv: debug

And make sure you end up in the situation above (i.e. not reaching idle) and attach some logs?

When I’m home I will start debug this… Probably you have the log tomorrow (Dutch time) :slight_smile:

That will work fine :blush:

@postlund hey Pierre, just to be sure - for someone like me that does not yet want to play with dev versions of the integration. How is the flow for production to stable Home Assistant? I would expect that this has to be merged to the main branch and we need to wait for a Home Assistant update, right?

Yes, I need to create a PR to Home Assistant, update documentation (with a PR to the documentation repo), pass reviews and wait for next release. Since this will be a rather big update, I expect quite a lot of review comments. So my guess is that it’s at least a version or two delayed from the time I publish the PRs.

Since I haven’t finished tests for pyatv yet, I won’t be able to release a final version of 0.4.0 until I’m done with that. I also haven’t started tests for the component at all and I won’t get it accepted before that is done. So having this beast merged will not happen yet for some time.

1 Like

Ok thanks for the explanation! No worries about timing. Thx for the work.

1 Like

@postlund here debug dump when playing something on Netflix. Did a play, pauze, play, stop

2019-12-18 15:12:29 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "com.apple.avkit.1765.dc5594d9"
    metadata {
      title: "S18: E3 \"The Cissy\""
      duration: 1329.786
      artworkAvailable: true
      infoAvailable: true
      languageOptionsAvailable: true
      numberOfSections: 0
      artworkMIMEType: "image/jpeg"
      elapsedTime: 36.0
      isAlwaysLive: false
      playbackRate: 0.0
      contentIdentifier: "81058297"
      mediaType: Video
      nowPlayingInfoData: "bplist00\324\001\002\003\004\005\006\007\nX$versionY$archiverT$topX$objects\022\000\001\206\240_\020\017NSKeyedArchiver\321\010\tTroot\200\001\245\013\014\025\026\027U$null\323\r\016\017\020\022\024WNS.keysZNS.objectsV$class\241\021\200\002\241\023\200\003\200\004_\0200AVMediaRemoteManagerNowPlayingInfoHasDescription\020\001\322\030\031\032\033Z$classnameX$classes_\020\023NSMutableDictionary\243\032\034\035\\NSDictionaryXNSObject\000\010\000\021\000\032\000$\000)\0002\0007\000I\000L\000Q\000S\000Y\000_\000f\000n\000y\000\200\000\202\000\204\000\206\000\210\000\212\000\275\000\277\000\304\000\317\000\330\000\356\000\362\000\377\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\010"
      elapsedTimeTimestamp: 598371148.921029
      legacyUniqueIdentifier: -598371111
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
}

2019-12-18 15:12:29 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:42 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=7fdd724ca2a5265b1bf26f642f3d63539a6fc934550646c7e34b07dd31065ffde0529697845d48b71175fb11e991dabbb47f753f0f028af0d3e66e58f9beeb2f7b35bed87cd8ca44506d689a3513d0ba236c7152040016895cc3e996f166135443233bac19e4b6f1161f52438806b46f0494153117e07f25bee6f948a9f07963)
2019-12-18 15:12:42 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a6930014a5c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c6179657259aef422ad35d5c141)
2019-12-18 15:12:42 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Playing
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
  playbackStateTimestamp: 598371162.273092
}

2019-12-18 15:12:42 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:43 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=f104950848c93a5228117f2c007f850a5c6862160387198b1dc84ea67dfdf1ac1d2f19e88f12cfefc972ea5ea2d553ff8bac8ddf5209c89fcb364fd7a1dea91ac60d70cadb840d8b4ac0ee2294bbc9f720543b843e849c602c8fef036e1d5eee528883cae2e1b80d118dcd0b246b49bf45b976f7555059f5a5c484af2358a287c3bea989f7a9b0e4b447c9d69a00ee4fb5ec399846135bc317fb7c6a1e92f8a01a77ca414fca94263c97c5b88c4bb0395c70babac3b02cff18c08521e76b41c6f47fa6c183d29114cac79c550e4731eed9de60d027714f0ce9818b640f134c7d990030031d20d6cd6714f57efe59ce9ed4dd142d7548460c44063379458aadd879f8d44c0da78518f1b482e27f579f46c3276cee05c03ab5a04c805f036825d834b5b948dd7fbe9b8ac04278330c4fd36d7cf404d4ecf91f24bebce421bc0214a0faf6eb2f97abe11260466f2f99df3c67d9766bccf39e93ae28339d5c752785092e1413b73ed5921861f2c8a546499161217dbd9284b804a6dd3149ceba23d4ff4432d534e1ec474128e3d98ee75eee341a167189278f535dd9a1efe455c4133ae1201a341e98694789a6cc58f422121e6c48278ed1ba9efc4513367c098e8921d5960ef64b495141c823b3bac5405718850afb9249043639be48bdc7bc0e388da5159e35b43ea9d451c6a966a3912953b320cdef07770b91ebad0ac97c29628619dc79b363cad33fe367c1e8dbc674e663cb3f9ad067ce8c9590fa76c137bfd7e11f893e927ae65401cbb4696efab5d6570331613286fc3f24b71ca7bbcc3bd730f21ceba5b6c3b15e0a578626b6c285027b8852f10fba2e8d4a3349c97eb11861df402aede7cd82eaf4852ea7201180ee74)
2019-12-18 15:12:43 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e203d9040af8030a1d636f6d2e6170706c652e61766b69742e313736352e646335353934643912d6030a135331383a20453320225468652043697373792271a01a2fdd24c79440980101a80101b00101b80100fa010a696d6167652f6a7065679902a0d821360c441940a80200bd020000803fe2020838313035383239378004029a04e40262706c6973743030d4010203040506070a582476657273696f6e592461726368697665725424746f7058246f626a6563747312000186a05f100f4e534b657965644172636869766572d1080954726f6f748001a50b0c15161755246e756c6cd30d0e0f101214574e532e6b6579735a4e532e6f626a656374735624636c617373a1118002a113800380045f103041564d6564696152656d6f74654d616e616765724e6f77506c6179696e67496e666f4861734465736372697074696f6e1001d218191a1b5a24636c6173736e616d655824636c61737365735f10134e534d757461626c6544696374696f6e617279a31a1c1d5c4e5344696374696f6e617279584e534f626a65637400080011001a00240029003200370049004c005100530059005f0066006e007900800082008400860088008a00bd00bf00c400cf00d800ee00f200ff0000000000000201000000000000001e00000000000000000000000000000108d104e0d57ead35d5c1419805d9a9d6e2fdffffffff01125c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c61796572)
2019-12-18 15:12:43 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "com.apple.avkit.1765.dc5594d9"
    metadata {
      title: "S18: E3 \"The Cissy\""
      duration: 1329.786
      artworkAvailable: true
      infoAvailable: true
      languageOptionsAvailable: true
      numberOfSections: 0
      artworkMIMEType: "image/jpeg"
      elapsedTime: 6.316452833
      isAlwaysLive: false
      playbackRate: 1.0
      contentIdentifier: "81058297"
      mediaType: Video
      nowPlayingInfoData: "bplist00\324\001\002\003\004\005\006\007\nX$versionY$archiverT$topX$objects\022\000\001\206\240_\020\017NSKeyedArchiver\321\010\tTroot\200\001\245\013\014\025\026\027U$null\323\r\016\017\020\022\024WNS.keysZNS.objectsV$class\241\021\200\002\241\023\200\003\200\004_\0200AVMediaRemoteManagerNowPlayingInfoHasDescription\020\001\322\030\031\032\033Z$classnameX$classes_\020\023NSMutableDictionary\243\032\034\035\\NSDictionaryXNSObject\000\010\000\021\000\032\000$\000)\0002\0007\000I\000L\000Q\000S\000Y\000_\000f\000n\000y\000\200\000\202\000\204\000\206\000\210\000\212\000\275\000\277\000\304\000\317\000\330\000\356\000\362\000\377\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\010"
      elapsedTimeTimestamp: 598371162.990902
      legacyUniqueIdentifier: -598371111
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
}

2019-12-18 15:12:43 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=7f96b074d2be6905eb7047e81f55d54e43d1456d3a852d2239c903777c908944d7b8438b0a55acf7ceae58da2cf0d827a6acc723e2f0f96b6802c995e5ef09d9435b12b20caf25a2b966205bdce8a19de8d548b0971fe0fd3b5c391c8f8ed9894368ff582a66b8d8c4431634c2668b097d4236cd64869af211aa89d262637f9c)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a6930024a5c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c61796572592fdd00b235d5c141)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Paused
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
  playbackStateTimestamp: 598371172.00675
}

2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=f104b4a36713fa303b13336cb3e25dbd35c95058dd79230deaf610c5aae07b9dc575232c3ec2a0530afa5bcc411d399db37dd0d3191cfd336c156d4662d5adb23a508608f278d9274e2d84fac2f964e3141c23c13333c39351c7b5dbfd839ca7445b1fa21cf0d747a14adb942b7fd277faef5b2477db18b810ded3bc7f0ee32e832275992d7261378d7fe05a5dbc71daf976bef3d9b188656154c1b50547c70c51a4b266d062b8fe6235ecf2df7fc3a2c7d9d6c6a757a85e68b77a8b84518cc5008c70b373e4c4b464e19dc8acaff2a0a1d859bc2813e92f459fa176f70f5aa844580cbf011851c8e8383ce2d54cf21681e7838d3ed039197803b3c30e80571998e706974c928aa33b14efd1e0ec531bf390e877f7c086beb24655e9544459d4cf9b5b294724f20f01b60083a796bf2b6eb3caeb81be0d7f2893f7854cfaf6b0618a50b6a1956857d8ec7d47955b94bf4a4b30b4d084bef7ecf2a0039f6879885debfb459fd88104cc4c7cc4b5485ff63b5da62a3517c914b1d7d8fa7ffab646b63c55a5c52b7414950f521254e74f2d905d0b49ba812cab7df290baa7abaeb84d027956b49c229489608a41b146184e05ba3f99ce05c4bd67ec88f1e96a0ac32babaacd32f1314701764cd04e793f37fd6f116f8ac15b2cbdc8fa81d06ec3781fd6a05c795bd30d42644d0156fb69a8e791b5128045c06938c10b042349d5b0f6bb47f599ca125634c79005bcd9ff70b08ccef8947bee14854c61158150dd36a78751c22f435afdf16966844611c7b0f682ac7485c1c7b897593074d165b621d22634d144e0a812b1096d9093194cca9b0f76438a2105af06288990f3b9193661962da95146d9626d0d8281cf1f15a34528fe)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e203d9040af8030a1d636f6d2e6170706c652e61766b69742e313736352e646335353934643912d6030a135331383a20453320225468652043697373792271a01a2fdd24c79440980101a80101b00101b80100fa010a696d6167652f6a70656799027f4705ec2e212e40a80200bd0200000000e2020838313035383239378004029a04e40262706c6973743030d4010203040506070a582476657273696f6e592461726368697665725424746f7058246f626a6563747312000186a05f100f4e534b657965644172636869766572d1080954726f6f748001a50b0c15161755246e756c6cd30d0e0f101214574e532e6b6579735a4e532e6f626a656374735624636c617373a1118002a113800380045f103041564d6564696152656d6f74654d616e616765724e6f77506c6179696e67496e666f4861734465736372697074696f6e1001d218191a1b5a24636c6173736e616d655824636c61737365735f10134e534d757461626c6544696374696f6e617279a31a1c1d5c4e5344696374696f6e617279584e534f626a65637400080011001a00240029003200370049004c005100530059005f0066006e007900800082008400860088008a00bd00bf00c400cf00d800ee00f200ff0000000000000201000000000000001e00000000000000000000000000000108d104b5331eb235d5c1419805d9a9d6e2fdffffffff01125c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c61796572)
2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "com.apple.avkit.1765.dc5594d9"
    metadata {
      title: "S18: E3 \"The Cissy\""
      duration: 1329.786
      artworkAvailable: true
      infoAvailable: true
      languageOptionsAvailable: true
      numberOfSections: 0
      artworkMIMEType: "image/jpeg"
      elapsedTime: 15.06481111111111
      isAlwaysLive: false
      playbackRate: 0.0
      contentIdentifier: "81058297"
      mediaType: Video
      nowPlayingInfoData: "bplist00\324\001\002\003\004\005\006\007\nX$versionY$archiverT$topX$objects\022\000\001\206\240_\020\017NSKeyedArchiver\321\010\tTroot\200\001\245\013\014\025\026\027U$null\323\r\016\017\020\022\024WNS.keysZNS.objectsV$class\241\021\200\002\241\023\200\003\200\004_\0200AVMediaRemoteManagerNowPlayingInfoHasDescription\020\001\322\030\031\032\033Z$classnameX$classes_\020\023NSMutableDictionary\243\032\034\035\\NSDictionaryXNSObject\000\010\000\021\000\032\000$\000)\0002\0007\000I\000L\000Q\000S\000Y\000_\000f\000n\000y\000\200\000\202\000\204\000\206\000\210\000\212\000\275\000\277\000\304\000\317\000\330\000\356\000\362\000\377\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\010"
      elapsedTimeTimestamp: 598371172.235953
      legacyUniqueIdentifier: -598371111
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
}

2019-12-18 15:12:52 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=7fe98c645cfa0bc5ac9ea7b50e77aa686e511f06842a6a1e9fc327399c70b1dcf76ab3a8f4b4c9ab9aeba0998671a78ed6c68297828fb20eb616fa6e80505e61fb0d77114741ec81f9ec837d855e5fcc03e3146101d356bf9887bb0f4137d97e3cc814f8a9d4c0580e606f37ae88f223fc276fc5f67e45fb252911010ffe8e29)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a6930014a5c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c6179657259afd02bb435d5c141)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Playing
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
  playbackStateTimestamp: 598371176.342306
}

2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=f104191e6401d5cff27a4c6fff5abe7628eeb6b5e93d57561c1bce974fb6e8c80e3b6f13ed9488260383c59cb33223cf9fec6dbde41b0e9c7d668f0b05a9d2717db2f8738260ed6e3c1d66f70020986ae37136c517763784b653fd584fd0dbdc8eb9a74b56aa2a1f411b0ea083e26d528584b3f2813b70f82ec820bdd256859248c195f48a963be90c9543d41720d04254571ba3bae0e38ec9676ce7ea4b95e9ee9cd0d3dd99a5aa5d60d17befe94f804f09d30c7741b512805455f8c716d0732bdf795a920f22f8cfc3974b8f5e0c289f3b9f0719318243ef82f58d222a083503db70f37aaf1ff87530246369690c348dc62d838475d738da5a1cc1aede913aa0db7f8389d2d381b65e4d127ff92d3545d256a217cd0e892319e4a2424f55d271892cd453414756ecf6ac3efd3316afcf498045f9b43d4f13328b47b78bcc1a7e5284904716e271ae65913e8e6aedeccdf1fd6d8b31ae3cdf236f93c560dbbd030cbe44abc638a512cb1e3d0c3bfaa6307dc5a0a8dd80445820c670457ab6c6e541c2d051d29850646eab03961d65e3a4aeb6b5eaeaf64a8ee368b53146177b7f79c411fdc4611777c0a972c10eaf67a90af512fe4f31f49550fc84f00adcac9452f2c885283edb84a5692c4b7e15a6ced9cbaccc61b6e83ea52a84dbfae3e2fb769a20bc3560193329b7de25ee0e8f9500e730798a40298a64bb6ec147a9ce3ad736ada36ea6539757ec275619f29356f19f5d180bc26fa2124f6a711dc87deeb41f8dd4c920fc5c861a38f0e07c115cccf6acd9c794c2bc958cca4de63e2886a0914b00d6e92928aaefaa4fc9912efa10cc22fb946b7df7969045652a42141bfa7ef5b0f291214df213dbdde9f28c009db8)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e203d9040af8030a1d636f6d2e6170706c652e61766b69742e313736352e646335353934643912d6030a135331383a20453320225468652043697373792271a01a2fdd24c79440980101a80101b00101b80100fa010a696d6167652f6a7065679902113dafcce9262f40a80200bd020000803fe2020838313035383239378004029a04e40262706c6973743030d4010203040506070a582476657273696f6e592461726368697665725424746f7058246f626a6563747312000186a05f100f4e534b657965644172636869766572d1080954726f6f748001a50b0c15161755246e756c6cd30d0e0f101214574e532e6b6579735a4e532e6f626a656374735624636c617373a1118002a113800380045f103041564d6564696152656d6f74654d616e616765724e6f77506c6179696e67496e666f4861734465736372697074696f6e1001d218191a1b5a24636c6173736e616d655824636c61737365735f10134e534d757461626c6544696374696f6e617279a31a1c1d5c4e5344696374696f6e617279584e534f626a65637400080011001a00240029003200370049004c005100530059005f0066006e007900800082008400860088008a00bd00bf00c400cf00d800ee00f200ff0000000000000201000000000000001e00000000000000000000000000000108d104c7d86db435d5c1419805d9a9d6e2fdffffffff01125c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c61796572)
2019-12-18 15:12:56 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "com.apple.avkit.1765.dc5594d9"
    metadata {
      title: "S18: E3 \"The Cissy\""
      duration: 1329.786
      artworkAvailable: true
      infoAvailable: true
      languageOptionsAvailable: true
      numberOfSections: 0
      artworkMIMEType: "image/jpeg"
      elapsedTime: 15.576002499
      isAlwaysLive: false
      playbackRate: 1.0
      contentIdentifier: "81058297"
      mediaType: Video
      nowPlayingInfoData: "bplist00\324\001\002\003\004\005\006\007\nX$versionY$archiverT$topX$objects\022\000\001\206\240_\020\017NSKeyedArchiver\321\010\tTroot\200\001\245\013\014\025\026\027U$null\323\r\016\017\020\022\024WNS.keysZNS.objectsV$class\241\021\200\002\241\023\200\003\200\004_\0200AVMediaRemoteManagerNowPlayingInfoHasDescription\020\001\322\030\031\032\033Z$classnameX$classes_\020\023NSMutableDictionary\243\032\034\035\\NSDictionaryXNSObject\000\010\000\021\000\032\000$\000)\0002\0007\000I\000L\000Q\000S\000Y\000_\000f\000n\000y\000\200\000\202\000\204\000\206\000\210\000\212\000\275\000\277\000\304\000\317\000\330\000\356\000\362\000\377\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\010"
      elapsedTimeTimestamp: 598371176.858178
      legacyUniqueIdentifier: -598371111
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
}

2019-12-18 15:12:57 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=7fa2e7b3020bd9635c0c1b6591625b363bebc67f23226067ae0d37f2f5f23c2f6ef36b40d761485991fd33b5db869b2e4feb6ff5e92a442a41559033235293d8bd2355742f674dd310a80df6efdc9e03a9192153aa5b7240973ed533eda7c9daef7c5517bde569793827c95d081ba306d1d9b44c97061e1c6c1ea163cbe2d404)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a6930024a5c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c6179657259d2719db835d5c141)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Paused
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
  playbackStateTimestamp: 598371185.230036
}

2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=f10498c41b85d0375953e6920a80c7cfa639bbae8f23eff4ea7d6fd8fe09b51a77af5c8d10d52c971567c5ec1db608270e8009f01392c307cbbe04714b3d8110ae87b217a6bde9b903d0bbd742f8184b5d8a6576c1d2a3d7d93558fa441efdb27880791c28e67e2565948004851d1d2c6c70f8d98a3dfc7d792371f6b4c1bfa4f69835cc99213395c6212d2e3c4d6406e06c71d6ab526852ea83593d0f37d9a7390bd03d274ae0d2f41db33b7c82aafa39aeb9e24d3a423130e0e09fe0829a5464ade681df0320dde4746056578cc6a35b1333a20a45e40f6f6da52300437cbfb593fba815e08e4da7ad6267a21a5c58bf181c407cee54e85db2fca823a2ec3a3f35c7e9e367ddf6afd9d42ae83751f46fdeb22feea22334b9c4b0280566082d51025bb376d092dda969e517671dad5de8dcf1af45323ad65e02b85c703e03916b57acfeb85fabbad2b4e60e6309cd2fc61245608648972064c9aded604b0047cd3c8b9e120634b6e037aed6d93290133eb4bd0b670752701e66bc805403284a1605658b2f4fbf1582092023db2bf6618c3e4889226b339db74089901928fc13416976e8da57d4e883c466e9fe69356d33ae9a01523b932789b42e692d8c16324ea048843cc7f9d136aff72d45624b263776f74da25b8d947ba341506ed3c95e10279d679a4dec2e9f3e3625d4bd55a8a653f788dfd41545817cef6260e0e56846573be1a07f934412851182181aceaf29e938fdf5459e794bfc36256dfff28b0e6b4415826709c8c65293369310713d7a706ffa20bab9099f2ea13c6fec1fb1a3b76090ed28649d0b74619accedf3e62668a971c1b9ba8c28c96be1931426a09ca3aaa8f3862832916830ce4f44d1b7f2ff92)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e203d9040af8030a1d636f6d2e6170706c652e61766b69742e313736352e646335353934643912d6030a135331383a20453320225468652043697373792271a01a2fdd24c79440980101a80101b00101b80100fa010a696d6167652f6a70656799026ae0e5ad6bb23740a80200bd0200000000e2020838313035383239378004029a04e40262706c6973743030d4010203040506070a582476657273696f6e592461726368697665725424746f7058246f626a6563747312000186a05f100f4e534b657965644172636869766572d1080954726f6f748001a50b0c15161755246e756c6cd30d0e0f101214574e532e6b6579735a4e532e6f626a656374735624636c617373a1118002a113800380045f103041564d6564696152656d6f74654d616e616765724e6f77506c6179696e67496e666f4861734465736372697074696f6e1001d218191a1b5a24636c6173736e616d655824636c61737365735f10134e534d757461626c6544696374696f6e617279a31a1c1d5c4e5344696374696f6e617279584e534f626a65637400080011001a00240029003200370049004c005100530059005f0066006e007900800082008400860088008a00bd00bf00c400cf00d800ee00f200ff0000000000000201000000000000001e00000000000000000000000000000108d1044bc9bab835d5c1419805d9a9d6e2fdffffffff01125c0a1308011209576f6f6e6b616d657218cc86bde204121808e50d1213636f6d2e6e6574666c69782e4e6574666c69781a2b0a194d6564696152656d6f74652d44656661756c74506c61796572120e44656661756c7420506c61796572)
2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "com.apple.avkit.1765.dc5594d9"
    metadata {
      title: "S18: E3 \"The Cissy\""
      duration: 1329.786
      artworkAvailable: true
      infoAvailable: true
      languageOptionsAvailable: true
      numberOfSections: 0
      artworkMIMEType: "image/jpeg"
      elapsedTime: 23.696955555555554
      isAlwaysLive: false
      playbackRate: 0.0
      contentIdentifier: "81058297"
      mediaType: Video
      nowPlayingInfoData: "bplist00\324\001\002\003\004\005\006\007\nX$versionY$archiverT$topX$objects\022\000\001\206\240_\020\017NSKeyedArchiver\321\010\tTroot\200\001\245\013\014\025\026\027U$null\323\r\016\017\020\022\024WNS.keysZNS.objectsV$class\241\021\200\002\241\023\200\003\200\004_\0200AVMediaRemoteManagerNowPlayingInfoHasDescription\020\001\322\030\031\032\033Z$classnameX$classes_\020\023NSMutableDictionary\243\032\034\035\\NSDictionaryXNSObject\000\010\000\021\000\032\000$\000)\0002\0007\000I\000L\000Q\000S\000Y\000_\000f\000n\000y\000\200\000\202\000\204\000\206\000\210\000\212\000\275\000\277\000\304\000\317\000\330\000\356\000\362\000\377\000\000\000\000\000\000\002\001\000\000\000\000\000\000\000\036\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001\010"
      elapsedTimeTimestamp: 598371185.459268
      legacyUniqueIdentifier: -598371111
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 1765
      bundleIdentifier: "com.netflix.Netflix"
    }
    player {
      identifier: "MediaRemote-DefaultPlayer"
      displayName: "Default Player"
    }
  }
}

2019-12-18 15:13:05 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x68cbe750>>, data=None)

Hope you can find out why it not show “idle” after I pressed stop

Based on this output, Netflix seems to report Paused even for “stop” (which I interpret as the media player is still active in the background, so you don’t see it). When you press a button, e.g. play, it sends a SetStateMessage with playbackState=Playing and an UpdateContentItemMessage with additional metadata (title, duration, etc.). Corresponding is done for pause. Did you by any chance see a SetNowPlayingClient message after stopping? I’m not sure how complete this log is.

No I didn’t see the SetNowPlayingClient after stop. I interpret the log and saw also the SetNowPlayingClient after Playing and Paused but not when hit Stop button

(Im using Harmony Hub for all my devices) that must not be the problem.

Also with a dutch app “Videoland” I have same. Seems that it will only work with Apple own apps the IDLE status?

EDIT:

When I play music from my library (Apple Music) and hit the stop button it also goes into paused status and not IDLE

2019-12-18 16:06:47 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x6c8bb730>>, data=None)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=5908a4408104ce96186f802e1339292dc6495456db93806aa6b78068a92bd89e3d222156430f9094812dc3642903543c913156ecc24833ba12cee54ab01dd873894168e62aa3f932555e303a98cb673118a9883d5d3925e8ac4f)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a4330014a360a1308011209576f6f6e6b616d657218cc86bde204121608ae011211636f6d2e6170706c652e54564d757369631a070a054d75736963592ac54e053cd5c141)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Playing
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 174
      bundleIdentifier: "com.apple.TVMusic"
    }
    player {
      identifier: "Music"
    }
  }
  playbackStateTimestamp: 598374410.615392
}

2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x6c8bb730>>, data=None)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=9f01b6e1c273d1d7abeba1f369df829e9cb8aaf73e873798407607fa3ac17b5b7f82b9701ecd21458ca90574bbcd977820dcd8feacd7b02b84b59270c2c1430c33e3ade3a5d789e4765908c7af76d6c1464b8780e194e73206e70da1e1efbb72ea5aa75f2488eaa6495fbba31c356f3b9f4f21414c9afc5e71e448d571062969c6d2b67a8c876376b9cea640a1f0645e042bd9ccfebe1c6599b0f063fba4f5f98f)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e20387010a4d0a2f504c756d476471545338532b41456b71476d42706967e28886374b3163677a662b53752b6f33725675714d5a4c3267121a9902e6ee1052791c4440bd020000803fd1043c305a053cd5c14112360a1308011209576f6f6e6b616d657218cc86bde204121608ae011211636f6d2e6170706c652e54564d757369631a070a054d75736963)
2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "PLumGdqTS8S+AEkqGmBpig\342\210\2067K1cgzf+Su+o3rVuqMZL2g"
    metadata {
      elapsedTime: 40.22245241
      playbackRate: 1.0
      elapsedTimeTimestamp: 598374410.704597
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 174
      bundleIdentifier: "com.apple.TVMusic"
    }
    player {
      identifier: "Music"
    }
  }
}

2019-12-18 16:06:50 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x6c8bb730>>, data=None)
2019-12-18 16:06:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=59190da464cb69faf6134b25ba12bb3fe0627e73385ff5eb913949ac01dbc21c7f0ba40efa270fa585d613c398a6b68d952a9ba437612555f438689e0acb8c50456c8d3e2027d91b16357c139b5d00f12f86e48c36b65fa1b949)
2019-12-18 16:06:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=080420004a4330024a360a1308011209576f6f6e6b616d657218cc86bde204121608ae011211636f6d2e6170706c652e54564d757369631a070a054d7573696359418272063cd5c141)
2019-12-18 16:06:52 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: SET_STATE_MESSAGE
priority: 0
[setStateMessage] {
  playbackState: Paused
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 174
      bundleIdentifier: "com.apple.TVMusic"
    }
    player {
      identifier: "Music"
    }
  }
  playbackStateTimestamp: 598374412.8946
}

2019-12-18 16:06:52 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 4 (SetStateMessage) to Listener(func=<bound method PlayerStateManager._handle_set_state of <pyatv.mrp.player_state.PlayerStateManager object at 0x6c8bb730>>, data=None)
2019-12-18 16:06:53 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Data=9f01ec49f5d056f8e088f5f97001fee010d7dec7b92d34adb1ff4a076bae6a82ae2caf6b4e7ad5b19ef9237bb2e005fe34a74083424400c84dd2321ddd8ce1fd6801174a7ba91f9ea87288e6529155eaa174d35c0bafed871684b1cd82ca8c0b0f8a13b15effe363e34c91bbaeac9742ad384a91c24798e7caf03d748564f98e0f43392780d5f83e3235d96f33633fdd9f9ba72c509fe8f4212a32f825d94858ba)
2019-12-18 16:06:53 DEBUG (MainThread) [pyatv.mrp.connection] << Receive (Decrypted=08382000e20387010a4d0a2f504c756d476471545338532b41456b71476d42706967e28886374b3163677a662b53752b6f33725675714d5a4c3267121a9902840cd5ae38354540bd0200000000d104047079063cd5c14112360a1308011209576f6f6e6b616d657218cc86bde204121608ae011211636f6d2e6170706c652e54564d757369631a070a054d75736963)
2019-12-18 16:06:53 DEBUG (MainThread) [pyatv.mrp.connection] << Receive: Protobuf=type: UPDATE_CONTENT_ITEM_MESSAGE
priority: 0
[updateContentItemMessage] {
  contentItems {
    identifier: "PLumGdqTS8S+AEkqGmBpig\342\210\2067K1cgzf+Su+o3rVuqMZL2g"
    metadata {
      elapsedTime: 42.415792326
      playbackRate: 0.0
      elapsedTimeTimestamp: 598374412.948731
    }
  }
  playerPath {
    origin {
      type: 1
      displayName: "Woonkamer"
      identifier: 1280262988
    }
    client {
      processIdentifier: 174
      bundleIdentifier: "com.apple.TVMusic"
    }
    player {
      identifier: "Music"
    }
  }
}

2019-12-18 16:06:53 DEBUG (MainThread) [pyatv.mrp.protocol] Dispatching message with type 56 (UpdateContentItemMessage) to Listener(func=<bound method PlayerStateManager._handle_content_item_update of <pyatv.mrp.player_state.PlayerStateManager object at 0x6c8bb730>>, data=None)

I tried it out for myself just to be able to fiddle with it and indeed, “stop” works exactly like pause. So I guess it’s not supposed to be used that way. Using “menu” to go back kills the player, making SetNowPlayingClient reset what is currently playing. That can be considered a workaround but it’s not how I would like it to work.

Another interesting thing I noted was that the main player is used for the previews in main menu. So when a video preview is playing, that will signal that a video is playing. Netflix, however, does not update metadata for this so what was previously watched in the Netflix app will be seen in the metadata. This was verified with the Remote app in iOS with the exact same behavior. Clearly a bug IMHO.

Correct. The previews in Netflix have status playing also. Its not a happy thing because my scenes are react all the time on this. Play, select other serie/movie then paused status and play again for the preview.

My house is 1 big disco then… now I have a delay when playing is on for 10sec then dim the lights. But if you can correct this because its a bug then maybe you can solve this :smiley: !!

I will do some tests with the menu button instead of the stop button and see if this will help. I will come back on that

//Keep up the good work, im happy with all the work you do!

I can reproduce the way how it work. Menu break the paused status to idle.
It make sense because the original remote of AppleTV doesn’t have a stop button but only play/pause, screen, mic and menu.

The Menu is always used to stop what you watching or listening. I have changed in my harmony hub for AppleTV the button stop also to menu. Now when stop the serie/movie I see idle status for the entity device in HA.

I don’t think there is something wrong in your code…

Hope you can do something about the preview things of Netflix etc… thats not playing but only showing something.

Yeah, it’s a bit annoying. I’m not sure how the API works in tvOS for this, but I hope that it can be improved. I have made a bug report to Netflix (including a link to this discussion), so I hope they will fix it in a future update. It was not possible to get any reference ticket for it though, so I am unable to see or follow any progress, which is a shame :frowning: We can only just wait for app updates and verify ourselves to see if it works.

Regarding menu button… That should work in most cases, as long as it’s video. But I would assume it can cause problems with audio as audio can be played in the background, so pressing menu doesn’t make sense in that context as you can be in an app somewhere doing whatever. So I cannot change that to default behavior. As far as I can tell, I’m using the correct API but stop might not be applicable in this case. As you say, there is not pure “stop” button so it might not be implemented to work that way.

I had a chat, they say everything is ok in there App. I told them that a preview of a serie/movie in background is not actual something that is play. So would me nice to see a status like “Preview” instead of “playing” but they still hold to their “Big company Attitude” Everything is good about their app.
That we will take as a feedback and the designated team will try to work on this.

That was not the same answer I got. The person I spoke to looped in one of their backend teams that confirmed the issue (from what I understood, they were not really in the chat only relayed). It’s minor issue for the normal user, so it will probably not be high priority but you never know. Netflix has pretty high standards when it comes to usability and consistency. So I wouldn’t be surprised if they fixed it, not sure about time frame though,

1 Like

I just installed the beta version, and it works as supposed to. I was just wondering about the content type. Is it possible to have it report something other than ‘music’?

Usecase: I often have YouTube on in the background, and I want to have my lights on. But I only watch a movie on Plex or Netflix with the lights off. It’d be great to automate this.

And one last question. Is it possible to check if it is powered on or off?

It will report other types (video and music at least), providing the app supplies correct metadata. If it is shown as music instead of video, it is likely an issue with the app.

https://github.com/postlund/pyatv/blob/6018ba22851287afaf7c99dafa42de5766b97acf/pyatv/mrp/init.py#L169

Ok. I just tested with Plex and YouTube, and it reported music on both. Have you had different experiences?

I haven’t tried that much, but I have seen the same behavior with emby as well. TV4Play seems to report video correctly though.

@postlund Do you know if Netflix and/or Apple send the categorie also ? Like is the stream a Movie, Show, Documentary etc? If so, will there be a possibility that you can implement this as a sensor?

We watching movies here with light dimmed, we watch series mostly with more lights and documentary with full lights on. If there is a sensor I can automate this, so for every type his own light scene.