realthk / asyncpioneer

Async Pioneer AVR for Home Assitant
27 stars 24 forks source link

Configuration Validation #14

Closed BIoob closed 4 years ago

BIoob commented 4 years ago

When I add the code to my configuration.yaml my configuration validation fails. This is what im using in my yaml to test if it works:

media_player:
- platform: asyncpioneer
  host: 192.168.0.115
  port: 8102

I added both .py files to /custom_components/asyncpioneer/ (in /homeassistant/ which is my /config folder).

Im new to this and a bit confused what I am doing wrong.

Should "asyncpioneer" show up as a media player entity like it does when I use the Pioneer plugin? Cause it doesn't.

Any help is appreciated.

G-Two commented 4 years ago

@BIoob that config should work, and it should show up as a media_player entity. What is the error message you receive when configuration validation fails?

If your logger level is set to at least warning, you should be receiving this message in your log to show that the custom integration was loaded: 2020-06-28 19:13:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for asyncpioneer which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Maybe the JSON files are needed as well? Try putting all the contents of the repo in custom_components/asyncpioneer

BIoob commented 4 years ago

Thanks for the reply, I have put in the JSON files as well now, when running the validation this shows up in the log file:

Logger: aiohttp.server
Source: loader.py:387
First occurred: 9:01:51 PM (1 occurrences)
Last logged: 9:01:51 PM

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/core.py", line 29, in post
    errors = await async_check_ha_config_file(request.app["hass"])
  File "/usr/src/homeassistant/homeassistant/config.py", line 833, in async_check_ha_config_file
    res = await check_config.async_check_ha_config_file(hass)
  File "/usr/src/homeassistant/homeassistant/helpers/check_config.py", line 162, in async_check_ha_config_file
    hass, p_name
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 50, in async_get_integration_with_requirements
    integration = await async_get_integration(hass, domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 327, in async_get_integration
    integration = Integration.resolve_legacy(hass, domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 183, in resolve_legacy
    comp = _load_file(hass, domain, _lookup_path(hass))
  File "/usr/src/homeassistant/homeassistant/loader.py", line 387, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 724, in exec_module
  File "<frozen importlib._bootstrap_external>", line 860, in get_code
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/asyncpioneer/__init__.py", line 6
    <!DOCTYPE html>
    ^
SyntaxError: invalid syntax

Edit: im so dumb, i rightclicked on the .py files here on the github and did "save as" which doesnt work since it saves a bunch of HTML syntax inside the files. So now i downloaded the .zip and imported those files and now it works instantly.

Im sorry, really new to github and home assistant. glad I figured it out, you can close this issue.

Thanks for the help though.