Compare commits

..

15 Commits

Author SHA1 Message Date
Paulus Schoutsen
370c3f28b8 Merge pull request #15088 from home-assistant/rc
0.72
2018-06-22 13:38:44 -04:00
Paulus Schoutsen
66110a7d57 Bump frontend to 20180622.1 2018-06-22 12:48:01 -04:00
Paulus Schoutsen
a02d7989d5 Use older syntax for version bump 2018-06-22 11:07:26 -04:00
Paulus Schoutsen
7325847fa9 Bumped version to 0.72.0 2018-06-22 10:24:45 -04:00
Paulus Schoutsen
124495dd84 Update frontend to 20180622.0 2018-06-22 10:24:38 -04:00
Paulus Schoutsen
0ea2d99910 Bumped version to 0.72.0b9 2018-06-21 17:39:02 -04:00
Paulus Schoutsen
6456f66b47 Frontend bump to 20180621.2 2018-06-21 17:38:57 -04:00
Paulus Schoutsen
6e5a2a77ab Bumped version to 0.72.0b8 2018-06-21 17:27:08 -04:00
Paulus Schoutsen
35b609dd8b Allow writing commit with version bump 2018-06-21 17:27:01 -04:00
Paulus Schoutsen
0df99f8762 Bump frontend to 20180621.1 2018-06-21 17:22:08 -04:00
Paulus Schoutsen
a4b843eb2d Version bump to 0.72.0b7 2018-06-21 15:02:29 -04:00
Daniel Shokouhi
302717e8a1 Update Neato Library And Reduce Cloud Calls (#15072)
* Update Neato library to 0.0.6 and reduce the amount of calls to the cloud

* Remove file commited in error

* Lint
2018-06-21 15:02:13 -04:00
Bob Clough
617647c5fd Fix MQTT Light with RGB and Brightness (#15053)
* Fix MQTT Light with RGB and Brightness

When an MQTT light is given an RGB and Brightness topic, the RGB
is scaled by the brightness *as well* as the brightness being set

This causes 255,0,0 at 50% brightness to be sent as 127,0,0 at 50%
brightness, which ends up as 63,0,0 after the RGB bulb has applied
its brightness scaling.

Fixes the same issue in mqtt, mqtt-json and mqtt-template.

Related Issue: #13725

* Add comment to mqtt_json as well
2018-06-21 15:00:06 -04:00
Tom Harris
4b5d578c08 X10 (#14741)
* Implement X10

* Add X10 after add_device_callback

* Ref device by id not hex and add x10OnOffSwitch name

* X10 services and add sensor device

* Correctly reference X10_HOUSECODE_SCHEMA

* Log adding of X10 devices

* Add X10 All Units Off, All Lights On and All Lights Off devices

* Correct ref to X10 states vs devices

* Add X10 All Units Off, All Lights On and All Lights Off devices

* Correct X10 config

* Debug x10 device additions

* Config x10 from bool to housecode char

* Pass PLM to X10 device create

* Remove PLM to call to add_x10_device

* Unconfuse x10 config and method names

* Correct spelling of x10_all_lights_off_housecode

* Bump insteonplm to 0.10.0 to support X10
2018-06-21 15:00:06 -04:00
Paulus Schoutsen
e98e7e2751 Update frontend to 20180621.0 2018-06-21 14:57:19 -04:00
17 changed files with 188 additions and 32 deletions

View File

@@ -45,7 +45,7 @@ class NeatoCleaningMap(Camera):
self.update()
return self._image
@Throttle(timedelta(seconds=10))
@Throttle(timedelta(seconds=60))
def update(self):
"""Check the contents of the map list."""
self.neato.update_robots()

View File

@@ -26,7 +26,7 @@ from homeassistant.helpers.translation import async_get_translations
from homeassistant.loader import bind_hass
from homeassistant.util.yaml import load_yaml
REQUIREMENTS = ['home-assistant-frontend==20180620.0']
REQUIREMENTS = ['home-assistant-frontend==20180622.1']
DOMAIN = 'frontend'
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log']

View File

@@ -17,7 +17,7 @@ import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['insteonplm==0.9.2']
REQUIREMENTS = ['insteonplm==0.10.0']
_LOGGER = logging.getLogger(__name__)
@@ -29,17 +29,31 @@ CONF_CAT = 'cat'
CONF_SUBCAT = 'subcat'
CONF_FIRMWARE = 'firmware'
CONF_PRODUCT_KEY = 'product_key'
CONF_X10 = 'x10_devices'
CONF_HOUSECODE = 'housecode'
CONF_UNITCODE = 'unitcode'
CONF_DIM_STEPS = 'dim_steps'
CONF_X10_ALL_UNITS_OFF = 'x10_all_units_off'
CONF_X10_ALL_LIGHTS_ON = 'x10_all_lights_on'
CONF_X10_ALL_LIGHTS_OFF = 'x10_all_lights_off'
SRV_ADD_ALL_LINK = 'add_all_link'
SRV_DEL_ALL_LINK = 'delete_all_link'
SRV_LOAD_ALDB = 'load_all_link_database'
SRV_PRINT_ALDB = 'print_all_link_database'
SRV_PRINT_IM_ALDB = 'print_im_all_link_database'
SRV_X10_ALL_UNITS_OFF = 'x10_all_units_off'
SRV_X10_ALL_LIGHTS_OFF = 'x10_all_lights_off'
SRV_X10_ALL_LIGHTS_ON = 'x10_all_lights_on'
SRV_ALL_LINK_GROUP = 'group'
SRV_ALL_LINK_MODE = 'mode'
SRV_LOAD_DB_RELOAD = 'reload'
SRV_CONTROLLER = 'controller'
SRV_RESPONDER = 'responder'
SRV_HOUSECODE = 'housecode'
HOUSECODES = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p']
CONF_DEVICE_OVERRIDE_SCHEMA = vol.All(
cv.deprecated(CONF_PLATFORM), vol.Schema({
@@ -51,11 +65,24 @@ CONF_DEVICE_OVERRIDE_SCHEMA = vol.All(
vol.Optional(CONF_PLATFORM): cv.string,
}))
CONF_X10_SCHEMA = vol.All(
vol.Schema({
vol.Required(CONF_HOUSECODE): cv.string,
vol.Required(CONF_UNITCODE): vol.Range(min=1, max=16),
vol.Required(CONF_PLATFORM): cv.string,
vol.Optional(CONF_DIM_STEPS): vol.Range(min=2, max=255)
}))
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_PORT): cv.string,
vol.Optional(CONF_OVERRIDE): vol.All(
cv.ensure_list_csv, [CONF_DEVICE_OVERRIDE_SCHEMA])
cv.ensure_list_csv, [CONF_DEVICE_OVERRIDE_SCHEMA]),
vol.Optional(CONF_X10_ALL_UNITS_OFF): vol.In(HOUSECODES),
vol.Optional(CONF_X10_ALL_LIGHTS_ON): vol.In(HOUSECODES),
vol.Optional(CONF_X10_ALL_LIGHTS_OFF): vol.In(HOUSECODES),
vol.Optional(CONF_X10): vol.All(
cv.ensure_list_csv, [CONF_X10_SCHEMA])
})
}, extra=vol.ALLOW_EXTRA)
@@ -77,6 +104,10 @@ PRINT_ALDB_SCHEMA = vol.Schema({
vol.Required(CONF_ENTITY_ID): cv.entity_id,
})
X10_HOUSECODE_SCHEMA = vol.Schema({
vol.Required(SRV_HOUSECODE): vol.In(HOUSECODES),
})
@asyncio.coroutine
def async_setup(hass, config):
@@ -89,6 +120,10 @@ def async_setup(hass, config):
conf = config[DOMAIN]
port = conf.get(CONF_PORT)
overrides = conf.get(CONF_OVERRIDE, [])
x10_devices = conf.get(CONF_X10, [])
x10_all_units_off_housecode = conf.get(CONF_X10_ALL_UNITS_OFF)
x10_all_lights_on_housecode = conf.get(CONF_X10_ALL_LIGHTS_ON)
x10_all_lights_off_housecode = conf.get(CONF_X10_ALL_LIGHTS_OFF)
@callback
def async_plm_new_device(device):
@@ -106,7 +141,7 @@ def async_setup(hass, config):
hass.async_add_job(
discovery.async_load_platform(
hass, platform, DOMAIN,
discovered={'address': device.address.hex,
discovered={'address': device.address.id,
'state_key': state_key},
hass_config=config))
@@ -151,6 +186,21 @@ def async_setup(hass, config):
# Furture direction is to create an INSTEON control panel.
print_aldb_to_log(plm.aldb)
def x10_all_units_off(service):
"""Send the X10 All Units Off command."""
housecode = service.data.get(SRV_HOUSECODE)
plm.x10_all_units_off(housecode)
def x10_all_lights_off(service):
"""Send the X10 All Lights Off command."""
housecode = service.data.get(SRV_HOUSECODE)
plm.x10_all_lights_off(housecode)
def x10_all_lights_on(service):
"""Send the X10 All Lights On command."""
housecode = service.data.get(SRV_HOUSECODE)
plm.x10_all_lights_on(housecode)
def _register_services():
hass.services.register(DOMAIN, SRV_ADD_ALL_LINK, add_all_link,
schema=ADD_ALL_LINK_SCHEMA)
@@ -162,6 +212,15 @@ def async_setup(hass, config):
schema=PRINT_ALDB_SCHEMA)
hass.services.register(DOMAIN, SRV_PRINT_IM_ALDB, print_im_aldb,
schema=None)
hass.services.register(DOMAIN, SRV_X10_ALL_UNITS_OFF,
x10_all_units_off,
schema=X10_HOUSECODE_SCHEMA)
hass.services.register(DOMAIN, SRV_X10_ALL_LIGHTS_OFF,
x10_all_lights_off,
schema=X10_HOUSECODE_SCHEMA)
hass.services.register(DOMAIN, SRV_X10_ALL_LIGHTS_ON,
x10_all_lights_on,
schema=X10_HOUSECODE_SCHEMA)
_LOGGER.debug("Insteon_plm Services registered")
_LOGGER.info("Looking for PLM on %s", port)
@@ -192,6 +251,36 @@ def async_setup(hass, config):
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, conn.close)
plm.devices.add_device_callback(async_plm_new_device)
if x10_all_units_off_housecode:
device = plm.add_x10_device(x10_all_units_off_housecode,
20,
'allunitsoff')
if x10_all_lights_on_housecode:
device = plm.add_x10_device(x10_all_lights_on_housecode,
21,
'alllightson')
if x10_all_lights_off_housecode:
device = plm.add_x10_device(x10_all_lights_off_housecode,
22,
'alllightsoff')
for device in x10_devices:
housecode = device.get(CONF_HOUSECODE)
unitcode = device.get(CONF_UNITCODE)
x10_type = 'onoff'
steps = device.get(CONF_DIM_STEPS, 22)
if device.get(CONF_PLATFORM) == 'light':
x10_type = 'dimmable'
elif device.get(CONF_PLATFORM) == 'binary_sensor':
x10_type = 'sensor'
_LOGGER.debug("Adding X10 device to insteonplm: %s %d %s",
housecode, unitcode, x10_type)
device = plm.add_x10_device(housecode,
unitcode,
x10_type)
if device and hasattr(device.states[0x01], 'steps'):
device.states[0x01].steps = steps
hass.async_add_job(_register_services)
return True
@@ -219,6 +308,13 @@ class IPDB(object):
IoLincSensor,
LeakSensorDryWet)
from insteonplm.states.x10 import (X10DimmableSwitch,
X10OnOffSwitch,
X10OnOffSensor,
X10AllUnitsOffSensor,
X10AllLightsOnSensor,
X10AllLightsOffSensor)
self.states = [State(OnOffSwitch_OutletTop, 'switch'),
State(OnOffSwitch_OutletBottom, 'switch'),
State(OpenClosedRelay, 'switch'),
@@ -231,7 +327,14 @@ class IPDB(object):
State(VariableSensor, 'sensor'),
State(DimmableSwitch_Fan, 'fan'),
State(DimmableSwitch, 'light')]
State(DimmableSwitch, 'light'),
State(X10DimmableSwitch, 'light'),
State(X10OnOffSwitch, 'switch'),
State(X10OnOffSensor, 'binary_sensor'),
State(X10AllUnitsOffSensor, 'binary_sensor'),
State(X10AllLightsOnSensor, 'binary_sensor'),
State(X10AllLightsOffSensor, 'binary_sensor')]
def __len__(self):
"""Return the number of INSTEON state types mapped to HA platforms."""

