Add docstrings, fix typos, and update docsstring for PEP257

This commit is contained in:
Fabian Affolter 2016-02-22 10:11:46 +01:00
parent 7a0c99a1d5
commit fd3ea95b82
15 changed files with 67 additions and 89 deletions

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Component to interface with binary sensors (sensors which only know two states) Component to interface with binary sensors (sensors which only know two states)
that can be monitored. that can be monitored.

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.apcupsd
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides a binary sensor to track online status of a UPS. Provides a binary sensor to track online status of a UPS.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -14,12 +12,12 @@ DEFAULT_NAME = "UPS Online Status"
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
""" Instantiate an OnlineStatus binary sensor entity and add it to HA. """ """Instantiate an OnlineStatus binary sensor entity."""
add_entities((OnlineStatus(config, apcupsd.DATA),)) add_entities((OnlineStatus(config, apcupsd.DATA),))
class OnlineStatus(BinarySensorDevice): class OnlineStatus(BinarySensorDevice):
""" Binary sensor to represent UPS online status. """ """Binary sensor to represent UPS online status."""
def __init__(self, config, data): def __init__(self, config, data):
self._config = config self._config = config
self._data = data self._data = data
@ -33,7 +31,7 @@ class OnlineStatus(BinarySensorDevice):
@property @property
def is_on(self): def is_on(self):
""" True if the UPS is online, else False. """ """True if the UPS is online, else False."""
return self._state == apcupsd.VALUE_ONLINE return self._state == apcupsd.VALUE_ONLINE
def update(self): def update(self):

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.arest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The arest sensor will consume an exposed aREST API of a device. The arest sensor will consume an exposed aREST API of a device.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -24,8 +22,7 @@ CONF_PIN = 'pin'
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Get the aREST binary sensor. """ """Get the aREST binary sensor."""
resource = config.get(CONF_RESOURCE) resource = config.get(CONF_RESOURCE)
pin = config.get(CONF_PIN) pin = config.get(CONF_PIN)
@ -56,7 +53,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-instance-attributes, too-many-arguments # pylint: disable=too-many-instance-attributes, too-many-arguments
class ArestBinarySensor(BinarySensorDevice): class ArestBinarySensor(BinarySensorDevice):
""" Implements an aREST binary sensor for a pin. """ """Implements an aREST binary sensor for a pin."""
def __init__(self, arest, resource, name, pin): def __init__(self, arest, resource, name, pin):
self.arest = arest self.arest = arest
@ -73,23 +70,22 @@ class ArestBinarySensor(BinarySensorDevice):
@property @property
def name(self): def name(self):
""" The name of the binary sensor. """ """The name of the binary sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" True if the binary sensor is on. """ """True if the binary sensor is on."""
return bool(self.arest.data.get('state')) return bool(self.arest.data.get('state'))
def update(self): def update(self):
""" Gets the latest data from aREST API. """ """Gets the latest data from aREST API."""
self.arest.update() self.arest.update()
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class ArestData(object): class ArestData(object):
""" Class for handling the data retrieval for pins. """ """Class for handling the data retrieval for pins."""
def __init__(self, resource, pin): def __init__(self, resource, pin):
self._resource = resource self._resource = resource
self._pin = pin self._pin = pin
@ -97,7 +93,7 @@ class ArestData(object):
@Throttle(MIN_TIME_BETWEEN_UPDATES) @Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self): def update(self):
""" Gets the latest data from aREST device. """ """Gets the latest data from aREST device."""
try: try:
response = requests.get('{}/digital/{}'.format( response = requests.get('{}/digital/{}'.format(
self._resource, self._pin), timeout=10) self._resource, self._pin), timeout=10)

View File

