mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Refactoring
This commit is contained in:
parent
31237a891c
commit
417711d665
@ -74,14 +74,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||||||
sensors.append(WUndergroundSensor(rest, variable))
|
sensors.append(WUndergroundSensor(rest, variable))
|
||||||
else:
|
else:
|
||||||
_LOGGER.error('Wunderground sensor: "%s" does not exist', variable)
|
_LOGGER.error('Wunderground sensor: "%s" does not exist', variable)
|
||||||
response = requests.get(_RESOURCE + config.get(CONF_API_KEY) +
|
|
||||||
_URLCONST + config.get(CONF_PWS_ID) +
|
|
||||||
'.json', timeout=10)
|
|
||||||
if "error" in response.json()["response"]:
|
|
||||||
_LOGGER.error("Check your Wunderground API")
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
add_devices(sensors)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rest.update()
|
rest.update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user