Apple TV error: Establishing a connection to

Yes, now I do :wink:

I recommend that you remove apple_tv_mrp from custom_components and any configuration you might have left for it. Install HACS, add my beta component repo to HACS and install the component that way. Configure it via Integrations and just wait for me to fix the remaining stuff. You can then just upgrade via HACS.

1 Like

Thanks @postlund . I am already using HACS but had left some residual apple_tv_mrp parameters in my configuration.yaml file :astonished: which have now been removed. Whilst I am no longer getting an error when making the media player service calls, I am still unable to wake or turn on the Apple TV via Home Assistant.

When I have a little more time I will do some more head-scratching on this!

None of the power management part (turn on/off, etc.) is implemented yet so don’t put too much time into testing that.

Ah… Thanks for that! I’ll try whenever I see you push an update to your custom component.

1 Like

Ill also do these steps… Hope soon we all can enjoy everything again as it was…
Status: Play, pauze, idle maybe thats most important?

and beside this all GREAT JOB already !!!

After add the integration I get this error:

2019-12-06 19:08:11 WARNING (Recorder) [homeassistant.components.recorder] Event is not JSON serializable: <Event platform_discovered[L]: service=load_platform.remote, platform=apple_tv, discovered=identifier=E176A8F0-E490-4C86-9CC3-9E54F67BD7C5, protocol=Protocol: MRP, Port: 49152, Credentials: 334115d5fa4062e00806d9f8de5ce275205d1657d6b175f29a70c938ca859751:39b594150bf6e4624b89254fad54da754311ea8e079a8a488d9e9a5e8db5688c:64323435346130392d316461352d343832632d396137362d633232323963353465383637:31313061616431392d616139662d343135342d393861622d353434623263386331346530, name=Woonkamer, credentials=2=334115d5fa4062e00806d9f8de5ce275205d1657d6b175f29a70c938ca859751:39b594150bf6e4624b89254fad54da754311ea8e079a8a488d9e9a5e8db5688c:64323435346130392d316461352d343832632d396137362d633232323963353465383637:31313061616431392d616139662d343135342d393861622d353434623263386331346530, 3=513F8E173E496E53:769DC9F76F64F8FCD607AE38D2D66B6ACB1F5481F4CEF98386C5EBA6FD32F06F>
2019-12-06 19:08:13 ERROR (SyncWorker_8) [homeassistant.util.json] Failed to serialize to JSON: /config/.storage/core.config_entries
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/util/json.py", line 58, in save_json
    json_data = json.dumps(data, sort_keys=True, indent=4, cls=encoder)
  File "/usr/local/lib/python3.7/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/lib/python3.7/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/usr/local/lib/python3.7/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/local/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/local/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/local/lib/python3.7/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/usr/local/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/local/lib/python3.7/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/local/lib/python3.7/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/usr/local/lib/python3.7/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type MrpService is not JSON serializable
2019-12-06 19:08:13 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.config_entries: Object of type MrpService is not JSON serializable
2019-12-06 19:08:16 WARNING (MainThread) [custom_components.apple_tv] Failed to find device with identifier E176A8F0-E490-4C86-9CC3-9E54F67BD7C5
2019-12-06 19:08:24 WARNING (MainThread) [custom_components.apple_tv] Failed to find device with identifier E176A8F0-E490-4C86-9CC3-9E54F67BD7C5

Ouch I see what happened here. It is a bug for sure. I will have to fix it and push an update.

1 Like

And a bug will fixed :slight_smile: one day there no bugs anymore :slightly_smiling_face:

Exactly :wink: I have pushed a fix now. Just upgrade, remove the integration and re-add. After that it should work.

DONE !!! :smiley: Hope you will add soon the “stop” option so entity will go in “idle” modus.
Then my scripts/scene will work again 100% … now entity stay in “pause” modus

Stop is actually implemented, but the state logic seems to be inconsistent in the protocols so you will never reach idle. I will look into that! MRP doesn’t have an idle state like DMAP does.

Hmmm… Yes when hit the stop button state stay at paused. Hope there will be a state option. :blush:

Is it normal that i miss the icon in front of the name

I took a look at it and it is a bug. I’m pushing an update now, I’ll have a release out soon.

Don’t know what you mean?

Fix for idle state is out!

Updated the tool but still when I stop the video status is “paused”

and with icon in mean this:

Missing icon :slight_smile: and when I’m home I’ll go test the idle option!!

After restart my HA I get this error:

2019-12-08 17:28:55 WARNING (MainThread) [custom_components.apple_tv] Failed to find device with identifier E176A8F0-E490-4C86-9CC3-9E54F67BD7C5

But it seems to work when HA is done with loading

idle is not working here. When stop a Netflix serie or movie it still stay on “paused”

Which version are you using? At the end of the day I would need some logs to see what is going on. But we can try to confirm version first.

Im using now: 4a627fe