Better Hue error reporting (#3443)

This commit is contained in:
Paulus Schoutsen 2016-09-18 19:59:38 -07:00 committed by GitHub
parent 9a87e5e336
commit 8a99ce78c2
2 changed files with 5 additions and 6 deletions

View File

@ -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):

View File

@ -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