View File

@@ -30,3 +30,21 @@ print_all_link_database:
example: 'light.1a2b3c'
print_im_all_link_database:
description: Print the All-Link Database for the INSTEON Modem (IM).
x10_all_units_off:
description: Send X10 All Units Off command
fields:
housecode:
description: X10 house code
example: c
x10_all_lights_on:
description: Send X10 All Lights On command
fields:
housecode:
description: X10 house code
example: c
x10_all_lights_off:
description: Send X10 All Lights Off command
fields:
housecode:
description: X10 house code
example: c

View File

@@ -442,8 +442,15 @@ class MqttLight(MqttAvailability, Light):
self._topic[CONF_RGB_COMMAND_TOPIC] is not None:
hs_color = kwargs[ATTR_HS_COLOR]
brightness = kwargs.get(
ATTR_BRIGHTNESS, self._brightness if self._brightness else 255)
# If there's a brightness topic set, we don't want to scale the RGB
# values given using the brightness.
if self._topic[CONF_BRIGHTNESS_COMMAND_TOPIC] is not None:
brightness = 255
else:
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)
tpl = self._templates[CONF_RGB_COMMAND_TEMPLATE]

View File

@@ -345,9 +345,14 @@ class MqttJson(MqttAvailability, Light):
hs_color = kwargs[ATTR_HS_COLOR]
message['color'] = {}
if self._rgb:
brightness = kwargs.get(
ATTR_BRIGHTNESS,
self._brightness if self._brightness else 255)
# If there's a brightness topic set, we don't want to scale the
# RGB values given using the brightness.
if self._brightness is not None:
brightness = 255
else:
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]

