mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Lint
This commit is contained in:
parent
33439aaa22
commit
7564d539c1
@ -2,6 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
from requests.exceptions import RequestException
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_API_KEY, CONF_ID, CONF_WHITELIST,
|
CONF_API_KEY, CONF_ID, CONF_WHITELIST,
|
||||||
@ -41,7 +42,7 @@ def setup(hass, config):
|
|||||||
channel = thingspeak.Channel(
|
channel = thingspeak.Channel(
|
||||||
channel_id, api_key=api_key, timeout=TIMEOUT)
|
channel_id, api_key=api_key, timeout=TIMEOUT)
|
||||||
channel.get()
|
channel.get()
|
||||||
except:
|
except RequestException:
|
||||||
_LOGGER.error("Error while accessing the ThingSpeak channel. "
|
_LOGGER.error("Error while accessing the ThingSpeak channel. "
|
||||||
"Please check that the channel exists and your "
|
"Please check that the channel exists and your "
|
||||||
"API key is correct.")
|
"API key is correct.")
|
||||||
@ -60,7 +61,7 @@ def setup(hass, config):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
channel.update({'field1': _state})
|
channel.update({'field1': _state})
|
||||||
except:
|
except RequestException:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
'Error while sending value "%s" to Thingspeak',
|
'Error while sending value "%s" to Thingspeak',
|
||||||
_state)
|
_state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user