Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97a87b2e4e | |||
| 737c7e871d | |||
| 1f3e4c5776 | |||
| 00d01865cf | |||
| 1b4905ae5a | |||
| 39749952ee | |||
| ac4d5d7c30 | |||
| f3e8e34089 | |||
| eae6d1c7a6 | |||
| a121c92f52 | |||
| 4d6f21ecb2 | |||
| 1638d0a92f | |||
| c031fd4164 | |||
| 5f0c37ccfc | |||
| e412317194 | |||
| 44341a958a | |||
| 5a555102b9 | |||
| aebe6ab70c | |||
| 48c9758cf5 | |||
| 279470613c |
@@ -0,0 +1,41 @@
|
||||
workflow "Python 3.7 - tox" {
|
||||
resolves = ["Python 3.7 - tests"]
|
||||
on = "push"
|
||||
}
|
||||
|
||||
action "Python 3.7 - tests" {
|
||||
uses = "home-assistant/actions/py37-tox@master"
|
||||
args = "-e py37"
|
||||
}
|
||||
|
||||
workflow "Python 3.6 - tox" {
|
||||
resolves = ["Python 3.6 - tests"]
|
||||
on = "push"
|
||||
}
|
||||
|
||||
action "Python 3.6 - tests" {
|
||||
uses = "home-assistant/actions/py36-tox@master"
|
||||
args = "-e py36"
|
||||
}
|
||||
|
||||
workflow "Python 3.5 - tox" {
|
||||
resolves = ["Pyton 3.5 - typing"]
|
||||
on = "push"
|
||||
}
|
||||
|
||||
action "Python 3.5 - tests" {
|
||||
uses = "home-assistant/actions/py35-tox@master"
|
||||
args = "-e py35"
|
||||
}
|
||||
|
||||
action "Python 3.5 - lints" {
|
||||
uses = "home-assistant/actions/py35-tox@master"
|
||||
needs = ["Python 3.5 - tests"]
|
||||
args = "-e lint"
|
||||
}
|
||||
|
||||
action "Pyton 3.5 - typing" {
|
||||
uses = "home-assistant/actions/py35-tox@master"
|
||||
args = "-e typing"
|
||||
needs = ["Python 3.5 - lints"]
|
||||
}
|
||||
@@ -119,6 +119,17 @@ class TodSensor(BinarySensorDevice):
|
||||
self.hass.config.time_zone).isoformat(),
|
||||
}
|
||||
|
||||
def _naive_time_to_utc_datetime(self, naive_time):
|
||||
"""Convert naive time from config to utc_datetime with current day."""
|
||||
# get the current local date from utc time
|
||||
current_local_date = self.current_datetime.astimezone(
|
||||
self.hass.config.time_zone).date()
|
||||
# calcuate utc datetime corecponding to local time
|
||||
utc_datetime = self.hass.config.time_zone.localize(
|
||||
datetime.combine(
|
||||
current_local_date, naive_time)).astimezone(tz=pytz.UTC)
|
||||
return utc_datetime
|
||||
|
||||
def _calculate_initial_boudary_time(self):
|
||||
"""Calculate internal absolute time boudaries."""
|
||||
nowutc = self.current_datetime
|
||||
@@ -134,9 +145,7 @@ class TodSensor(BinarySensorDevice):
|
||||
# datetime.combine(date, time, tzinfo) is not supported
|
||||
# in python 3.5. The self._after is provided
|
||||
# with hass configured TZ not system wide
|
||||
after_event_date = datetime.combine(
|
||||
nowutc, self._after.replace(
|
||||
tzinfo=self.hass.config.time_zone)).astimezone(tz=pytz.UTC)
|
||||
after_event_date = self._naive_time_to_utc_datetime(self._after)
|
||||
|
||||
self._time_after = after_event_date
|
||||
|
||||
@@ -154,9 +163,7 @@ class TodSensor(BinarySensorDevice):
|
||||
self.hass, self._before, after_event_date)
|
||||
else:
|
||||
# Convert local time provided to UTC today, see above
|
||||
before_event_date = datetime.combine(
|
||||
nowutc, self._before.replace(
|
||||
tzinfo=self.hass.config.time_zone)).astimezone(tz=pytz.UTC)
|
||||
before_event_date = self._naive_time_to_utc_datetime(self._before)
|
||||
|
||||
# It is safe to add timedelta days=1 to UTC as there is no DST
|
||||
if before_event_date < after_event_date + self._after_offset:
|
||||
@@ -190,7 +197,6 @@ class TodSensor(BinarySensorDevice):
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Call when entity about to be added to Home Assistant."""
|
||||
await super().async_added_to_hass()
|
||||
self._calculate_initial_boudary_time()
|
||||
self._calculate_next_update()
|
||||
self._point_in_time_listener(dt_util.now())
|
||||
|
||||
@@ -10,7 +10,7 @@ from homeassistant.const import (
|
||||
CONF_BINARY_SENSORS, CONF_SENSORS, CONF_FILENAME,
|
||||
CONF_MONITORED_CONDITIONS, TEMP_FAHRENHEIT)
|
||||
|
||||
REQUIREMENTS = ['blinkpy==0.12.1']
|
||||
REQUIREMENTS = ['blinkpy==0.13.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -44,7 +44,7 @@ BINARY_SENSORS = {
|
||||
SENSORS = {
|
||||
TYPE_TEMPERATURE: ['Temperature', TEMP_FAHRENHEIT, 'mdi:thermometer'],
|
||||
TYPE_BATTERY: ['Battery', '%', 'mdi:battery-80'],
|
||||
TYPE_WIFI_STRENGTH: ['Wifi Signal', 'bars', 'mdi:wifi-strength-2'],
|
||||
TYPE_WIFI_STRENGTH: ['Wifi Signal', 'dBm', 'mdi:wifi-strength-2'],
|
||||
}
|
||||
|
||||
BINARY_SENSOR_SCHEMA = vol.Schema({
|
||||
|
||||
@@ -21,7 +21,7 @@ from homeassistant.loader import bind_hass
|
||||
|
||||
from .storage import async_setup_frontend_storage
|
||||
|
||||
REQUIREMENTS = ['home-assistant-frontend==20190305.0']
|
||||
REQUIREMENTS = ['home-assistant-frontend==20190305.1']
|
||||
|
||||
DOMAIN = 'frontend'
|
||||
DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log',
|
||||
|
||||
@@ -60,11 +60,14 @@ async def async_setup_entry(hass, entry):
|
||||
# Register hap as device in registry.
|
||||
device_registry = await dr.async_get_registry(hass)
|
||||
home = hap.home
|
||||
# Add the HAP name from configuration if set.
|
||||
hapname = home.label \
|
||||
if not home.name else "{} {}".format(home.label, home.name)
|
||||
device_registry.async_get_or_create(
|
||||
config_entry_id=home.id,
|
||||
identifiers={(DOMAIN, home.id)},
|
||||
manufacturer='eQ-3',
|
||||
name=home.label,
|
||||
name=hapname,
|
||||
model=home.modelType,
|
||||
sw_version=home.currentAPVersion,
|
||||
)
|
||||
|
||||
@@ -4,6 +4,8 @@ import logging
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud.device import (
|
||||
ATTR_GROUP_MEMBER_UNREACHABLE)
|
||||
|
||||
DEPENDENCIES = ['homematicip_cloud']
|
||||
|
||||
@@ -31,8 +33,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
AsyncWaterSensor, AsyncRotaryHandleSensor,
|
||||
AsyncMotionDetectorPushButton)
|
||||
|
||||
from homematicip.group import (
|
||||
SecurityGroup, SecurityZoneGroup)
|
||||
from homematicip.aio.group import (
|
||||
AsyncSecurityGroup, AsyncSecurityZoneGroup)
|
||||
|
||||
home = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]].home
|
||||
devices = []
|
||||
@@ -48,9 +50,9 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
devices.append(HomematicipWaterDetector(home, device))
|
||||
|
||||
for group in home.groups:
|
||||
if isinstance(group, SecurityGroup):
|
||||
if isinstance(group, AsyncSecurityGroup):
|
||||
devices.append(HomematicipSecuritySensorGroup(home, group))
|
||||
elif isinstance(group, SecurityZoneGroup):
|
||||
elif isinstance(group, AsyncSecurityZoneGroup):
|
||||
devices.append(HomematicipSecurityZoneSensorGroup(home, group))
|
||||
|
||||
if devices:
|
||||
@@ -137,27 +139,37 @@ class HomematicipSecurityZoneSensorGroup(HomematicipGenericDevice,
|
||||
"""Return the class of this sensor."""
|
||||
return 'safety'
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Security-Group available."""
|
||||
# A security-group must be available, and should not be affected by
|
||||
# the individual availability of group members.
|
||||
return True
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the security zone group."""
|
||||
attr = super().device_state_attributes
|
||||
|
||||
if self._device.motionDetected:
|
||||
attr.update({ATTR_MOTIONDETECTED: True})
|
||||
attr[ATTR_MOTIONDETECTED] = True
|
||||
if self._device.presenceDetected:
|
||||
attr.update({ATTR_PRESENCEDETECTED: True})
|
||||
attr[ATTR_PRESENCEDETECTED] = True
|
||||
from homematicip.base.enums import WindowState
|
||||
if self._device.windowState is not None and \
|
||||
self._device.windowState != WindowState.CLOSED:
|
||||
attr.update({ATTR_WINDOWSTATE: str(self._device.windowState)})
|
||||
|
||||
attr[ATTR_WINDOWSTATE] = str(self._device.windowState)
|
||||
if self._device.unreach:
|
||||
attr[ATTR_GROUP_MEMBER_UNREACHABLE] = True
|
||||
return attr
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if security issue detected."""
|
||||
if self._device.motionDetected or \
|
||||
self._device.presenceDetected:
|
||||
self._device.presenceDetected or \
|
||||
self._device.unreach or \
|
||||
self._device.sabotage:
|
||||
return True
|
||||
from homematicip.base.enums import WindowState
|
||||
if self._device.windowState is not None and \
|
||||
@@ -180,29 +192,30 @@ class HomematicipSecuritySensorGroup(HomematicipSecurityZoneSensorGroup,
|
||||
attr = super().device_state_attributes
|
||||
|
||||
if self._device.powerMainsFailure:
|
||||
attr.update({ATTR_POWERMAINSFAILURE: True})
|
||||
attr[ATTR_POWERMAINSFAILURE] = True
|
||||
if self._device.moistureDetected:
|
||||
attr.update({ATTR_MOISTUREDETECTED: True})
|
||||
attr[ATTR_MOISTUREDETECTED] = True
|
||||
if self._device.waterlevelDetected:
|
||||
attr.update({ATTR_WATERLEVELDETECTED: True})
|
||||
attr[ATTR_WATERLEVELDETECTED] = True
|
||||
from homematicip.base.enums import SmokeDetectorAlarmType
|
||||
if self._device.smokeDetectorAlarmType is not None and \
|
||||
self._device.smokeDetectorAlarmType != \
|
||||
SmokeDetectorAlarmType.IDLE_OFF:
|
||||
attr.update({ATTR_SMOKEDETECTORALARM: str(
|
||||
self._device.smokeDetectorAlarmType)})
|
||||
attr[ATTR_SMOKEDETECTORALARM] = \
|
||||
str(self._device.smokeDetectorAlarmType)
|
||||
|
||||
return attr
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if security issue detected."""
|
||||
"""Return true if safety issue detected."""
|
||||
parent_is_on = super().is_on
|
||||
from homematicip.base.enums import SmokeDetectorAlarmType
|
||||
if parent_is_on or \
|
||||
self._device.powerMainsFailure or \
|
||||
self._device.moistureDetected or \
|
||||
self._device.waterlevelDetected:
|
||||
self._device.waterlevelDetected or \
|
||||
self._device.lowBat:
|
||||
return True
|
||||
if self._device.smokeDetectorAlarmType is not None and \
|
||||
self._device.smokeDetectorAlarmType != \
|
||||
|
||||
@@ -21,6 +21,7 @@ ATTR_OPERATION_LOCK = 'operation_lock'
|
||||
ATTR_SABOTAGE = 'sabotage'
|
||||
ATTR_STATUS_UPDATE = 'status_update'
|
||||
ATTR_UNREACHABLE = 'unreachable'
|
||||
ATTR_GROUP_MEMBER_UNREACHABLE = 'group_member_unreachable'
|
||||
|
||||
|
||||
class HomematicipGenericDevice(Entity):
|
||||
|
||||
@@ -3,6 +3,8 @@ import logging
|
||||
|
||||
from homeassistant.components.homematicip_cloud import (
|
||||
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
|
||||
from homeassistant.components.homematicip_cloud.device import (
|
||||
ATTR_GROUP_MEMBER_UNREACHABLE)
|
||||
from homeassistant.components.switch import SwitchDevice
|
||||
|
||||
DEPENDENCIES = ['homematicip_cloud']
|
||||
@@ -30,7 +32,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
AsyncOpenCollector8Module,
|
||||
)
|
||||
|
||||
from homematicip.group import SwitchingGroup
|
||||
from homematicip.aio.group import AsyncSwitchingGroup
|
||||
|
||||
home = hass.data[HMIPC_DOMAIN][config_entry.data[HMIPC_HAPID]].home
|
||||
devices = []
|
||||
@@ -50,7 +52,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
devices.append(HomematicipMultiSwitch(home, device, channel))
|
||||
|
||||
for group in home.groups:
|
||||
if isinstance(group, SwitchingGroup):
|
||||
if isinstance(group, AsyncSwitchingGroup):
|
||||
devices.append(
|
||||
HomematicipGroupSwitch(home, group))
|
||||
|
||||
@@ -92,6 +94,23 @@ class HomematicipGroupSwitch(HomematicipGenericDevice, SwitchDevice):
|
||||
"""Return true if group is on."""
|
||||
return self._device.on
|
||||
|
||||
@property
|
||||
def available(self):
|
||||
"""Switch-Group available."""
|
||||
# A switch-group must be available, and should not be affected by the
|
||||
# individual availability of group members.
|
||||
# This allows switching even when individual group members
|
||||
# are not available.
|
||||
return True
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the switch-group."""
|
||||
attr = {}
|
||||
if self._device.unreach:
|
||||
attr[ATTR_GROUP_MEMBER_UNREACHABLE] = True
|
||||
return attr
|
||||
|
||||
async def async_turn_on(self, **kwargs):
|
||||
"""Turn the group on."""
|
||||
await self._device.turn_on()
|
||||
|
||||
@@ -211,6 +211,14 @@ class HomeAssistantHTTP:
|
||||
"legacy_api_password support has been enabled. If you don't "
|
||||
"require it, remove the 'api_password' from your http config.")
|
||||
|
||||
for prv in hass.auth.auth_providers:
|
||||
if prv.type == 'trusted_networks':
|
||||
# auth_provider.trusted_networks will override
|
||||
# http.trusted_networks, http.trusted_networks will be
|
||||
# removed from future release
|
||||
trusted_networks = prv.trusted_networks
|
||||
break
|
||||
|
||||
setup_auth(app, trusted_networks,
|
||||
api_password if hass.auth.support_legacy else None)
|
||||
|
||||
|
||||
@@ -186,10 +186,13 @@ class NeatoConnectedVacuum(StateVacuumDevice):
|
||||
self._battery_level = self._state['details']['charge']
|
||||
|
||||
if self._robot_has_map:
|
||||
robot_map_id = self._robot_maps[self._robot_serial][0]['id']
|
||||
if self._state['availableServices']['maps'] != "basic-1":
|
||||
if self._robot_maps[self._robot_serial]:
|
||||
robot_map_id = (
|
||||
self._robot_maps[self._robot_serial][0]['id'])
|
||||
|
||||
self._robot_boundaries = self.robot.get_map_boundaries(
|
||||
robot_map_id).json()
|
||||
self._robot_boundaries = self.robot.get_map_boundaries(
|
||||
robot_map_id).json()
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
@@ -67,7 +67,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
}))
|
||||
})
|
||||
|
||||
TRACKABLE_DOMAINS = ['device_tracker', 'sensor', 'zone']
|
||||
TRACKABLE_DOMAINS = ['device_tracker', 'sensor', 'zone', 'person']
|
||||
DATA_KEY = 'google_travel_time'
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ from .smartapp import (
|
||||
setup_smartapp, setup_smartapp_endpoint, smartapp_sync_subscriptions,
|
||||
validate_installed_app)
|
||||
|
||||
REQUIREMENTS = ['pysmartapp==0.3.0', 'pysmartthings==0.6.3']
|
||||
REQUIREMENTS = ['pysmartapp==0.3.1', 'pysmartthings==0.6.7']
|
||||
DEPENDENCIES = ['webhook']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -290,7 +290,8 @@ class DeviceBroker:
|
||||
if not device:
|
||||
continue
|
||||
device.status.apply_attribute_update(
|
||||
evt.component_id, evt.capability, evt.attribute, evt.value)
|
||||
evt.component_id, evt.capability, evt.attribute, evt.value,
|
||||
data=evt.data)
|
||||
|
||||
# Fire events for buttons
|
||||
if evt.capability == Capability.button and \
|
||||
@@ -300,7 +301,8 @@ class DeviceBroker:
|
||||
'device_id': evt.device_id,
|
||||
'location_id': evt.location_id,
|
||||
'value': evt.value,
|
||||
'name': device.label
|
||||
'name': device.label,
|
||||
'data': evt.data
|
||||
}
|
||||
self._hass.bus.async_fire(EVENT_BUTTON, data)
|
||||
_LOGGER.debug("Fired button event: %s", data)
|
||||
@@ -312,6 +314,7 @@ class DeviceBroker:
|
||||
'capability': evt.capability,
|
||||
'attribute': evt.attribute,
|
||||
'value': evt.value,
|
||||
'data': evt.data
|
||||
}
|
||||
_LOGGER.debug("Push update received: %s", data)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||
TEMP_FAHRENHEIT)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['pyeconet==0.0.8']
|
||||
REQUIREMENTS = ['pyeconet==0.0.9']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from homeassistant.components.media_player.const import (
|
||||
MEDIA_TYPE_CHANNEL, SUPPORT_NEXT_TRACK, SUPPORT_PAUSE,
|
||||
SUPPORT_PLAY, SUPPORT_PLAY_MEDIA, SUPPORT_PREVIOUS_TRACK,
|
||||
SUPPORT_SELECT_SOURCE, SUPPORT_TURN_OFF, SUPPORT_TURN_ON,
|
||||
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_STEP)
|
||||
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_SET, SUPPORT_VOLUME_STEP)
|
||||
from homeassistant.const import (
|
||||
CONF_CUSTOMIZE, CONF_FILENAME, CONF_HOST, CONF_NAME, CONF_TIMEOUT,
|
||||
STATE_OFF, STATE_PAUSED, STATE_PLAYING)
|
||||
@@ -36,7 +36,7 @@ WEBOSTV_CONFIG_FILE = 'webostv.conf'
|
||||
|
||||
SUPPORT_WEBOSTV = SUPPORT_TURN_OFF | \
|
||||
SUPPORT_NEXT_TRACK | SUPPORT_PAUSE | SUPPORT_PREVIOUS_TRACK | \
|
||||
SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_STEP | \
|
||||
SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_STEP | \
|
||||
SUPPORT_SELECT_SOURCE | SUPPORT_PLAY_MEDIA | SUPPORT_PLAY
|
||||
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
||||
|
||||
@@ -16,7 +16,7 @@ from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import async_track_point_in_utc_time
|
||||
from homeassistant.util.dt import utcnow
|
||||
|
||||
REQUIREMENTS = ['PyXiaomiGateway==0.12.0']
|
||||
REQUIREMENTS = ['PyXiaomiGateway==0.12.2']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"""Constants used by Home Assistant components."""
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 89
|
||||
PATCH_VERSION = '0'
|
||||
PATCH_VERSION = '2'
|
||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||
REQUIRED_PYTHON_VER = (3, 5, 3)
|
||||
|
||||
@@ -52,15 +52,10 @@ def run(args: List) -> int:
|
||||
hass = HomeAssistant(loop)
|
||||
pkgload = PackageLoadable(hass)
|
||||
for req in getattr(script, 'REQUIREMENTS', []):
|
||||
try:
|
||||
loop.run_until_complete(pkgload.loadable(req))
|
||||
if loop.run_until_complete(pkgload.loadable(req)):
|
||||
continue
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
returncode = install_package(req, **_pip_kwargs)
|
||||
|
||||
if not returncode:
|
||||
if not install_package(req, **_pip_kwargs):
|
||||
print('Aborting script, could not install dependency', req)
|
||||
return 1
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ PyRMVtransport==0.1.3
|
||||
PyTransportNSW==0.1.1
|
||||
|
||||
# homeassistant.components.xiaomi_aqara
|
||||
PyXiaomiGateway==0.12.0
|
||||
PyXiaomiGateway==0.12.2
|
||||
|
||||
# homeassistant.components.rpi_gpio
|
||||
# RPi.GPIO==0.6.5
|
||||
@@ -206,7 +206,7 @@ bellows-homeassistant==0.7.1
|
||||
bimmer_connected==0.5.3
|
||||
|
||||
# homeassistant.components.blink
|
||||
blinkpy==0.12.1
|
||||
blinkpy==0.13.1
|
||||
|
||||
# homeassistant.components.light.blinksticklight
|
||||
blinkstick==1.1.8
|
||||
@@ -539,7 +539,7 @@ hole==0.3.0
|
||||
holidays==0.9.9
|
||||
|
||||
# homeassistant.components.frontend
|
||||
home-assistant-frontend==20190305.0
|
||||
home-assistant-frontend==20190305.1
|
||||
|
||||
# homeassistant.components.zwave
|
||||
homeassistant-pyozw==0.1.2
|
||||
@@ -1004,7 +1004,7 @@ pydukeenergy==0.0.6
|
||||
pyebox==1.1.4
|
||||
|
||||
# homeassistant.components.water_heater.econet
|
||||
pyeconet==0.0.8
|
||||
pyeconet==0.0.9
|
||||
|
||||
# homeassistant.components.switch.edimax
|
||||
pyedimax==0.1
|
||||
@@ -1256,10 +1256,10 @@ pysher==1.0.1
|
||||
pysma==0.3.1
|
||||
|
||||
# homeassistant.components.smartthings
|
||||
pysmartapp==0.3.0
|
||||
pysmartapp==0.3.1
|
||||
|
||||
# homeassistant.components.smartthings
|
||||
pysmartthings==0.6.3
|
||||
pysmartthings==0.6.7
|
||||
|
||||
# homeassistant.components.device_tracker.snmp
|
||||
# homeassistant.components.sensor.snmp
|
||||
|
||||
@@ -120,7 +120,7 @@ hdate==0.8.7
|
||||
holidays==0.9.9
|
||||
|
||||
# homeassistant.components.frontend
|
||||
home-assistant-frontend==20190305.0
|
||||
home-assistant-frontend==20190305.1
|
||||
|
||||
# homeassistant.components.homekit_controller
|
||||
homekit==0.12.2
|
||||
@@ -224,10 +224,10 @@ pyps4-homeassistant==0.3.0
|
||||
pyqwikswitch==0.8
|
||||
|
||||
# homeassistant.components.smartthings
|
||||
pysmartapp==0.3.0
|
||||
pysmartapp==0.3.1
|
||||
|
||||
# homeassistant.components.smartthings
|
||||
pysmartthings==0.6.3
|
||||
pysmartthings==0.6.7
|
||||
|
||||
# homeassistant.components.sonos
|
||||
pysonos==0.0.8
|
||||
|
||||
@@ -110,8 +110,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_midnight_turnover_after_midnight_inside_period(self):
|
||||
"""Test midnight turnover setting before midnight inside period ."""
|
||||
test_time = datetime(
|
||||
2019, 1, 10, 21, 00, 0, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 21, 0, 0)).astimezone(pytz.UTC)
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
{
|
||||
@@ -143,8 +143,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_midnight_turnover_before_midnight_outside_period(self):
|
||||
"""Test midnight turnover setting before midnight outside period."""
|
||||
test_time = datetime(
|
||||
2019, 1, 10, 20, 30, 0, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 20, 30, 0)).astimezone(pytz.UTC)
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
{
|
||||
@@ -165,8 +165,9 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_midnight_turnover_after_midnight_outside_period(self):
|
||||
"""Test midnight turnover setting before midnight inside period ."""
|
||||
test_time = datetime(
|
||||
2019, 1, 10, 20, 0, 0, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 20, 0, 0)).astimezone(pytz.UTC)
|
||||
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
{
|
||||
@@ -185,8 +186,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
state = self.hass.states.get('binary_sensor.night')
|
||||
assert state.state == STATE_OFF
|
||||
|
||||
switchover_time = datetime(
|
||||
2019, 1, 11, 4, 59, 0, tzinfo=self.hass.config.time_zone)
|
||||
switchover_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 11, 4, 59, 0)).astimezone(pytz.UTC)
|
||||
with patch('homeassistant.components.binary_sensor.tod.dt_util.utcnow',
|
||||
return_value=switchover_time):
|
||||
|
||||
@@ -210,8 +211,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_from_sunrise_to_sunset(self):
|
||||
"""Test period from sunrise to sunset."""
|
||||
test_time = datetime(
|
||||
2019, 1, 12, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 12)).astimezone(pytz.UTC)
|
||||
sunrise = dt_util.as_local(get_astral_event_date(
|
||||
self.hass, 'sunrise', dt_util.as_utc(test_time)))
|
||||
sunset = dt_util.as_local(get_astral_event_date(
|
||||
@@ -299,8 +300,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_from_sunset_to_sunrise(self):
|
||||
"""Test period from sunset to sunrise."""
|
||||
test_time = datetime(
|
||||
2019, 1, 12, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 12)).astimezone(pytz.UTC)
|
||||
sunset = dt_util.as_local(get_astral_event_date(
|
||||
self.hass, 'sunset', test_time))
|
||||
sunrise = dt_util.as_local(get_astral_event_next(
|
||||
@@ -385,14 +386,14 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_offset(self):
|
||||
"""Test offset."""
|
||||
after = datetime(
|
||||
2019, 1, 10, 18, 0, 0,
|
||||
tzinfo=self.hass.config.time_zone) + \
|
||||
after = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 18, 0, 0)).astimezone(pytz.UTC) + \
|
||||
timedelta(hours=1, minutes=34)
|
||||
before = datetime(
|
||||
2019, 1, 10, 22, 0, 0,
|
||||
tzinfo=self.hass.config.time_zone) + \
|
||||
|
||||
before = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 22, 0, 0)).astimezone(pytz.UTC) + \
|
||||
timedelta(hours=1, minutes=45)
|
||||
|
||||
entity_id = 'binary_sensor.evening'
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
@@ -457,9 +458,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_offset_overnight(self):
|
||||
"""Test offset overnight."""
|
||||
after = datetime(
|
||||
2019, 1, 10, 18, 0, 0,
|
||||
tzinfo=self.hass.config.time_zone) + \
|
||||
after = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 10, 18, 0, 0)).astimezone(pytz.UTC) + \
|
||||
timedelta(hours=1, minutes=34)
|
||||
entity_id = 'binary_sensor.evening'
|
||||
config = {
|
||||
@@ -498,7 +498,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
self.hass.config.latitude = 69.6
|
||||
self.hass.config.longitude = 18.8
|
||||
|
||||
test_time = datetime(2010, 1, 1, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2010, 1, 1)).astimezone(pytz.UTC)
|
||||
sunrise = dt_util.as_local(get_astral_event_next(
|
||||
self.hass, 'sunrise', dt_util.as_utc(test_time)))
|
||||
sunset = dt_util.as_local(get_astral_event_next(
|
||||
@@ -600,13 +601,13 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
self.hass.config.latitude = 69.6
|
||||
self.hass.config.longitude = 18.8
|
||||
|
||||
test_time = datetime(2010, 6, 1, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2010, 6, 1)).astimezone(pytz.UTC)
|
||||
|
||||
sunrise = dt_util.as_local(get_astral_event_next(
|
||||
self.hass, 'sunrise', dt_util.as_utc(test_time)))
|
||||
sunset = dt_util.as_local(get_astral_event_next(
|
||||
self.hass, 'sunset', dt_util.as_utc(test_time)))
|
||||
print(sunrise)
|
||||
print(sunset)
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
{
|
||||
@@ -701,8 +702,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
|
||||
def test_sun_offset(self):
|
||||
"""Test sun event with offset."""
|
||||
test_time = datetime(
|
||||
2019, 1, 12, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 1, 12)).astimezone(pytz.UTC)
|
||||
sunrise = dt_util.as_local(get_astral_event_date(
|
||||
self.hass, 'sunrise', dt_util.as_utc(test_time)) +
|
||||
timedelta(hours=-1, minutes=-30))
|
||||
@@ -810,8 +811,8 @@ class TestBinarySensorTod(unittest.TestCase):
|
||||
def test_dst(self):
|
||||
"""Test sun event with offset."""
|
||||
self.hass.config.time_zone = pytz.timezone('CET')
|
||||
test_time = datetime(
|
||||
2019, 3, 30, 3, 0, 0, tzinfo=self.hass.config.time_zone)
|
||||
test_time = self.hass.config.time_zone.localize(
|
||||
datetime(2019, 3, 30, 3, 0, 0)).astimezone(pytz.UTC)
|
||||
config = {
|
||||
'binary_sensor': [
|
||||
{
|
||||
|
||||
@@ -326,7 +326,7 @@ def scene_fixture(scene_factory):
|
||||
def event_factory_fixture():
|
||||
"""Fixture for creating mock devices."""
|
||||
def _factory(device_id, event_type="DEVICE_EVENT", capability='',
|
||||
attribute='Updated', value='Value'):
|
||||
attribute='Updated', value='Value', data=None):
|
||||
event = Mock()
|
||||
event.event_type = event_type
|
||||
event.device_id = device_id
|
||||
@@ -334,6 +334,7 @@ def event_factory_fixture():
|
||||
event.capability = capability
|
||||
event.attribute = attribute
|
||||
event.value = value
|
||||
event.data = data
|
||||
event.location_id = str(uuid4())
|
||||
return event
|
||||
return _factory
|
||||
|
||||
@@ -235,16 +235,21 @@ async def test_broker_regenerates_token(
|
||||
|
||||
|
||||
async def test_event_handler_dispatches_updated_devices(
|
||||
hass, config_entry, device_factory, event_request_factory):
|
||||
hass, config_entry, device_factory, event_request_factory,
|
||||
event_factory):
|
||||
"""Test the event handler dispatches updated devices."""
|
||||
devices = [
|
||||
device_factory('Bedroom 1 Switch', ['switch']),
|
||||
device_factory('Bathroom 1', ['switch']),
|
||||
device_factory('Sensor', ['motionSensor']),
|
||||
device_factory('Lock', ['lock'])
|
||||
]
|
||||
device_ids = [devices[0].device_id, devices[1].device_id,
|
||||
devices[2].device_id]
|
||||
request = event_request_factory(device_ids)
|
||||
devices[2].device_id, devices[3].device_id]
|
||||
event = event_factory(devices[3].device_id, capability='lock',
|
||||
attribute='lock', value='locked',
|
||||
data={'codeId': '1'})
|
||||
request = event_request_factory(device_ids=device_ids, events=[event])
|
||||
config_entry.data[CONF_INSTALLED_APP_ID] = request.installed_app_id
|
||||
called = False
|
||||
|
||||
@@ -265,6 +270,8 @@ async def test_event_handler_dispatches_updated_devices(
|
||||
assert called
|
||||
for device in devices:
|
||||
assert device.status.values['Updated'] == 'Value'
|
||||
assert devices[3].status.attributes['lock'].value == 'locked'
|
||||
assert devices[3].status.attributes['lock'].data == {'codeId': '1'}
|
||||
|
||||
|
||||
async def test_event_handler_ignores_other_installed_app(
|
||||
@@ -308,7 +315,8 @@ async def test_event_handler_fires_button_events(
|
||||
'device_id': device.device_id,
|
||||
'location_id': event.location_id,
|
||||
'value': 'pushed',
|
||||
'name': device.label
|
||||
'name': device.label,
|
||||
'data': None
|
||||
}
|
||||
hass.bus.async_listen(EVENT_BUTTON, handler)
|
||||
broker = smartthings.DeviceBroker(
|
||||
|
||||
Reference in New Issue
Block a user