Moved card visibility logic out of the Entity class and into a VisibilityABC. Then made the Group class inherit the VisibilityABC. No duplication of code now. This is definitely better.

This commit is contained in:
Ryan Kraus 2015-04-22 21:21:50 -04:00
parent 8fcf814eb6
commit ff3dacedc0
3 changed files with 38 additions and 48 deletions

View file

@ -20,7 +20,7 @@ import homeassistant
import homeassistant.loader as loader
import homeassistant.components as core_components
import homeassistant.components.group as group
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import VisibilityABC
from homeassistant.const import (
EVENT_COMPONENT_LOADED, CONF_LATITUDE, CONF_LONGITUDE,
CONF_TEMPERATURE_UNIT, CONF_NAME, CONF_TIME_ZONE, TEMP_CELCIUS,
@ -208,7 +208,7 @@ def process_ha_core_config(hass, config):
if key in config:
setattr(hass.config, attr, config[key])
Entity.visibility.update(config.get('visibility', {}))
VisibilityABC.visibility.update(config.get('visibility', {}))
if CONF_TEMPERATURE_UNIT in config:
unit = config[CONF_TEMPERATURE_UNIT]