@ -38,7 +38,7 @@ class BloomSkySensor(BinarySensorDevice):
""" Represents a single binary sensor in a BloomSky device. """ """ Represents a single binary sensor in a BloomSky device. """
def __init__(self, bs, device, sensor_name): def __init__(self, bs, device, sensor_name):
"""Initialize a bloomsky binary sensor.""" """Initialize a BloomSky binary sensor."""
self._bloomsky = bs self._bloomsky = bs
self._device_id = device["DeviceID"] self._device_id = device["DeviceID"]
self._sensor_name = sensor_name self._sensor_name = sensor_name

View File

@ -1,8 +1,6 @@
""" """
homeassistant.components.binary_sensor.command_sensor Allows to configure custom shell commands to turn a value into a logical value
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ for a binary sensor.
Allows to configure custom shell commands to turn a value
into a logical value for a binary sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.command/ https://home-assistant.io/components/binary_sensor.command/
@ -27,8 +25,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Add the Command Sensor. """ """Add the Command Sensor."""
if config.get('command') is None: if config.get('command') is None:
_LOGGER.error('Missing required variable: "command"') _LOGGER.error('Missing required variable: "command"')
return False return False
@ -47,8 +44,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
class CommandBinarySensor(BinarySensorDevice): class CommandBinarySensor(BinarySensorDevice):
""" Represents a binary sensor that is returning """
a value of a shell commands. """ Represents a binary sensor that is returning a value of a shell commands.
"""
def __init__(self, hass, data, name, payload_on, def __init__(self, hass, data, name, payload_on,
payload_off, value_template): payload_off, value_template):
self._hass = hass self._hass = hass
@ -62,16 +60,16 @@ class CommandBinarySensor(BinarySensorDevice):
@property @property
def name(self): def name(self):
""" The name of the sensor. """ """The name of the sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" True if the binary sensor is on. """ """True if the binary sensor is on."""
return self._state return self._state
def update(self): def update(self):
""" Gets the latest data and updates the state. """ """Gets the latest data and updates the state."""
self.data.update() self.data.update()
value = self.data.value value = self.data.value

View File

@ -1,13 +1,11 @@
""" """
homeassistant.components.binary_sensor.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo platform that has two fake binary sensors. Demo platform that has two fake binary sensors.
""" """
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Demo binary sensors. """ """Sets up the Demo binary sensors """
add_devices([ add_devices([
DemoBinarySensor('Basement Floor Wet', False, 'moisture'), DemoBinarySensor('Basement Floor Wet', False, 'moisture'),
DemoBinarySensor('Movement Backyard', True, 'motion'), DemoBinarySensor('Movement Backyard', True, 'motion'),
@ -15,7 +13,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class DemoBinarySensor(BinarySensorDevice): class DemoBinarySensor(BinarySensorDevice):
""" A Demo binary sensor. """ """A Demo binary sensor."""
def __init__(self, name, state, sensor_class): def __init__(self, name, state, sensor_class):
self._name = name self._name = name
@ -24,20 +22,20 @@ class DemoBinarySensor(BinarySensorDevice):
@property @property
def sensor_class(self): def sensor_class(self):
""" Return our class. """ """Return the class of this sensor."""
return self._sensor_type return self._sensor_type
@property @property
def should_poll(self): def should_poll(self):
""" No polling needed for a demo binary sensor. """ """No polling needed for a demo binary sensor."""
return False return False
@property @property
def name(self): def name(self):
""" Returns the name of the binary sensor. """ """Returns the name of the binary sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" True if the binary sensor is on. """ """True if the binary sensor is on."""
return self._state return self._state

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT binary sensor. Allows to configure a MQTT binary sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -25,7 +23,7 @@ DEPENDENCIES = ['mqtt']
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Add MQTT binary sensor. """ """Add MQTT binary sensor."""
if config.get('state_topic') is None: if config.get('state_topic') is None:
_LOGGER.error('Missing required variable: state_topic') _LOGGER.error('Missing required variable: state_topic')
@ -43,7 +41,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments, too-many-instance-attributes # pylint: disable=too-many-arguments, too-many-instance-attributes
class MqttBinarySensor(BinarySensorDevice): class MqttBinarySensor(BinarySensorDevice):
""" Represents a binary sensor that is updated by MQTT. """ """Represents a binary sensor that is updated by MQTT."""
def __init__(self, hass, name, state_topic, qos, payload_on, payload_off, def __init__(self, hass, name, state_topic, qos, payload_on, payload_off,
value_template): value_template):
self._hass = hass self._hass = hass
@ -55,7 +53,7 @@ class MqttBinarySensor(BinarySensorDevice):
self._qos = qos self._qos = qos
def message_received(topic, payload, qos): def message_received(topic, payload, qos):
""" A new MQTT message has been received. """ """A new MQTT message has been received."""
if value_template is not None: if value_template is not None:
payload = template.render_with_possible_json_value( payload = template.render_with_possible_json_value(
hass, value_template, payload) hass, value_template, payload)
@ -70,15 +68,15 @@ class MqttBinarySensor(BinarySensorDevice):
@property @property
def should_poll(self): def should_poll(self):
""" No polling needed. """ """No polling needed."""
return False return False
@property @property
def name(self): def name(self):
""" The name of the binary sensor. """ """The name of the binary sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" True if the binary sensor is on. """ """True if the binary sensor is on."""
return self._state return self._state

