Merge pull request #13620 from home-assistant/rc

0.66.1
This commit is contained in:
Paulus Schoutsen 2018-04-01 11:45:40 -07:00 committed by GitHub
commit 79eb75f26f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 18 deletions

View File

@ -24,7 +24,7 @@ from homeassistant.core import callback
from homeassistant.helpers.translation import async_get_translations
from homeassistant.loader import bind_hass
REQUIREMENTS = ['home-assistant-frontend==20180330.0']
REQUIREMENTS = ['home-assistant-frontend==20180401.0']
DOMAIN = 'frontend'
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log']

View File

@ -36,6 +36,7 @@ def validate_entity_config(values):
def show_setup_message(bridge, hass):
"""Display persistent notification with setup information."""
pin = bridge.pincode.decode()
_LOGGER.info('Pincode: %s', pin)
message = 'To setup Home Assistant in the Home App, enter the ' \
'following code:\n### {}'.format(pin)
hass.components.persistent_notification.create(

View File

@ -129,6 +129,8 @@ class MqttJson(MqttAvailability, Light):
self._retain = retain
self._optimistic = optimistic or topic[CONF_STATE_TOPIC] is None
self._state = False
self._rgb = rgb
self._xy = xy
if brightness:
self._brightness = 255
else:
@ -307,20 +309,22 @@ class MqttJson(MqttAvailability, Light):
message = {'state': 'ON'}
if ATTR_HS_COLOR in kwargs:
if ATTR_HS_COLOR in kwargs and (self._rgb or self._xy):
hs_color = kwargs[ATTR_HS_COLOR]
brightness = kwargs.get(
ATTR_BRIGHTNESS, self._brightness if self._brightness else 255)
rgb = color_util.color_hsv_to_RGB(
hs_color[0], hs_color[1], brightness / 255 * 100)
xy_color = color_util.color_hs_to_xy(*kwargs[ATTR_HS_COLOR])
message['color'] = {
'r': rgb[0],
'g': rgb[1],
'b': rgb[2],
'x': xy_color[0],
'y': xy_color[1],
}
message['color'] = {}
if self._rgb:
brightness = kwargs.get(
ATTR_BRIGHTNESS,
self._brightness if self._brightness else 255)
rgb = color_util.color_hsv_to_RGB(
hs_color[0], hs_color[1], brightness / 255 * 100)
message['color']['r'] = rgb[0]
message['color']['g'] = rgb[1]
message['color']['b'] = rgb[2]
if self._xy:
xy_color = color_util.color_hs_to_xy(*kwargs[ATTR_HS_COLOR])
message['color']['x'] = xy_color[0]
message['color']['y'] = xy_color[1]
if self._optimistic:
self._hs = kwargs[ATTR_HS_COLOR]

View File

@ -81,5 +81,6 @@ class MySensorsSensor(mysensors.MySensorsEntity):
TEMP_CELSIUS if self.gateway.metric else TEMP_FAHRENHEIT)
sensor_type = SENSORS.get(set_req(self.value_type).name, [None, None])
if isinstance(sensor_type, dict):
sensor_type = sensor_type.get(pres(self.child_type).name)
sensor_type = sensor_type.get(
pres(self.child_type).name, [None, None])
return sensor_type

View File

@ -2,7 +2,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 66
PATCH_VERSION = '0'
PATCH_VERSION = '1'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 5, 3)

View File

@ -366,7 +366,7 @@ hipnotify==1.0.8
holidays==0.9.4
# homeassistant.components.frontend
home-assistant-frontend==20180330.0
home-assistant-frontend==20180401.0
# homeassistant.components.homematicip_cloud
homematicip==0.8

View File

@ -81,7 +81,7 @@ hbmqtt==0.9.1
holidays==0.9.4
# homeassistant.components.frontend
home-assistant-frontend==20180330.0
home-assistant-frontend==20180401.0
# homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb

View File

@ -334,6 +334,33 @@ class TestLightMQTTJSON(unittest.TestCase):
self.assertEqual('colorloop', state.attributes['effect'])
self.assertEqual(170, state.attributes['white_value'])
# Test a color command
light.turn_on(self.hass, 'light.test',
brightness=50, hs_color=(125, 100))
self.hass.block_till_done()
self.assertEqual('test_light_rgb/set',
self.mock_publish.async_publish.mock_calls[0][1][0])
self.assertEqual(2,
self.mock_publish.async_publish.mock_calls[0][1][2])
self.assertEqual(False,
self.mock_publish.async_publish.mock_calls[0][1][3])
# Get the sent message
message_json = json.loads(
self.mock_publish.async_publish.mock_calls[1][1][1])
self.assertEqual(50, message_json["brightness"])
self.assertEqual({
'r': 0,
'g': 50,
'b': 4,
}, message_json["color"])
self.assertEqual("ON", message_json["state"])
state = self.hass.states.get('light.test')
self.assertEqual(STATE_ON, state.state)
self.assertEqual(50, state.attributes['brightness'])
self.assertEqual((125, 100), state.attributes['hs_color'])
def test_flash_short_and_long(self): \
# pylint: disable=invalid-name
"""Test for flash length being sent when included."""