mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
commit
4b31a22a1c
@ -12,6 +12,7 @@ from datetime import timedelta
|
|||||||
|
|
||||||
from homeassistant.loader import get_component
|
from homeassistant.loader import get_component
|
||||||
from homeassistant.helpers import validate_config
|
from homeassistant.helpers import validate_config
|
||||||
|
from homeassistant.helpers.entity import _OVERWRITE
|
||||||
import homeassistant.util as util
|
import homeassistant.util as util
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
@ -162,9 +163,12 @@ class DeviceTracker(object):
|
|||||||
|
|
||||||
state = STATE_HOME if is_home else STATE_NOT_HOME
|
state = STATE_HOME if is_home else STATE_NOT_HOME
|
||||||
|
|
||||||
|
# overwrite properties that have been set in the config file
|
||||||
|
attr = dict(dev_info['state_attr'])
|
||||||
|
attr.update(_OVERWRITE.get(dev_info['entity_id'], {}))
|
||||||
|
|
||||||
self.hass.states.set(
|
self.hass.states.set(
|
||||||
dev_info['entity_id'], state,
|
dev_info['entity_id'], state, attr)
|
||||||
dev_info['state_attr'])
|
|
||||||
|
|
||||||
def update_devices(self, now):
|
def update_devices(self, now):
|
||||||
""" Update device states based on the found devices. """
|
""" Update device states based on the found devices. """
|
||||||
|
@ -156,6 +156,12 @@ class ISYDeviceABC(ToggleEntity):
|
|||||||
attr = {ATTR_FRIENDLY_NAME: self.name}
|
attr = {ATTR_FRIENDLY_NAME: self.name}
|
||||||
for name, prop in self._attrs.items():
|
for name, prop in self._attrs.items():
|
||||||
attr[name] = getattr(self, prop)
|
attr[name] = getattr(self, prop)
|
||||||
|
attr = self._attr_filter(attr)
|
||||||
|
return attr
|
||||||
|
|
||||||
|
def _attr_filter(self, attr):
|
||||||
|
""" Placeholder for attribute filters. """
|
||||||
|
# pylint: disable=no-self-use
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -38,3 +38,9 @@ class ISYLightDevice(ISYDeviceABC):
|
|||||||
_attrs = {ATTR_BRIGHTNESS: 'value'}
|
_attrs = {ATTR_BRIGHTNESS: 'value'}
|
||||||
_onattrs = [ATTR_BRIGHTNESS]
|
_onattrs = [ATTR_BRIGHTNESS]
|
||||||
_states = [STATE_ON, STATE_OFF]
|
_states = [STATE_ON, STATE_OFF]
|
||||||
|
|
||||||
|
def _attr_filter(self, attr):
|
||||||
|
""" Filter brightness out of entity while off. """
|
||||||
|
if ATTR_BRIGHTNESS in attr and not self.is_on:
|
||||||
|
del attr[ATTR_BRIGHTNESS]
|
||||||
|
return attr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user