View File

@@ -317,8 +317,15 @@ class MqttTemplate(MqttAvailability, Light):
if ATTR_HS_COLOR in kwargs:
hs_color = kwargs[ATTR_HS_COLOR]
brightness = kwargs.get(
ATTR_BRIGHTNESS, self._brightness if self._brightness else 255)
# If there's a brightness topic set, we don't want to scale the RGB
# values given using the brightness.
if self._templates[CONF_BRIGHTNESS_TEMPLATE] is not None:
brightness = 255
else:
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)
values['red'] = rgb[0]

View File

@@ -17,8 +17,8 @@ from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
REQUIREMENTS = ['https://github.com/jabesq/pybotvac/archive/v0.0.5.zip'
'#pybotvac==0.0.5']
REQUIREMENTS = ['https://github.com/jabesq/pybotvac/archive/v0.0.6.zip'
'#pybotvac==0.0.6']
DOMAIN = 'neato'
NEATO_ROBOTS = 'neato_robots'
@@ -122,7 +122,7 @@ class NeatoHub(object):
_LOGGER.error("Unable to connect to Neato API")
return False
@Throttle(timedelta(seconds=1))
@Throttle(timedelta(seconds=60))
def update_robots(self):
"""Update the robot states."""
_LOGGER.debug("Running HUB.update_robots %s",

View File

@@ -30,7 +30,8 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
device.address.hex, device.states[state_key].name)
new_entity = None
if state_name in ['lightOnOff', 'outletTopOnOff', 'outletBottomOnOff']:
if state_name in ['lightOnOff', 'outletTopOnOff', 'outletBottomOnOff',
'x10OnOffSwitch']:
new_entity = InsteonPLMSwitchDevice(device, state_key)
elif state_name == 'openClosedRelay':
new_entity = InsteonPLMOpenClosedDevice(device, state_key)

