[Solved] Invalid Config while trying to use Wunderground

I am getting a confusing error. My guess is that I have done something wrong in a different area that I have not yet discovered. I have tried to strip out all changes to my configuration.yaml file except for the one component I am now troubleshooting. This installation is on a Windows 10 machine (64-bit) using Python 3.6.2 within a virtual environment with only six, xmltodict, and homeassistant (and it’s dependencies) installed. I found this youTube video, but no change in my error.

My problem is with implementing Wunderground Weather. I have the following in my config file:

homeassistant:
  name: Home
  latitude: 32.9588
  longitude: -96.9812
  elevation: 156
  unit_system: imperial
  time_zone: America/Chicago

introduction:

frontend:

config:

http:

updater:

discovery:

conversation:

history:

logbook:

sun:

sensor:
  - platform: wunderground
    api-key: !secret WUnderground_API
    monitored_conditions:
      - alerts

tts:
  - platform: google

automation: !include automations.yaml
script: !include scripts.yaml
  • Notes: I have verified the same error with using secrets.yaml, I have already searched this error, I have tried a few dozen iterations of defining the sensor along with what attributes it contains, and Wunderground API Key verified.

Error Message from Logs:

2017-08-28 13:08:13 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.wunderground]: required key not provided @ data['api_key']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.wunderground/

Error Message from Config Validation:

2017-08-28 13:12:55 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
Failed config
  sensor.wunderground: 
    platform: wunderground
    api-key: (key shows up here correctly)
    monitored_conditions: [source C:\Users\Randall\AppData\Roaming\.homeassistant\configuration.yaml:32]
      - alerts

Successful config (partial)
  sensor.wunderground:

The Wonderground site does not yet show that I have utilized their API (I have not reached their site yet), but I can’t imagine there is anything blocking Home Assistant. I have tried running my code through a YAML validator with no problems. Thanks for reading this far. Any help would be greatly appreciated.

Please use api_key, not api-key. It is an UNDERSCORE, not a hyphen!

Wow. That was it. I have been staring at this for too long. Thank you very much for the help.

I know, sometimes it needs a second pair of eyes to find the small little details :wink:

Trust me it happend to me before and I’m sure it will happen again. I normally take a break and try to do sth completely different in order to get focused again.

1 Like