Remove unnecessary top-level TCP component. Fix order of inheritance on TCP BinarySensor.
This commit is contained in:
parent
348b7abe7d
commit
c1d39a2fce
3 changed files with 16 additions and 33 deletions
|
@ -6,8 +6,7 @@ Provides a binary_sensor which gets its values from a TCP socket.
|
|||
import logging
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorDevice
|
||||
from homeassistant.components.tcp import DOMAIN, CONF_VALUE_ON
|
||||
from homeassistant.components.sensor.tcp import Sensor
|
||||
from homeassistant.components.sensor.tcp import Sensor, DOMAIN, CONF_VALUE_ON
|
||||
|
||||
|
||||
DEPENDENCIES = [DOMAIN]
|
||||
|
@ -22,7 +21,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
add_entities((BinarySensor(hass, config),))
|
||||
|
||||
|
||||
class BinarySensor(Sensor, BinarySensorDevice):
|
||||
class BinarySensor(BinarySensorDevice, Sensor):
|
||||
""" A binary sensor which is on when its state == CONF_VALUE_ON. """
|
||||
required = (CONF_VALUE_ON,)
|
||||
|
||||
|
|
|
@ -11,14 +11,22 @@ from homeassistant.const import CONF_NAME, CONF_HOST
|
|||
from homeassistant.util import template
|
||||
from homeassistant.exceptions import TemplateError
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.components.tcp import (
|
||||
DOMAIN, CONF_PORT, CONF_TIMEOUT, CONF_PAYLOAD, CONF_UNIT, CONF_VALUE_REGEX,
|
||||
CONF_VALUE_TEMPLATE, CONF_VALUE_ON, CONF_BUFFER_SIZE, DEFAULT_TIMEOUT,
|
||||
DEFAULT_BUFFER_SIZE
|
||||
)
|
||||
|
||||
|
||||
DEPENDENCIES = [DOMAIN]
|
||||
# DEPENDENCIES = [DOMAIN]
|
||||
|
||||
DOMAIN = "tcp"
|
||||
|
||||
CONF_PORT = "port"
|
||||
CONF_TIMEOUT = "timeout"
|
||||
CONF_PAYLOAD = "payload"
|
||||
CONF_UNIT = "unit"
|
||||
CONF_VALUE_TEMPLATE = "value_template"
|
||||
CONF_VALUE_ON = "value_on"
|
||||
CONF_BUFFER_SIZE = "buffer_size"
|
||||
|
||||
DEFAULT_TIMEOUT = 10
|
||||
DEFAULT_BUFFER_SIZE = 1024
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -44,7 +52,6 @@ class Sensor(Entity):
|
|||
CONF_TIMEOUT: config.get(CONF_TIMEOUT, DEFAULT_TIMEOUT),
|
||||
CONF_PAYLOAD: config[CONF_PAYLOAD],
|
||||
CONF_UNIT: config.get(CONF_UNIT),
|
||||
CONF_VALUE_REGEX: config.get(CONF_VALUE_REGEX),
|
||||
CONF_VALUE_TEMPLATE: config.get(CONF_VALUE_TEMPLATE),
|
||||
CONF_VALUE_ON: config.get(CONF_VALUE_ON),
|
||||
CONF_BUFFER_SIZE: config.get(
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
"""
|
||||
homeassistant.components.tcp
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
A generic TCP socket component.
|
||||
"""
|
||||
DOMAIN = "tcp"
|
||||
|
||||
CONF_PORT = "port"
|
||||
CONF_TIMEOUT = "timeout"
|
||||
CONF_PAYLOAD = "payload"
|
||||
CONF_UNIT = "unit"
|
||||
CONF_VALUE_REGEX = "value_regex"
|
||||
CONF_VALUE_TEMPLATE = "value_template"
|
||||
CONF_VALUE_ON = "value_on"
|
||||
CONF_BUFFER_SIZE = "buffer_size"
|
||||
|
||||
DEFAULT_TIMEOUT = 10
|
||||
DEFAULT_BUFFER_SIZE = 1024
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
""" Nothing to do! """
|
||||
return True
|
Loading…
Add table
Add a link
Reference in a new issue