View File

@ -54,7 +54,8 @@ class MySensorsBinarySensor(BinarySensorDevice):
def __init__( def __init__(
self, gateway, node_id, child_id, name, value_type, child_type): self, gateway, node_id, child_id, name, value_type, child_type):
"""Setup class attributes on instantiation. """
Setup class attributes on instantiation.
Args: Args:
gateway (GatewayWrapper): Gateway object. gateway (GatewayWrapper): Gateway object.
@ -124,7 +125,7 @@ class MySensorsBinarySensor(BinarySensorDevice):
@property @property
def sensor_class(self): def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CASSES.""" """Return the class of this sensor, from SENSOR_CLASSES."""
pres = self.gateway.const.Presentation pres = self.gateway.const.Presentation
class_map = { class_map = {
pres.S_DOOR: 'opening', pres.S_DOOR: 'opening',

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.nest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for Nest Thermostat Binary Sensors. Support for Nest Thermostat Binary Sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -27,7 +25,7 @@ BINARY_TYPES = ['fan',
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Setup Nest binary sensors. """ """Setup Nest binary sensors."""
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
try: try:
@ -48,9 +46,9 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class NestBinarySensor(NestSensor, BinarySensorDevice): class NestBinarySensor(NestSensor, BinarySensorDevice):
""" Represents a Nest binary sensor. """ """Represents a Nest binary sensor."""
@property @property
def is_on(self): def is_on(self):
""" True if the binary sensor is on. """ """True if the binary sensor is on."""
return bool(getattr(self.device, self.variable)) return bool(getattr(self.device, self.variable))

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.sensor.nx584
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for exposing nx584 elements as sensors. Support for exposing nx584 elements as sensors.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -73,18 +71,22 @@ class NX584ZoneSensor(BinarySensorDevice):
@property @property
def sensor_class(self): def sensor_class(self):
"""Return the class of this sensor, from SENSOR_CLASSES."""
return self._zone_type return self._zone_type
@property @property
def should_poll(self): def should_poll(self):
"""No polling needed."""
return False return False
@property @property
def name(self): def name(self):
"""Name of the binary sensor."""
return self._zone['name'] return self._zone['name']
@property @property
def is_on(self): def is_on(self):
"""Return true if the binary sensor is on."""
# True means "faulted" or "open" or "abnormal state" # True means "faulted" or "open" or "abnormal state"
return self._zone['state'] return self._zone['state']

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.rest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The rest binary sensor will consume responses sent by an exposed REST API. The rest binary sensor will consume responses sent by an exposed REST API.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -21,7 +19,7 @@ DEFAULT_METHOD = 'GET'
# pylint: disable=unused-variable # pylint: disable=unused-variable
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Setup REST binary sensors. """ """Setup REST binary sensors."""
resource = config.get('resource', None) resource = config.get('resource', None)
method = config.get('method', DEFAULT_METHOD) method = config.get('method', DEFAULT_METHOD)
payload = config.get('payload', None) payload = config.get('payload', None)
@ -41,10 +39,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments # pylint: disable=too-many-arguments
class RestBinarySensor(BinarySensorDevice): class RestBinarySensor(BinarySensorDevice):
""" A REST binary sensor. """ """A REST binary sensor."""
def __init__(self, hass, rest, name, value_template): def __init__(self, hass, rest, name, value_template):
""" Initialize a REST binary sensor. """ """Initialize a REST binary sensor."""
self._hass = hass self._hass = hass
self.rest = rest self.rest = rest
self._name = name self._name = name
@ -54,12 +52,12 @@ class RestBinarySensor(BinarySensorDevice):
@property @property
def name(self): def name(self):
""" Name of the binary sensor. """ """Name of the binary sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" Return if the binary sensor is on. """ """Return true if the binary sensor is on."""
if self.rest.data is None: if self.rest.data is None:
return False return False
@ -69,5 +67,5 @@ class RestBinarySensor(BinarySensorDevice):
return bool(int(self.rest.data)) return bool(int(self.rest.data))
def update(self): def update(self):
""" Get the latest data from REST API and updates the state. """ """Get the latest data from REST API and updates the state."""
self.rest.update() self.rest.update()