View File

@@ -5,10 +5,12 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.neato/
"""
import logging
from datetime import timedelta
import requests
from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.components.neato import NEATO_ROBOTS, NEATO_LOGIN
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@@ -50,6 +52,7 @@ class NeatoConnectedSwitch(ToggleEntity):
self._schedule_state = None
self._clean_state = None
@Throttle(timedelta(seconds=60))
def update(self):
"""Update the states of Neato switches."""
_LOGGER.debug("Running switch update")

View File

@@ -5,7 +5,7 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/vacuum.neato/
"""
import logging
from datetime import timedelta
import requests
from homeassistant.const import STATE_OFF, STATE_ON
@@ -15,6 +15,7 @@ from homeassistant.components.vacuum import (
SUPPORT_MAP, ATTR_STATUS, ATTR_BATTERY_LEVEL, ATTR_BATTERY_ICON)
from homeassistant.components.neato import (
NEATO_ROBOTS, NEATO_LOGIN, NEATO_MAP_DATA, ACTION, ERRORS, MODE, ALERTS)
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
@@ -62,6 +63,7 @@ class NeatoConnectedVacuum(VacuumDevice):
self.clean_suspension_charge_count = None
self.clean_suspension_time = None
@Throttle(timedelta(seconds=60))
def update(self):
"""Update the states of Neato Vacuums."""
_LOGGER.debug("Running Neato Vacuums update")

View File

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

View File

