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