View File

@ -1,12 +1,9 @@
""" """
homeassistant.components.binary_sensor.rpi_gpio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a binary sensor using RPi GPIO. Allows to configure a binary sensor using RPi GPIO.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.rpi_gpio/ https://home-assistant.io/components/binary_sensor.rpi_gpio/
""" """
import logging import logging
import homeassistant.components.rpi_gpio as rpi_gpio import homeassistant.components.rpi_gpio as rpi_gpio
@ -23,7 +20,7 @@ _LOGGER = logging.getLogger(__name__)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Raspberry PI GPIO devices. """ """Sets up the Raspberry PI GPIO devices."""
pull_mode = config.get('pull_mode', DEFAULT_PULL_MODE) pull_mode = config.get('pull_mode', DEFAULT_PULL_MODE)
bouncetime = config.get('bouncetime', DEFAULT_BOUNCETIME) bouncetime = config.get('bouncetime', DEFAULT_BOUNCETIME)
@ -39,7 +36,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
# pylint: disable=too-many-arguments, too-many-instance-attributes # pylint: disable=too-many-arguments, too-many-instance-attributes
class RPiGPIOBinarySensor(BinarySensorDevice): class RPiGPIOBinarySensor(BinarySensorDevice):
""" Represents a binary sensor that uses Raspberry Pi GPIO. """ """Represents a binary sensor that uses Raspberry Pi GPIO."""
def __init__(self, name, port, pull_mode, bouncetime, invert_logic): def __init__(self, name, port, pull_mode, bouncetime, invert_logic):
# pylint: disable=no-member # pylint: disable=no-member
@ -53,22 +50,22 @@ class RPiGPIOBinarySensor(BinarySensorDevice):
self._state = rpi_gpio.read_input(self._port) self._state = rpi_gpio.read_input(self._port)
def read_gpio(port): def read_gpio(port):
""" Reads state from GPIO. """ """Reads state from GPIO."""
self._state = rpi_gpio.read_input(self._port) self._state = rpi_gpio.read_input(self._port)
self.update_ha_state() self.update_ha_state()
rpi_gpio.edge_detect(self._port, read_gpio, self._bouncetime) rpi_gpio.edge_detect(self._port, read_gpio, self._bouncetime)
@property @property
def should_poll(self): def should_poll(self):
""" No polling needed. """ """No polling needed."""
return False return False
@property @property
def name(self): def name(self):
""" The name of the sensor. """ """The name of the sensor."""
return self._name return self._name
@property @property
def is_on(self): def is_on(self):
""" Returns the state of the entity. """ """Returns the state of the entity."""
return self._state != self._invert_logic return self._state != self._invert_logic

View File

@ -1,30 +1,31 @@
""" """
homeassistant.components.binary_sensor.tcp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides a binary_sensor which gets its values from a TCP socket. Provides a binary_sensor which gets its values from a TCP socket.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.tcp/
""" """
import logging import logging
from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.components.sensor.tcp import Sensor, DOMAIN, CONF_VALUE_ON from homeassistant.components.sensor.tcp import Sensor, DOMAIN, CONF_VALUE_ON
DEPENDENCIES = [DOMAIN] DEPENDENCIES = [DOMAIN]
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
""" Create the BinarySensor. """ """Create the binary sensor."""
if not BinarySensor.validate_config(config): if not BinarySensor.validate_config(config):
return False return False
add_entities((BinarySensor(hass, config),)) add_entities((BinarySensor(hass, config),))
class BinarySensor(BinarySensorDevice, Sensor): class BinarySensor(BinarySensorDevice, Sensor):
""" A binary sensor which is on when its state == CONF_VALUE_ON. """ """A binary sensor which is on when its state == CONF_VALUE_ON."""
required = (CONF_VALUE_ON,) required = (CONF_VALUE_ON,)
@property @property
def is_on(self): def is_on(self):
"""True if the binary sensor is on."""
return self._state == self._config[CONF_VALUE_ON] return self._state == self._config[CONF_VALUE_ON]

View File

@ -1,6 +1,4 @@
""" """
homeassistant.components.binary_sensor.zigbee
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains functionality to use a ZigBee device as a binary sensor. Contains functionality to use a ZigBee device as a binary sensor.
For more details about this platform, please refer to the documentation at For more details about this platform, please refer to the documentation at
@ -14,7 +12,7 @@ DEPENDENCIES = ["zigbee"]
def setup_platform(hass, config, add_entities, discovery_info=None): def setup_platform(hass, config, add_entities, discovery_info=None):
""" Create and add an entity based on the configuration. """ """Create and add an entity based on the configuration."""
add_entities([ add_entities([
ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config)) ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))
]) ])

View File

@ -1,13 +1,9 @@
""" """
homeassistant.components.binary_sensor.zwave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Interfaces with Z-Wave sensors. Interfaces with Z-Wave sensors.
For more details about this platform, please refer to the documentation For more details about this platform, please refer to the documentation
at https://home-assistant.io/components/zwave/ https://home-assistant.io/components/binary_sensor.zwave/
""" """
import logging import logging
from homeassistant.components.zwave import ( from homeassistant.components.zwave import (
@ -23,7 +19,7 @@ DEPENDENCIES = []
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the mysensors platform for sensors.""" """Setup the Z-Wave platform for sensors."""
if discovery_info is None or NETWORK is None: if discovery_info is None or NETWORK is None:
return return
@ -37,7 +33,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class ZWaveBinarySensor(BinarySensorDevice, ZWaveDeviceEntity): class ZWaveBinarySensor(BinarySensorDevice, ZWaveDeviceEntity):
""" Represents a binary sensor within Z-Wave. """ """Represents a binary sensor within Z-Wave."""
def __init__(self, value, sensor_class): def __init__(self, value, sensor_class):
self._sensor_type = sensor_class self._sensor_type = sensor_class
@ -62,9 +58,10 @@ class ZWaveBinarySensor(BinarySensorDevice, ZWaveDeviceEntity):
@property @property
def should_poll(self): def should_poll(self):
"""No polling needed."""
return False return False
def value_changed(self, value): def value_changed(self, value):
""" Called when a value has changed on the network. """ """Called when a value has changed on the network."""
if self._value.value_id == value.value_id: if self._value.value_id == value.value_id:
self.update_ha_state() self.update_ha_state()