mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Support for trigger Maker IFTTT (fix pylint)
This commit is contained in:
parent
b8e2bf6b7e
commit
14fc4f6f99
@ -70,26 +70,9 @@ def setup(hass, config):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import pyfttt as pyfttt
|
import pyfttt as pyfttt
|
||||||
r = pyfttt.send_event(key, event, value1, value2, value3)
|
resp = pyfttt.send_event(key, event, value1, value2, value3)
|
||||||
except requests.exceptions.ConnectionError:
|
except:
|
||||||
_LOGGER.error("Could not connect to IFTTT")
|
_LOGGER.exception("Error communicating with IFTTT")
|
||||||
except requests.exceptions.HTTPError:
|
|
||||||
_LOGGER.error("Received invalid response")
|
|
||||||
except requests.exceptions.Timeout:
|
|
||||||
_LOGGER.error("Request timed out")
|
|
||||||
except requests.exceptions.TooManyRedirects:
|
|
||||||
_LOGGER.error("Too many redirects")
|
|
||||||
except requests.exceptions.RequestException as e:
|
|
||||||
_LOGGER.error("{e}".format(e=e))
|
|
||||||
|
|
||||||
if r.status_code != requests.codes.ok:
|
|
||||||
try:
|
|
||||||
j = r.json()
|
|
||||||
except ValueError:
|
|
||||||
_LOGGER.error('Could not parse response. Event not sent!')
|
|
||||||
|
|
||||||
for e in j['errors']:
|
|
||||||
_LOGGER.error('{}'.format(e['message']))
|
|
||||||
|
|
||||||
hass.services.register(DOMAIN, SERVICE_TRIGGER, trigger_service)
|
hass.services.register(DOMAIN, SERVICE_TRIGGER, trigger_service)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user