georgezhao2010 / apple_airplayer

Make your AirPlay devices as TTS speakers
MIT License
130 stars 17 forks source link

Add new AirPlay device - Unknown error occurred #16

Open Cervenka opened 2 years ago

Cervenka commented 2 years ago

Hello, I just installed this add-on via HACS. I upgraded miniaudio as suggested.

However when trying to add the integration I get prompted if I want to auto-add devices. If I click no the integration does not show up. I click yes following error shows:

Add new AirPlay device - Unknown error occurred

Bildschirmfoto 2021-10-27 um 15 29 34

Is there a suggested fix for this? Thank you!

MarkusFelix commented 2 years ago

Just set up a new HassOS staging VM to test our some stuff, including this integration but do encounter the same error message while setting it up: Here is a log for a little more context than 'unknown error'

This error originated from a custom integration.

Logger: aiohttp.server
Source: custom_components/apple_airplayer/device_manager.py:39
Integration: Apple AirPlayer (documentation, issues)
First occurred: 4:50:39 PM (1 occurrences)
Last logged: 4:50:39 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 157, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 198, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 256, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/apple_airplayer/config_flow.py", line 24, in async_step_user
    if device.identifier not in self.hass.data[DOMAIN][DEVICES]:
  File "/config/custom_components/apple_airplayer/device_manager.py", line 39, in identifier
    return self._atv_conf.identifier.replace(":", "").lower()
AttributeError: 'NoneType' object has no attribute 'replace'
jusxon commented 2 years ago

I started getting this error after installing the "Apple TV beta" integration. Do you have this installed?

v-init-h commented 2 years ago

Same issue & more debug:

2022-01-19 19:03:11 DEBUG (MainThread) [pyatv.support.http] Received: b'HTTP/1.1 470 Connection Authorization Required\r\nContent-Length: 0\r\nServer: AirTunes/600.8.41\r\n\r\n'
2022-01-19 19:03:11 DEBUG (MainThread) [pyatv.support.http] Got HTTP response: HttpResponse(protocol='HTTP', version='1.1', code=470, message='Connection Authorization Required', headers={'content-length': '0', 'server': 'AirTunes/600.8.41'}, body=''):
2022-01-19 19:03:11 DEBUG (MainThread) [pyatv.protocols.airplay] Remote control authorization failed, missing credentials

My AppleTV is set to Same Network & no password