mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
commit
1e28c752e1
@ -147,6 +147,11 @@ class NestActivityZoneSensor(NestBinarySensor):
|
||||
self.zone = zone
|
||||
self._name = "{} {} activity".format(self._name, self.zone.name)
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return unique id based on camera serial and zone id."""
|
||||
return "{}-{}".format(self.device.serial, self.zone.zone_id)
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the device class of the binary sensor."""
|
||||
|
@ -44,14 +44,15 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
ring = hass.data[DATA_RING]
|
||||
|
||||
sensors = []
|
||||
for sensor_type in config.get(CONF_MONITORED_CONDITIONS):
|
||||
for device in ring.doorbells:
|
||||
for device in ring.doorbells: # ring.doorbells is doing I/O
|
||||
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
|
||||
if 'doorbell' in SENSOR_TYPES[sensor_type][1]:
|
||||
sensors.append(RingBinarySensor(hass,
|
||||
device,
|
||||
sensor_type))
|
||||
|
||||
for device in ring.stickup_cams:
|
||||
for device in ring.stickup_cams: # ring.stickup_cams is doing I/O
|
||||
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
|
||||
if 'stickup_cams' in SENSOR_TYPES[sensor_type][1]:
|
||||
sensors.append(RingBinarySensor(hass,
|
||||
device,
|
||||
|
@ -31,12 +31,14 @@ class ISYLightDevice(ISYDevice, Light):
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Get whether the ISY994 light is on."""
|
||||
if self.is_unknown():
|
||||
return False
|
||||
return self.value != 0
|
||||
|
||||
@property
|
||||
def brightness(self) -> float:
|
||||
"""Get the brightness of the ISY994 light."""
|
||||
return self.value
|
||||
return None if self.is_unknown() else self.value
|
||||
|
||||
def turn_off(self, **kwargs) -> None:
|
||||
"""Send the turn off command to the ISY994 light device."""
|
||||
|
@ -10,6 +10,7 @@ import math
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.components import history
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.dt as dt_util
|
||||
@ -19,7 +20,7 @@ from homeassistant.const import (
|
||||
EVENT_HOMEASSISTANT_START)
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.event import track_state_change
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -94,8 +95,6 @@ class HistoryStatsSensor(Entity):
|
||||
self, hass, entity_id, entity_state, start, end, duration,
|
||||
sensor_type, name):
|
||||
"""Initialize the HistoryStats sensor."""
|
||||
self._hass = hass
|
||||
|
||||
self._entity_id = entity_id
|
||||
self._entity_state = entity_state
|
||||
self._duration = duration
|
||||
@ -109,15 +108,19 @@ class HistoryStatsSensor(Entity):
|
||||
self.value = None
|
||||
self.count = None
|
||||
|
||||
def force_refresh(*args):
|
||||
"""Force the component to refresh."""
|
||||
self.schedule_update_ha_state(True)
|
||||
@callback
|
||||
def start_refresh(*args):
|
||||
"""Register state tracking."""
|
||||
@callback
|
||||
def force_refresh(*args):
|
||||
"""Force the component to refresh."""
|
||||
self.async_schedule_update_ha_state(True)
|
||||
|
||||
# Update value when home assistant starts
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, force_refresh)
|
||||
force_refresh()
|
||||
async_track_state_change(self.hass, self._entity_id, force_refresh)
|
||||
|
||||
# Update value when tracked entity changes its state
|
||||
track_state_change(hass, entity_id, force_refresh)
|
||||
# Delay first refresh to keep startup fast
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, start_refresh)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -66,16 +66,18 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
ring = hass.data[DATA_RING]
|
||||
|
||||
sensors = []
|
||||
for sensor_type in config.get(CONF_MONITORED_CONDITIONS):
|
||||
for device in ring.chimes:
|
||||
for device in ring.chimes: # ring.chimes is doing I/O
|
||||
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
|
||||
if 'chime' in SENSOR_TYPES[sensor_type][1]:
|
||||
sensors.append(RingSensor(hass, device, sensor_type))
|
||||
|
||||
for device in ring.doorbells:
|
||||
for device in ring.doorbells: # ring.doorbells is doing I/O
|
||||
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
|
||||
if 'doorbell' in SENSOR_TYPES[sensor_type][1]:
|
||||
sensors.append(RingSensor(hass, device, sensor_type))
|
||||
|
||||
for device in ring.stickup_cams:
|
||||
for device in ring.stickup_cams: # ring.stickup_cams is doing I/O
|
||||
for sensor_type in config[CONF_MONITORED_CONDITIONS]:
|
||||
if 'stickup_cams' in SENSOR_TYPES[sensor_type][1]:
|
||||
sensors.append(RingSensor(hass, device, sensor_type))
|
||||
|
||||
|
@ -15,7 +15,7 @@ import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
REQUIREMENTS = ['zm-py==0.0.3']
|
||||
REQUIREMENTS = ['zm-py==0.0.4']
|
||||
|
||||
CONF_PATH_ZMS = 'path_zms'
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"""Constants used by Home Assistant components."""
|
||||
MAJOR_VERSION = 0
|
||||
MINOR_VERSION = 79
|
||||
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)
|
||||
|
@ -1567,4 +1567,4 @@ zigpy-xbee==0.1.1
|
||||
zigpy==0.2.0
|
||||
|
||||
# homeassistant.components.zoneminder
|
||||
zm-py==0.0.3
|
||||
zm-py==0.0.4
|
||||
|
Loading…
x
Reference in New Issue
Block a user