home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.95k stars 31k forks source link

Apcupsd component doesn't start on 0.27.1 #3112

Closed ardzeus closed 8 years ago

ardzeus commented 8 years ago

Home Assistant release (hass --version): 0.27.1

Python release (python3 --version): 3.4.2

Component/platform: apcupsd

Description of problem: Apcupsd component doesn't start

Expected:

Problem-relevant configuration.yaml entries and steps to reproduce:

sensor:
  - platform: apcupsd
    resources:
      - status

Traceback (if applicable):

16-09-01 20:43:09 INFO (MainThread) [homeassistant.loader] Loaded sensor.onewire from homeassistant.components.sensor.onewire
16-09-01 20:43:09 INFO (MainThread) [homeassistant.loader] Loaded sensor.apcupsd from homeassistant.components.sensor.apcupsd
16-09-01 20:43:09 INFO (MainThread) [homeassistant.loader] Loaded apcupsd from homeassistant.components.apcupsd
16-09-01 20:43:09 ERROR (MainThread) [homeassistant.bootstrap] Error during setup of component apcupsd
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/bootstrap.py", line 157, in _setup_component
    result = component.setup(hass, config)
  File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/apcupsd.py", line 44, in setup
    conf = config[DOMAIN]
KeyError: 'apcupsd'
16-09-01 20:43:09 ERROR (MainThread) [homeassistant.bootstrap] Unable to prepare setup for platform sensor.apcupsd because dependency apcupsd could not be initialized

Additional info: Worked fine on 0.27.0

fabaff commented 8 years ago

The APCUPSd component was migrated to do configuration checks. Please see the APCUPSd Sensor documentation.

ardzeus commented 8 years ago

According documentation nothing has changed... Could you please point out, what I should change in the configuration to get apcupsd working again?

Danielhiversen commented 8 years ago

There is a bug in 0.27.1, so you have to specify the host:

apcupsd:
  host: localhost

It will be fixed in the next release

ardzeus commented 8 years ago

Unfortunately specifying a host doesn't fix this issue. If you check the error message, you can see the problem is somewhere else now...

Danielhiversen commented 8 years ago

What is the output of: hass --script check_config

Danielhiversen commented 8 years ago

And how is your config for the apcupsd? You should have:

apcupsd:
  host: localhost
ardzeus commented 8 years ago

You can check the configuration above on the bug description.

Output of the check_config is quite interesting... It's showing same for pip installation and git workarea

% hass --script check_config Traceback (most recent call last): File "/usr/local/bin/hass", line 11, in sys.exit(main()) File "/usr/local/lib/python3.4/dist-packages/homeassistant/main.py", line 317, in main return scripts.run(args.script) File "/usr/local/lib/python3.4/dist-packages/homeassistant/scripts/init.py", line 47, in run return script.run(args[1:]) # type: ignore File "/usr/local/lib/python3.4/dist-packages/homeassistant/scripts/check_config.py", line 89, in run print(color('bold', "Testing configuration at", config_dir)) File "/usr/local/lib/python3.4/dist-packages/homeassistant/scripts/check_config.py", line 46, in color from colorlog.escape_codes import escape_codes, parse_colors ImportError: cannot import name 'parse_colors'

% which hass /usr/local/bin/hass

% hass --version 0.27.1

Danielhiversen commented 8 years ago

I think you are missing:

apcupsd:
  host: localhost

in your config

ardzeus commented 8 years ago

Yes sure there is now also the host definition like you mentioned earlier

Danielhiversen commented 8 years ago

To be sure, your config look like this?

apcupsd:
  host: localhost

sensor:
  - platform: apcupsd
    resources:
      - status
ardzeus commented 8 years ago

Eh, so the host definition must be under different section... Now it's working! Thank you very much for your help!

Danielhiversen commented 8 years ago

@fabaff We should try to find a way to give a better error message in cases where the config for the hub is missing. Not easy to understand the problem from the given error message.