@@ -404,7 +404,7 @@ hipnotify==1.0.8
holidays==0.9.5
# homeassistant.components.frontend
home-assistant-frontend==20180620.0
home-assistant-frontend==20180622.1
# homeassistant.components.homekit_controller
# homekit==0.6
@@ -425,7 +425,7 @@ httplib2==0.10.3
https://github.com/aparraga/braviarc/archive/0.3.7.zip#braviarc==0.3.7
# homeassistant.components.neato
https://github.com/jabesq/pybotvac/archive/v0.0.5.zip#pybotvac==0.0.5
https://github.com/jabesq/pybotvac/archive/v0.0.6.zip#pybotvac==0.0.6
# homeassistant.components.switch.anel_pwrctrl
https://github.com/mweinelt/anel-pwrctrl/archive/ed26e8830e28a2bfa4260a9002db23ce3e7e63d7.zip#anel_pwrctrl==0.0.1
@@ -464,7 +464,7 @@ influxdb==5.0.0
insteonlocal==0.53
# homeassistant.components.insteon_plm
insteonplm==0.9.2
insteonplm==0.10.0
# homeassistant.components.sensor.iperf3
iperf3==0.1.10

View File

@@ -81,7 +81,7 @@ hbmqtt==0.9.2
holidays==0.9.5
# homeassistant.components.frontend
home-assistant-frontend==20180620.0
home-assistant-frontend==20180622.1
# homeassistant.components.influxdb
# homeassistant.components.sensor.influxdb

View File

@@ -2,6 +2,7 @@
"""Helper script to bump the current version."""
import argparse
import re
import subprocess
from packaging.version import Version
@@ -117,12 +118,21 @@ def main():
help="The type of the bump the version to.",
choices=['beta', 'dev', 'patch', 'minor'],
)
parser.add_argument(
'--commit', action='store_true',
help='Create a version bump commit.')
arguments = parser.parse_args()
current = Version(const.__version__)
bumped = bump_version(current, arguments.type)
assert bumped > current, 'BUG! New version is not newer than old version'
write_version(bumped)
if not arguments.commit:
return
subprocess.run([
'git', 'commit', '-am', 'Bumped version to {}'.format(bumped)])
def test_bump_version():
"""Make sure it all works."""

View File

@@ -523,24 +523,24 @@ class TestLightMQTT(unittest.TestCase):
self.mock_publish.reset_mock()
light.turn_on(self.hass, 'light.test',
brightness=50, xy_color=[0.123, 0.123])
light.turn_on(self.hass, 'light.test', rgb_color=[75, 75, 75],
light.turn_on(self.hass, 'light.test', rgb_color=[255, 128, 0],
white_value=80)
self.hass.block_till_done()
self.mock_publish.async_publish.assert_has_calls([
mock.call('test_light_rgb/set', 'on', 2, False),
mock.call('test_light_rgb/rgb/set', '50,50,50', 2, False),
mock.call('test_light_rgb/rgb/set', '255,128,0', 2, False),
mock.call('test_light_rgb/brightness/set', 50, 2, False),
mock.call('test_light_rgb/white_value/set', 80, 2, False),
mock.call('test_light_rgb/xy/set', '0.323,0.329', 2, False),
mock.call('test_light_rgb/xy/set', '0.14,0.131', 2, False),
], any_order=True)
state = self.hass.states.get('light.test')
self.assertEqual(STATE_ON, state.state)
self.assertEqual((255, 255, 255), state.attributes['rgb_color'])
self.assertEqual((255, 128, 0), state.attributes['rgb_color'])
self.assertEqual(50, state.attributes['brightness'])
self.assertEqual(80, state.attributes['white_value'])
self.assertEqual((0.323, 0.329), state.attributes['xy_color'])
self.assertEqual((0.611, 0.375), state.attributes['xy_color'])
def test_sending_mqtt_rgb_command_with_template(self):
"""Test the sending of RGB command with template."""
@@ -808,11 +808,11 @@ class TestLightMQTT(unittest.TestCase):
# Turn on w/ just a color to insure brightness gets
# added and sent.
light.turn_on(self.hass, 'light.test', rgb_color=[75, 75, 75])
light.turn_on(self.hass, 'light.test', rgb_color=[255, 128, 0])
self.hass.block_till_done()
self.mock_publish.async_publish.assert_has_calls([
mock.call('test_light/rgb', '50,50,50', 0, False),
mock.call('test_light/rgb', '255,128,0', 0, False),
mock.call('test_light/bright', 50, 0, False)
], any_order=True)

View File

@@ -381,8 +381,8 @@ class TestLightMQTTJSON(unittest.TestCase):
self.assertEqual(50, message_json["brightness"])
self.assertEqual({
'r': 0,
'g': 50,
'b': 4,
'g': 255,
'b': 21,
}, message_json["color"])
self.assertEqual("ON", message_json["state"])