Compare commits

..

16 Commits

Author SHA1 Message Date
Paulus Schoutsen 25d2df5689 Merge pull request #6740 from home-assistant/release-0-40-2
0.40.2
2017-03-22 09:31:21 -07:00
Paulus Schoutsen 672b83db8a Update constraints 2017-03-22 09:30:36 -07:00
Paulus Schoutsen b37438ebb7 Constrain core dependencies to core versions (#6738)
* Require at least pip 7.1

* Write and use constraint files for packages

* Update gen_requirements_all.py
2017-03-22 08:51:18 -07:00
Paulus Schoutsen f10fede17f Bump PyChromecast to 0.8.1 (#6702) 2017-03-22 08:50:42 -07:00
Paulus Schoutsen c9548b11b1 Version bump to 0.40.2 2017-03-22 08:50:15 -07:00
Paulus Schoutsen 7292e564f8 Merge pull request #6652 from home-assistant/release-0-40-1
0.40.1
2017-03-15 23:47:10 -07:00
Pascal Vizeli acdab67c1b Bugfix RFLINK remove group (#6580)
* Bugfix RFLINK remove group

* Remove group hack from lutron too

* fix tests

* fix lint

* fix lint
2017-03-15 23:19:33 -07:00
deisi d7addf59cd Fix #6534 (#6598)
* Fix #6534

Makes sure 0 is not passes to `color_temperature_kelvin_to_mired`.

* Update osramlightify.py

* Update osramlightify.py
2017-03-15 23:19:24 -07:00
Yum ccf9edf815 since knx_2_float can't handle 0, bypass converting 0 value from knx to float (#6626) 2017-03-15 23:18:55 -07:00
Johann Kellerman 2fd3c186e2 Update SMA solar sensor to work with the new add_devices callback (#6602) 2017-03-15 23:18:11 -07:00
Dale Higgs 719199da45 Update pyecobee version to 0.0.7 (#6593) 2017-03-15 23:17:44 -07:00
Thibault Cohen a3cd7d653d Fix hydroquebec (#6574) 2017-03-15 23:17:17 -07:00
Andrey aeeb927e19 Fix for the case of zwave value used in several devices. (#6577) 2017-03-15 23:16:50 -07:00
Jesse Newland a3a14f9ea4 Don't start the push updater if the Apple TV is 'off' (#6552)
Add an optional extended description…
2017-03-15 23:16:32 -07:00
Tyler Page f4e7b231bc Fix wake_on_lan ping with None as host (#6532)
* Update configuration validation

With the new update, wake_on_lan requires a host key in the configuration

* cast self._host to str as requested

* Changed host key back to optional
2017-03-15 23:15:56 -07:00
Paulus Schoutsen 5f68735375 Version bump to 0.40.1 2017-03-15 23:10:50 -07:00
23 changed files with 98 additions and 167 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ from homeassistant.util import Throttle
REQUIREMENTS = [
'https://github.com/nkgilley/python-ecobee-api/archive/'
'4856a704670c53afe1882178a89c209b5f98533d.zip#python-ecobee==0.0.6']
'a4496b293956b2eac285305136a62ac78bef510d.zip#python-ecobee==0.0.7']
_CONFIGURING = {}
_LOGGER = logging.getLogger(__name__)
+4 -12
View File
@@ -2,9 +2,9 @@
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS, DOMAIN, SUPPORT_BRIGHTNESS, Light)
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
from homeassistant.components.lutron import (
LutronDevice, LUTRON_DEVICES, LUTRON_GROUPS, LUTRON_CONTROLLER)
LutronDevice, LUTRON_DEVICES, LUTRON_CONTROLLER)
DEPENDENCIES = ['lutron']
@@ -21,15 +21,8 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
hass.data[LUTRON_CONTROLLER])
area_devs.setdefault(area_name, []).append(dev)
devs.append(dev)
add_devices(devs, True)
for area in area_devs:
if area not in hass.data[LUTRON_GROUPS]:
continue
grp = hass.data[LUTRON_GROUPS][area]
ids = list(grp.tracking) + [dev.entity_id for dev in area_devs[area]]
grp.update_tracked_entity_ids(ids)
return True
@@ -49,8 +42,7 @@ class LutronLight(LutronDevice, Light):
def __init__(self, hass, area_name, lutron_device, controller):
"""Initialize the light."""
self._prev_brightness = None
LutronDevice.__init__(self, hass, DOMAIN, area_name, lutron_device,
controller)
LutronDevice.__init__(self, hass, area_name, lutron_device, controller)
@property
def supported_features(self):
@@ -215,5 +215,8 @@ class OsramLightifyLight(Light):
self._name = self._light.name()
self._rgb = self._light.rgb()
o_temp = self._light.temp()
self._temperature = color_temperature_kelvin_to_mired(o_temp)
if o_temp == 0:
self._temperature = None
else:
self._temperature = color_temperature_kelvin_to_mired(o_temp)
self._state = self._light.on()
+3 -30
View File
@@ -7,13 +7,12 @@ https://home-assistant.io/components/light.rflink/
import asyncio
import logging
from homeassistant.components import group
from homeassistant.components.light import (
ATTR_BRIGHTNESS, SUPPORT_BRIGHTNESS, Light)
from homeassistant.components.rflink import (
CONF_ALIASSES, CONF_DEVICE_DEFAULTS, CONF_DEVICES, CONF_FIRE_EVENT,
CONF_IGNORE_DEVICES, CONF_NEW_DEVICES_GROUP, CONF_SIGNAL_REPETITIONS,
DATA_DEVICE_REGISTER, DATA_ENTITY_LOOKUP, DEVICE_DEFAULTS_SCHEMA, DOMAIN,
CONF_IGNORE_DEVICES, CONF_SIGNAL_REPETITIONS, DATA_DEVICE_REGISTER,
DATA_ENTITY_LOOKUP, DEVICE_DEFAULTS_SCHEMA, DOMAIN,
EVENT_KEY_COMMAND, EVENT_KEY_ID, SwitchableRflinkDevice, cv, vol)
from homeassistant.const import CONF_NAME, CONF_PLATFORM, CONF_TYPE
@@ -27,7 +26,6 @@ TYPE_HYBRID = 'hybrid'
PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): DOMAIN,
vol.Optional(CONF_NEW_DEVICES_GROUP, default=None): cv.string,
vol.Optional(CONF_IGNORE_DEVICES): vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_DEVICE_DEFAULTS, default=DEVICE_DEFAULTS_SCHEMA({})):
DEVICE_DEFAULTS_SCHEMA,
@@ -119,13 +117,6 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Rflink light platform."""
async_add_devices(devices_from_config(config, hass))
# Add new (unconfigured) devices to user desired group
if config[CONF_NEW_DEVICES_GROUP]:
new_devices_group = yield from group.Group.async_create_group(
hass, config[CONF_NEW_DEVICES_GROUP], [], True)
else:
new_devices_group = None
@asyncio.coroutine
def add_new_device(event):
"""Check if device is known, otherwise add to list of known devices."""
@@ -145,21 +136,13 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
# Make sure the event is processed by the new entity
device.handle_event(event)
# Maybe add to new devices group
if new_devices_group:
yield from new_devices_group.async_update_tracked_entity_ids(
list(new_devices_group.tracking) + [device.entity_id])
hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_COMMAND] = add_new_device
class RflinkLight(SwitchableRflinkDevice, Light):
"""Representation of a Rflink light."""
@property
def entity_id(self):
"""Return entity id."""
return "light.{}".format(self.name)
pass
class DimmableRflinkLight(SwitchableRflinkDevice, Light):
@@ -167,11 +150,6 @@ class DimmableRflinkLight(SwitchableRflinkDevice, Light):
_brightness = 255
@property
def entity_id(self):
"""Return entity id."""
return "light.{}".format(self.name)
@asyncio.coroutine
def async_turn_on(self, **kwargs):
"""Turn the device on."""
@@ -210,11 +188,6 @@ class HybridRflinkLight(SwitchableRflinkDevice, Light):
_brightness = 255
@property
def entity_id(self):
"""Return entity id."""
return "light.{}".format(self.name)
@asyncio.coroutine
def async_turn_on(self, **kwargs):
"""Turn the device on and set dim level."""
+3 -13
View File
@@ -7,8 +7,7 @@ https://home-assistant.io/components/lutron/
import logging
from homeassistant.helpers import discovery
from homeassistant.helpers.entity import (Entity, generate_entity_id)
from homeassistant.loader import get_component
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['https://github.com/thecynic/pylutron/archive/v0.1.0.zip#'
'pylutron==0.1.0']
@@ -19,7 +18,6 @@ _LOGGER = logging.getLogger(__name__)
LUTRON_CONTROLLER = 'lutron_controller'
LUTRON_DEVICES = 'lutron_devices'
LUTRON_GROUPS = 'lutron_groups'
def setup(hass, base_config):
@@ -28,7 +26,6 @@ def setup(hass, base_config):
hass.data[LUTRON_CONTROLLER] = None
hass.data[LUTRON_DEVICES] = {'light': []}
hass.data[LUTRON_GROUPS] = {}
config = base_config.get(DOMAIN)
hass.data[LUTRON_CONTROLLER] = Lutron(
@@ -40,13 +37,8 @@ def setup(hass, base_config):
hass.data[LUTRON_CONTROLLER].connect()
_LOGGER.info("Connected to Main Repeater at %s", config['lutron_host'])
group = get_component('group')
# Sort our devices into types
for area in hass.data[LUTRON_CONTROLLER].areas:
if area.name not in hass.data[LUTRON_GROUPS]:
grp = group.Group.create_group(hass, area.name, [])
hass.data[LUTRON_GROUPS][area.name] = grp
for output in area.outputs:
hass.data[LUTRON_DEVICES]['light'].append((area.name, output))
@@ -58,16 +50,14 @@ def setup(hass, base_config):
class LutronDevice(Entity):
"""Representation of a Lutron device entity."""
def __init__(self, hass, domain, area_name, lutron_device, controller):
def __init__(self, hass, area_name, lutron_device, controller):
"""Initialize the device."""
self._lutron_device = lutron_device
self._controller = controller
self._area_name = area_name
self.hass = hass
object_id = '{} {}'.format(area_name, lutron_device.name)
self.entity_id = generate_entity_id(domain + '.{}', object_id,
hass=hass)
self.object_id = '{} {}'.format(area_name, lutron_device.name)
self._controller.subscribe(self._lutron_device, self._update_callback)
@@ -96,7 +96,8 @@ class AppleTvDevice(MediaPlayerDevice):
@asyncio.coroutine
def async_added_to_hass(self):
"""Called when entity is about to be added to HASS."""
self._atv.push_updater.start()
if not self._is_off:
self._atv.push_updater.start()
@callback
def _set_power_off(self, is_off):
@@ -20,7 +20,7 @@ from homeassistant.const import (
import homeassistant.helpers.config_validation as cv
import homeassistant.util.dt as dt_util
REQUIREMENTS = ['pychromecast==0.8.0']
REQUIREMENTS = ['pychromecast==0.8.1']
_LOGGER = logging.getLogger(__name__)
-1
View File
@@ -32,7 +32,6 @@ CONF_DEVICE_DEFAULTS = 'device_defaults'
CONF_DEVICES = 'devices'
CONF_FIRE_EVENT = 'fire_event'
CONF_IGNORE_DEVICES = 'ignore_devices'
CONF_NEW_DEVICES_GROUP = 'new_devices_group'
CONF_RECONNECT_INTERVAL = 'reconnect_interval'
CONF_SIGNAL_REPETITIONS = 'signal_repetitions'
CONF_WAIT_FOR_ACK = 'wait_for_ack'
@@ -149,7 +149,8 @@ class HydroQuebecSensor(Entity):
def update(self):
"""Get the latest data from Hydroquebec and update the state."""
self.hydroquebec_data.update()
self._state = round(self.hydroquebec_data.data[self.type], 2)
if self.type in self.hydroquebec_data.data:
self._state = round(self.hydroquebec_data.data[self.type], 2)
class HydroquebecData(object):
+1 -1
View File
@@ -129,6 +129,6 @@ class KNXSensorFloatClass(KNXGroupAddress, KNXSensorBaseClass):
self._value = None
if self._data:
value = knx2_to_float(self._data)
value = 0 if self._data == 0 else knx2_to_float(self._data)
if self._minimum_value <= value <= self._maximum_value:
self._value = value
+3 -22
View File
@@ -8,11 +8,10 @@ import asyncio
from functools import partial
import logging
from homeassistant.components import group
from homeassistant.components.rflink import (
CONF_ALIASSES, CONF_DEVICES, CONF_NEW_DEVICES_GROUP, DATA_DEVICE_REGISTER,
DATA_ENTITY_LOOKUP, DOMAIN, EVENT_KEY_ID, EVENT_KEY_SENSOR, EVENT_KEY_UNIT,
RflinkDevice, cv, vol)
CONF_ALIASSES, CONF_DEVICES, DATA_DEVICE_REGISTER, DATA_ENTITY_LOOKUP,
DOMAIN, EVENT_KEY_ID, EVENT_KEY_SENSOR, EVENT_KEY_UNIT, RflinkDevice,
cv, vol)
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT, CONF_NAME, CONF_PLATFORM,
CONF_UNIT_OF_MEASUREMENT)
@@ -31,7 +30,6 @@ CONF_SENSOR_TYPE = 'sensor_type'
PLATFORM_SCHEMA = vol.Schema({
vol.Required(CONF_PLATFORM): DOMAIN,
vol.Optional(CONF_NEW_DEVICES_GROUP, default=None): cv.string,
vol.Optional(CONF_DEVICES, default={}): vol.Schema({
cv.string: {
vol.Optional(CONF_NAME): cv.string,
@@ -76,13 +74,6 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the Rflink platform."""
async_add_devices(devices_from_config(config, hass))
# Add new (unconfigured) devices to user desired group
if config[CONF_NEW_DEVICES_GROUP]:
new_devices_group = yield from group.Group.async_create_group(
hass, config[CONF_NEW_DEVICES_GROUP], [], True)
else:
new_devices_group = None
@asyncio.coroutine
def add_new_device(event):
"""Check if device is known, otherwise create device entity."""
@@ -100,11 +91,6 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
# Make sure the event is processed by the new entity
device.handle_event(event)
# Maybe add to new devices group
if new_devices_group:
yield from new_devices_group.async_update_tracked_entity_ids(
list(new_devices_group.tracking) + [device.entity_id])
hass.data[DATA_DEVICE_REGISTER][EVENT_KEY_SENSOR] = add_new_device
@@ -122,11 +108,6 @@ class RflinkSensor(RflinkDevice):
"""Domain specific event handler."""
self._state = event['value']
@property
def entity_id(self):
"""Return entity id."""
return "sensor.{}".format(self.name)
@property
def unit_of_measurement(self):
"""Return measurement unit."""
+3 -2
View File
@@ -60,7 +60,8 @@ PLATFORM_SCHEMA = vol.All(PLATFORM_SCHEMA.extend({
}, extra=vol.PREVENT_EXTRA), _check_sensor_schema)
def async_setup_platform(hass, config, add_devices, discovery_info=None):
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up SMA WebConnect sensor."""
import pysma
@@ -89,7 +90,7 @@ def async_setup_platform(hass, config, add_devices, discovery_info=None):
sensor_defs = {name: val for name, val in sensor_defs.items()
if name in used_sensors}
yield from add_devices(hass_sensors)
async_add_devices(hass_sensors)
# Init the SMA interface
session = async_get_clientsession(hass)
@@ -86,10 +86,10 @@ class WOLSwitch(SwitchDevice):
"""Check if device is on and update the state."""
if platform.system().lower() == 'windows':
ping_cmd = ['ping', '-n', '1', '-w',
str(DEFAULT_PING_TIMEOUT * 1000), self._host]
str(DEFAULT_PING_TIMEOUT * 1000), str(self._host)]
else:
ping_cmd = ['ping', '-c', '1', '-W',
str(DEFAULT_PING_TIMEOUT), self._host]
str(DEFAULT_PING_TIMEOUT), str(self._host)]
status = sp.call(ping_cmd, stdout=sp.DEVNULL)
self._state = not bool(status)
+1 -1
View File
@@ -434,7 +434,7 @@ def setup(hass, config):
node=node, value=value, node_config=node_config, hass=hass)
if not device:
continue
dict_id = value.value_id
dict_id = "{}.{}".format(component, value.value_id)
@asyncio.coroutine
def discover_device(component, device, dict_id):
+2 -1
View File
@@ -2,11 +2,12 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 40
PATCH_VERSION = '0'
PATCH_VERSION = '2'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 4, 2)
REQUIRED_PYTHON_VER_WIN = (3, 5, 2)
CONSTRAINT_FILE = 'package_constraints.txt'
PROJECT_NAME = 'Home Assistant'
PROJECT_PACKAGE_NAME = 'homeassistant'
+9
View File
@@ -0,0 +1,9 @@
requests>=2,<3
pyyaml>=3.11,<4
pytz>=2016.10
pip>=7.1.0
jinja2>=2.9.5
voluptuous==0.9.3
typing>=3,<4
aiohttp==1.3.3
async_timeout==1.1.0
+7 -2
View File
@@ -2,6 +2,7 @@
import asyncio
import logging
import logging.handlers
import os
from types import ModuleType
from typing import Optional, Dict
@@ -12,7 +13,8 @@ import homeassistant.core as core
import homeassistant.loader as loader
import homeassistant.util.package as pkg_util
from homeassistant.util.async import run_coroutine_threadsafe
from homeassistant.const import EVENT_COMPONENT_LOADED, PLATFORM_FORMAT
from homeassistant.const import (
EVENT_COMPONENT_LOADED, PLATFORM_FORMAT, CONSTRAINT_FILE)
_LOGGER = logging.getLogger(__name__)
@@ -74,7 +76,10 @@ def _async_process_requirements(hass: core.HomeAssistant, name: str,
def pip_install(mod):
"""Install packages."""
return pkg_util.install_package(mod, target=hass.config.path('deps'))
return pkg_util.install_package(
mod, target=hass.config.path('deps'),
constraints=os.path.join(os.path.dirname(__file__),
CONSTRAINT_FILE))
with (yield from pip_lock):
for req in requirements:
+5 -1
View File
@@ -15,7 +15,8 @@ INSTALL_LOCK = threading.Lock()
def install_package(package: str, upgrade: bool=True,
target: Optional[str]=None) -> bool:
target: Optional[str]=None,
constraints: Optional[str]=None) -> bool:
"""Install a package on PyPi. Accepts pip compatible package strings.
Return boolean if install successful.
@@ -32,6 +33,9 @@ def install_package(package: str, upgrade: bool=True,
if target:
args += ['--target', os.path.abspath(target)]
if constraints is not None:
args += ['--constraint', constraints]
try:
return subprocess.call(args) == 0
except subprocess.SubprocessError:
+3 -3
View File
@@ -2,7 +2,7 @@
requests>=2,<3
pyyaml>=3.11,<4
pytz>=2016.10
pip>=7.0.0
pip>=7.1.0
jinja2>=2.9.5
voluptuous==0.9.3
typing>=3,<4
@@ -266,7 +266,7 @@ https://github.com/molobrakos/python-pocketcasts/archive/9f61ff00c77c7c98ffa0af9
https://github.com/mweinelt/anel-pwrctrl/archive/ed26e8830e28a2bfa4260a9002db23ce3e7e63d7.zip#anel_pwrctrl==0.0.1
# homeassistant.components.ecobee
https://github.com/nkgilley/python-ecobee-api/archive/4856a704670c53afe1882178a89c209b5f98533d.zip#python-ecobee==0.0.6
https://github.com/nkgilley/python-ecobee-api/archive/a4496b293956b2eac285305136a62ac78bef510d.zip#python-ecobee==0.0.7
# homeassistant.components.joaoapps_join
# homeassistant.components.notify.joaoapps_join
@@ -467,7 +467,7 @@ pybbox==0.0.5-alpha
# pybluez==0.22
# homeassistant.components.media_player.cast
pychromecast==0.8.0
pychromecast==0.8.1
# homeassistant.components.media_player.cmus
pycmus==0.1.0
+41 -10
View File
@@ -34,6 +34,10 @@ URL_PIN = ('https://home-assistant.io/developers/code_review_platform/'
'#1-requirements')
CONSTRAINT_PATH = os.path.join(os.path.dirname(__file__),
'../homeassistant/package_constraints.txt')
def explore_module(package, explore_children):
"""Explore the modules."""
module = importlib.import_module(package)
@@ -118,18 +122,35 @@ def gather_modules():
return ''.join(output)
def write_file(data):
def gather_constraints():
"""Construct output for constraint file."""
return '\n'.join(core_requirements() + [''])
def write_requirements_file(data):
"""Write the modules to the requirements_all.txt."""
with open('requirements_all.txt', 'w+') as req_file:
req_file.write(data)
def validate_file(data):
def write_constraints_file(data):
"""Write constraints to a file."""
with open(CONSTRAINT_PATH, 'w+', newline="\n") as req_file:
req_file.write(data)
def validate_requirements_file(data):
"""Validate if requirements_all.txt is up to date."""
with open('requirements_all.txt', 'r') as req_file:
return data == ''.join(req_file)
def validate_constraints_file(data):
"""Validate if constraints is up to date."""
with open(CONSTRAINT_PATH, 'r') as req_file:
return data == ''.join(req_file)
def main():
"""Main section of the script."""
if not os.path.isfile('requirements_all.txt'):
@@ -141,15 +162,25 @@ def main():
if data is None:
sys.exit(1)
if sys.argv[-1] == 'validate':
if validate_file(data):
sys.exit(0)
print("******* ERROR")
print("requirements_all.txt is not up to date")
print("Please run script/gen_requirements_all.py")
sys.exit(1)
constraints = gather_constraints()
write_file(data)
if sys.argv[-1] == 'validate':
if not validate_requirements_file(data):
print("******* ERROR")
print("requirements_all.txt is not up to date")
print("Please run script/gen_requirements_all.py")
sys.exit(1)
if not validate_constraints_file(constraints):
print("******* ERROR")
print("home-assistant/package_constraints.txt is not up to date")
print("Please run script/gen_requirements_all.py")
sys.exit(1)
sys.exit(0)
write_requirements_file(data)
write_constraints_file(constraints)
if __name__ == '__main__':
+1 -1
View File
@@ -18,7 +18,7 @@ REQUIRES = [
'requests>=2,<3',
'pyyaml>=3.11,<4',
'pytz>=2016.10',
'pip>=7.0.0',
'pip>=7.1.0',
'jinja2>=2.9.5',
'voluptuous==0.9.3',
'typing>=3,<4',
-29
View File
@@ -154,35 +154,6 @@ def test_default_setup(hass, monkeypatch):
assert protocol.send_command_ack.call_args_list[5][0][1] == '7'
@asyncio.coroutine
def test_new_light_group(hass, monkeypatch):
"""New devices should be added to configured group."""
config = {
'rflink': {
'port': '/dev/ttyABC0',
},
DOMAIN: {
'platform': 'rflink',
'new_devices_group': 'new_rflink_lights',
},
}
# setup mocking rflink module
event_callback, _, _, _ = yield from mock_rflink(
hass, config, DOMAIN, monkeypatch)
# test event for new unconfigured sensor
event_callback({
'id': 'protocol_0_0',
'command': 'off',
})
yield from hass.async_block_till_done()
# make sure new device is added to correct group
group = hass.states.get('group.new_rflink_lights')
assert group.attributes.get('entity_id') == ('light.protocol_0_0',)
@asyncio.coroutine
def test_firing_bus_event(hass, monkeypatch):
"""Incoming Rflink command events should be put on the HA event bus."""
-31
View File
@@ -70,34 +70,3 @@ def test_default_setup(hass, monkeypatch):
assert new_sensor.state == '0'
assert new_sensor.attributes['unit_of_measurement'] == '°C'
assert new_sensor.attributes['icon'] == 'mdi:thermometer'
@asyncio.coroutine
def test_new_sensors_group(hass, monkeypatch):
"""New devices should be added to configured group."""
config = {
'rflink': {
'port': '/dev/ttyABC0',
},
DOMAIN: {
'platform': 'rflink',
'new_devices_group': 'new_rflink_sensors',
},
}
# setup mocking rflink module
event_callback, _, _, _ = yield from mock_rflink(
hass, config, DOMAIN, monkeypatch)
# test event for new unconfigured sensor
event_callback({
'id': 'test',
'sensor': 'temperature',
'value': 0,
'unit': '°C',
})
yield from hass.async_block_till_done()
# make sure new device is added to correct group
group = hass.states.get('group.new_rflink_sensors')
assert group.attributes.get('entity_id') == ('sensor.test',)