Migrate components to use EntityComponent

This commit is contained in:
Paulus Schoutsen 2015-03-21 19:37:18 -07:00
parent a9324ba9d4
commit bbfd97e2b8
7 changed files with 14 additions and 14 deletions

View file

@ -52,7 +52,7 @@ import logging
import os
import csv
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
import homeassistant.util as util
from homeassistant.const import (
@ -140,7 +140,7 @@ def turn_off(hass, entity_id=None, transition=None):
def setup(hass, config):
""" Exposes light control via statemachine and services. """
component = DeviceComponent(
component = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, DISCOVERY_PLATFORMS,
GROUP_NAME_ALL_LIGHTS)
component.setup(config)

View file

@ -8,7 +8,7 @@ import logging
from homeassistant.components import discovery
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.const import (
ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_VOLUME_UP,
SERVICE_VOLUME_DOWN, SERVICE_MEDIA_PLAY_PAUSE, SERVICE_MEDIA_PLAY,
@ -126,7 +126,7 @@ SERVICE_TO_METHOD = {
def setup(hass, config):
""" Track states and offer events for media_players. """
component = DeviceComponent(
component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL,
DISCOVERY_PLATFORMS)

View file

@ -20,7 +20,7 @@ from collections import namedtuple
from homeassistant import State
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.state import reproduce_state
from homeassistant.const import (
ATTR_ENTITY_ID, STATE_OFF, STATE_ON, SERVICE_TURN_ON, SERVICE_TURN_OFF)
@ -46,7 +46,7 @@ def setup(hass, config):
logger.error('Scene config should be a list of scenes')
return False
component = DeviceComponent(logger, DOMAIN, hass)
component = EntityComponent(logger, DOMAIN, hass)
component.add_entities(Scene(hass, _process_config(scene_config))
for scene_config in scene_configs)

View file

@ -5,7 +5,7 @@ Component to interface with various sensors that can be monitored.
"""
import logging
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.components import wink, zwave
DOMAIN = 'sensor'
@ -23,7 +23,7 @@ DISCOVERY_PLATFORMS = {
def setup(hass, config):
""" Track states and offer events for sensors. """
component = DeviceComponent(
component = EntityComponent(
logging.getLogger(__name__), DOMAIN, hass, SCAN_INTERVAL,
DISCOVERY_PLATFORMS)

View file

@ -6,7 +6,7 @@ Component to interface with various switches that can be controlled remotely.
import logging
from datetime import timedelta
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.const import (
STATE_ON, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
@ -58,7 +58,7 @@ def turn_off(hass, entity_id=None):
def setup(hass, config):
""" Track states and offer events for switches. """
component = DeviceComponent(
component = EntityComponent(
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, DISCOVERY_PLATFORMS,
GROUP_NAME_ALL_SWITCHES)
component.setup(config)

View file

@ -6,7 +6,7 @@ Provides functionality to interact with thermostats.
"""
import logging
from homeassistant.helpers.device_component import DeviceComponent
from homeassistant.helpers.entity_component import EntityComponent
import homeassistant.util as util
from homeassistant.helpers.entity import Entity
@ -52,7 +52,7 @@ def set_temperature(hass, temperature, entity_id=None):
def setup(hass, config):
""" Setup thermostats. """
component = DeviceComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
component.setup(config)
def thermostat_service(service):

View file

@ -7,7 +7,7 @@ Helper method for writing tests.
import os
import homeassistant as ha
from homeassistant.helpers.device import ToggleDevice
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import STATE_ON, STATE_OFF, DEVICE_DEFAULT_NAME
@ -42,7 +42,7 @@ class MockModule(object):
self.setup = lambda hass, config: False if setup is None else setup
class MockToggleDevice(ToggleDevice):
class MockToggleDevice(ToggleEntity):
""" Provides a mock toggle device. """
def __init__(self, name, state):
self._name = name or DEVICE_DEFAULT_NAME