pychromecast icon indicating copy to clipboard operation
pychromecast copied to clipboard

Apowersoft and pychromecast zeroconf error\bug

Open ganlbarone opened this issue 5 years ago • 1 comments

I started receiving the below error during chrome cast discovery and I thought it was strange. So I edited discovery py to see what device was throwing this. And I find that it was a powersoft which is mirroring software I use to display my mobile phone.

Strunker c57f10c75ee90c302bc91438ca69ff3a Strunker Kitchen abbc50114a30af27c6f6b889836eed39 Strunker SoundBar 57b3b87b2545db3cb30da28690b86ec6 Strunker SoundBar LR 657df820f9ab9c49759ae835bc57f389 Apowersoft[] B46BFC5EA092

Obviously Apowersoft has a bad uuid because it isnt a chromecast device its just an app running on my machine.

I implemented the below fix locally. The uuids look mostly uniform in length, so I guess a length check on the id would also work. This works for me so figured I would post\share. Thanks.

    if uuid:
        if "Apowersoft" in friendly_name:
            #Immediate return as we do not want to build an object here.
            return
        else:
            uuid = UUID(uuid)


Exception in thread zeroconf-ServiceBrowser__googlecast._tcp.local.:
Traceback (most recent call last):
  File "C:\Python37\lib\threading.py", line 917, in _bootstrap_inner
    self.run()
  File "C:\Python37\lib\site-packages\zeroconf.py", line 1382, in run
    handler(self.zc)
  File "C:\Python37\lib\site-packages\zeroconf.py", line 1329, in <lambda>
    state_change=state_change,
  File "C:\Python37\lib\site-packages\zeroconf.py", line 1235, in fire
    h(**kwargs)
  File "C:\Python37\lib\site-packages\zeroconf.py", line 1302, in on_change
    listener.add_service(*args)
  File "C:\Python37\lib\site-packages\pychromecast\discovery.py", line 79, in add_service
    uuid = UUID(uuid)
  File "C:\Python37\lib\uuid.py", line 160, in __init__
    raise ValueError('badly formed hexadecimal UUID string')
ValueError: badly formed hexadecimal UUID string

ganlbarone avatar Apr 26 '19 12:04 ganlbarone