mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +00:00
Better Hue error reporting (#3443)
This commit is contained in:
parent
9a87e5e336
commit
8a99ce78c2
@ -17,7 +17,7 @@ from homeassistant import util, core
|
|||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, SERVICE_TURN_OFF, SERVICE_TURN_ON,
|
ATTR_ENTITY_ID, ATTR_FRIENDLY_NAME, SERVICE_TURN_OFF, SERVICE_TURN_ON,
|
||||||
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP,
|
||||||
STATE_ON
|
STATE_ON, HTTP_BAD_REQUEST
|
||||||
)
|
)
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS, ATTR_SUPPORTED_FEATURES, SUPPORT_BRIGHTNESS
|
ATTR_BRIGHTNESS, ATTR_SUPPORTED_FEATURES, SUPPORT_BRIGHTNESS
|
||||||
@ -202,11 +202,10 @@ class HueUsernameView(HomeAssistantView):
|
|||||||
data = request.json
|
data = request.json
|
||||||
|
|
||||||
if 'devicetype' not in data:
|
if 'devicetype' not in data:
|
||||||
return self.Response("devicetype not specified", status=400)
|
return self.json_message('devicetype not specified',
|
||||||
|
HTTP_BAD_REQUEST)
|
||||||
|
|
||||||
json_response = [{'success': {'username': '12345678901234567890'}}]
|
return self.json([{'success': {'username': '12345678901234567890'}}])
|
||||||
|
|
||||||
return self.json(json_response)
|
|
||||||
|
|
||||||
|
|
||||||
class HueLightsView(HomeAssistantView):
|
class HueLightsView(HomeAssistantView):
|
||||||
|
@ -94,7 +94,7 @@ def setup_bridge(host, hass, add_devices_callback, filename,
|
|||||||
host,
|
host,
|
||||||
config_file_path=hass.config.path(filename))
|
config_file_path=hass.config.path(filename))
|
||||||
except ConnectionRefusedError: # Wrong host was given
|
except ConnectionRefusedError: # Wrong host was given
|
||||||
_LOGGER.exception("Error connecting to the Hue bridge at %s", host)
|
_LOGGER.error("Error connecting to the Hue bridge at %s", host)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user