Errors in log when HomePod loses wifi connection

Posted on
Tue Aug 01, 2023 5:24 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Errors in log when HomePod loses wifi connection

Howdy! I have an OG HomePod occasionally pops up errors when disconnecting/reconnecting to the network. Now this HomePod is running audioOS 17 beta so I fully understand this may be caused by this, but thought I should flag it up anyway in case it's relevant to you for future updates to the plugin (since public release is now probably just a few weeks away!)

Code: Select all
1 Aug 2023 at 12:12:29
   appleTV Plugin                  Connection to appleTV - Kitchen Diner - HomePod lost.
   appleTV Plugin                  Scanning for device using Multicast.

1 Aug 2023 at 12:12:46
   appleTV Plugin Error            (plugin.py: Function: connect_atv  line: 572):    Exception :  Message : Connect ATV Exception
   appleTV Plugin Error            Traceback:
  File "plugin.py", line 570, in connect_atv
    return (await pyatv.connect(config, loop), config.address)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/__init__.py", line 135, in connect
    await atv.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/core/facade.py", line 575, in connect
    if await setup_data.connect():
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/__init__.py", line 941, in _connect
    await protocol.start()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 142, in start
    self.device_info = await self.send_and_receive(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 261, in send_and_receive
    return await self._receive(identifier, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 273, in _receive
    async with async_timeout.timeout(timeout):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError

   appleTV Plugin Error            Error in plugin execution:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 274, in _receive
    await semaphore.acquire()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/locks.py", line 385, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "plugin.py", line 570, in connect_atv
    return (await pyatv.connect(config, loop), config.address)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/__init__.py", line 135, in connect
    await atv.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/core/facade.py", line 575, in connect
    if await setup_data.connect():
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/__init__.py", line 941, in _connect
    await protocol.start()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 142, in start
    self.device_info = await self.send_and_receive(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 261, in send_and_receive
    return await self._receive(identifier, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 273, in _receive
    async with async_timeout.timeout(timeout):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

   appleTV Plugin Error           
Exc_info: (<class 'asyncio.exceptions.TimeoutError'>, TimeoutError(), <traceback object at 0x10a376e40>)
Exc_Text: Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyatv/protocols/mrp/protocol.py", line 274, in _receive
    await semaphore.acquire()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/locks.py", line 385, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:


Then it just keeps repeating itself. Interestingly sometimes the error will continue after the HomePod has reconnected, sometimes not.

Computer says no.

Posted on
Wed Aug 02, 2023 1:53 am
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Errors in log when HomePod loses wifi connection

Hi

Thanks (?!)

Does it do it at startup of the plugin?

At a guess would be wondering whether OS17 deletes the MRP protocol, but that would cause same issue at Startup.

Startup logging (if can be bothered) might be useful as will show what protocols are supported (although that might need pyatv library logging enabled)

OS17 remains unsupported. OS16 broke a number of things which are only being fixed now (e.g play url), but hopefully given the libraries traffic and interest any broken aspects are fixed slightly quicker…

Regarding public release - everything’s public isn’t it? The latest version supporting all Airplay2 speakers I should release soon, just waiting for a library release so that more complicated pip isn’t needed.

Glenn


Sent from my iPad using Tapatalk

Posted on
Wed Aug 02, 2023 1:57 pm
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Doesn’t seem to have any problem at startup, just when the wifi connection for it drops (or perhaps it goes to sleep?)

Looking forward to the new version of the plugin, sounds like it’ll have some interesting additions!


Sent from my iPhone using Tapatalk Pro

Computer says no.

Posted on
Wed Aug 02, 2023 3:00 pm
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Errors in log when HomePod loses wifi connection

Possibly when changing IP address?

Have you set the Homepod to a fixed IP in router settings?

If not, when it changes IP - will lose connection and chase it around - like here, using multicast as can’t find it on the single unicast IP.

Possible that not everything is realised by the plugin hence the lock errors, or may be trying to quickly.

Glenn


Sent from my iPad using Tapatalk

Posted on
Thu Aug 03, 2023 6:24 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Yeah it has a fixed IP address.

It may well be an OS 17 thing. Guess we’ll have to see if anything changes with the future release/new plugin. It’s not really a massive issue, more just a heads up of a potential future problem!


Sent from my iPhone using Tapatalk Pro

Computer says no.

Posted on
Fri Aug 04, 2023 1:04 am
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Errors in log when HomePod loses wifi connection

Ok. Thanks for that - there is a lot of debug logging happening between that connection lost message and then that exception..

Would turn on file debug logging for moment - so can access if needed.

Try
1.1.6
https://github.com/Ghawken/appleTV-indigoPlugin

Press Green Code button and double click indigoplugin bundle.

Will need to upgrade pyatv to latest version - as per messaging, and unquarantine ffmpeg via the plugin messaging as well.

Adds support for play_url to OS16 - so can push mp4 files or m3u8 playlists to appleTV's
Adds support for Airplay2 playback of all Airplay2 compatible speakers/Including Sonos devices
+
I reworked the connection lost logic, avoiding needing to recreate task loop - hopefully resolves this issue above.

1.1.6 - update:
Discovered can restart homepod from Home app - mimicking the connection lost
Fine tuned the code - seems to work on my testing.
Not sure what will happen on OS17 however...

(If still happening copy from debug log the logging - so includes the in between debug logging details)

Thanks

Posted on
Fri Aug 04, 2023 4:43 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Hello there!

I've installed the 1.1.6 plugin, ran the quarantine command and made sure pyatv is up to date (both stable and developer branches) but the plugin is failing as soon as it starts with this error:

Code: Select all
   Starting plugin "appleTV Plugin 1.1.6" (pid 71696)
   appleTV Plugin Error            Error in plugin execution InitializeMain:

  File "plugin.py", line 162, in <module>
type: module 'pyatv.interface' has no attribute 'AudioListener'


Not sure what to try next.

Computer says no.

Posted on
Fri Aug 04, 2023 5:11 am
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Errors in log when HomePod loses wifi connection

Bugger, sorry to hear.

At a very quick, indisposed guess, pretty sure pyatv won’t be uptodate. Not sure what you mean stable and developer branches ?

You seem to running a old version of pyatv - possibly an issue with python3 installs or clashing installs. The new version of pyatv has an AudioListener - which errors here as lacking as you don’t

I’m running 1.1.6 version on 2 systems.

run
Code: Select all
pip3 install pyatv —upgrade


or try
Code: Select all
pip3.10 install pyatv —upgrade


(if your pip3 is pointing somewhere else)

or
Code: Select all
/Library/Frameworks/Python.framework/Versions/3.10/bin/pip3 install pyatv —upgrade


Glenn

Sent from my iPad using Tapatalk

Posted on
Fri Aug 04, 2023 9:09 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Aha! So it turns out that I did have the up to date pyatv installed, BUT I also had an older one.. for some reason the permissions on my setup were whack and it was installing to a user directory. A bit of fiddling and tearing my hair out (not that I have any) and boom.. seems to be working! Thank you for pointing me in the right direction!

I'll keep an eye out for any errors in the log for disconnects, etc.

Computer says no.

Posted on
Fri Aug 04, 2023 9:32 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Well so far so good. I even disconnected the HomePod to simulate it dropping out and that didn't cause any errors, so fingers crossed that's solved it.

One minor thing I've noticed that I think I saw you saying shouldn't happen with the new one.. the power on status for my Apple TVs still doesn't seem to sync correctly.. should that be working or is that something I've misunderstood?

Computer says no.

Posted on
Fri Aug 04, 2023 3:43 pm
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Errors in log when HomePod loses wifi connection

Good that you sorted out your borked python3 installs. Indigo only uses one python3 install - you must have multiple installs, causes these issues.

As you state, the power status reports apparently have improved, essentially using the Companion protocol and system Status if supported.

The issue for us is there is sleep in there as well -is sleep ON or OFF? For example.

Certainly I am noticing improvement, appleTV off, turn on and play, status correctly updated to on. Media information depends on the app - most of the local TV apple apps don’t fill these details in I find.
Does take a state change to update it - in that I don’t force an update on startup - although can look at that as option.

What are you seeing in particular?


Sent from my iPad using Tapatalk

Posted on
Sat Aug 05, 2023 6:24 pm
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Errors in log when HomePod loses wifi connection

Try 1.1.7

I had bundled together some power state reporting based on the current playing state - which wasn’t that robust for the non-appleTV devices (Homepods, airplay2 speakers)

Changed it a bit, relying on the powerstate push updating and also checking at startup.

Glenn


Sent from my iPad using Tapatalk

Posted on
Tue Aug 08, 2023 8:43 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

Sorry I was away for the weekend, and now I've been struck down with a rather annoying ear infection that's left me feeling horribly dizzy.

So I've updated to v1.2.0 but alas the power status still isn't showing accurately. It's not actually *that* important, it was just a potential nice to have! However if you think it could be an easy fix let me know if you need any logs or anything.

Computer says no.

Posted on
Tue Aug 08, 2023 7:15 pm
GlennNZ offline
User avatar
Posts: 1578
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: Errors in log when HomePod loses wifi connection

What are you seeing? And on what device?

Both my HomePods and appleTVs appear to be reporting power on / off appropriately


Sent from my iPhone using Tapatalk

Posted on
Wed Aug 09, 2023 5:26 am
durosity offline
User avatar
Posts: 4320
Joined: May 10, 2012
Location: Newcastle Upon Tyne, Ye Ol' England.

Re: Errors in log when HomePod loses wifi connection

So I’m currently looking at my Apple TV 4K 2nd and 3rd gen unit. Interestingly I’ve just noticed that the last updated stamp on the devices isn’t updating when I turn off the devices, regardless of it being directly from the Apple TBs themselves or from the plugin.

Also this may be unrelated, but the data they’re showing isn’t always updating. It’ll update if I start playing a video, but if I switch from say YouTube to Plex (without playing a video) it won’t update the current app field.

Out of curiosity I’ve installed tvOS 17 onto the 3rd gen unit and it’s working the exact same way, but the 2nd gen is still running on 16.6.

Is the last updated field supposed to change when the power state changes or when the plugin sends an on/off command? Is it possible I still have the wrong Pyatv version installed? Or rather it’s using the wrong one buried deep in the system somewhere?


Sent from my iPhone using Tapatalk Pro

Computer says no.

Who is online

Users browsing this forum: No registered users and 1 guest