parent
c7c0ed89c8
commit
54d463e746
5 changed files with 23 additions and 23 deletions
|
@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
|
||||
DEPENDENCIES = ['zha']
|
||||
|
||||
# ZigBee Cluster Library Zone Type to Home Assistant device class
|
||||
# Zigbee Cluster Library Zone Type to Home Assistant device class
|
||||
CLASS_MAPPING = {
|
||||
0x000d: 'motion',
|
||||
0x0015: 'opening',
|
||||
|
@ -145,7 +145,7 @@ class Remote(zha.Entity, BinarySensorDevice):
|
|||
_domain = DOMAIN
|
||||
|
||||
class OnOffListener:
|
||||
"""Listener for the OnOff ZigBee cluster."""
|
||||
"""Listener for the OnOff Zigbee cluster."""
|
||||
|
||||
def __init__(self, entity):
|
||||
"""Initialize OnOffListener."""
|
||||
|
@ -170,7 +170,7 @@ class Remote(zha.Entity, BinarySensorDevice):
|
|||
pass
|
||||
|
||||
class LevelListener:
|
||||
"""Listener for the LevelControl ZigBee cluster."""
|
||||
"""Listener for the LevelControl Zigbee cluster."""
|
||||
|
||||
def __init__(self, entity):
|
||||
"""Initialize LevelListener."""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
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
|
||||
https://home-assistant.io/components/binary_sensor.zigbee/
|
||||
|
@ -23,7 +23,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the ZigBee binary sensor platform."""
|
||||
"""Set up the Zigbee binary sensor platform."""
|
||||
add_entities(
|
||||
[ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))], True)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchDevice):
|
|||
|
||||
@property
|
||||
def should_poll(self):
|
||||
"""Return the polling state. Polling needed for zigbee plug only."""
|
||||
"""Return the polling state. Polling needed for Zigbee plug only."""
|
||||
return self._supports_power_consumption
|
||||
|
||||
def turn_on(self, **kwargs):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Contains functionality to use a ZigBee device as a switch.
|
||||
Contains functionality to use a Zigbee device as a switch.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/switch.zigbee/
|
||||
|
@ -25,11 +25,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
|||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Set up the ZigBee switch platform."""
|
||||
"""Set up the Zigbee switch platform."""
|
||||
add_entities([ZigBeeSwitch(hass, ZigBeeDigitalOutConfig(config))])
|
||||
|
||||
|
||||
class ZigBeeSwitch(ZigBeeDigitalOut, SwitchDevice):
|
||||
"""Representation of a ZigBee Digital Out device."""
|
||||
"""Representation of a Zigbee Digital Out device."""
|
||||
|
||||
pass
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Support for ZigBee devices.
|
||||
Support for Zigbee devices.
|
||||
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/zigbee/
|
||||
|
@ -60,7 +60,7 @@ PLATFORM_SCHEMA = vol.Schema({
|
|||
|
||||
|
||||
def setup(hass, config):
|
||||
"""Set up the connection to the ZigBee device."""
|
||||
"""Set up the connection to the Zigbee device."""
|
||||
global DEVICE
|
||||
global GPIO_DIGITAL_OUTPUT_LOW
|
||||
global GPIO_DIGITAL_OUTPUT_HIGH
|
||||
|
@ -91,13 +91,13 @@ def setup(hass, config):
|
|||
try:
|
||||
ser = Serial(usb_device, baud)
|
||||
except SerialException as exc:
|
||||
_LOGGER.exception("Unable to open serial port for ZigBee: %s", exc)
|
||||
_LOGGER.exception("Unable to open serial port for Zigbee: %s", exc)
|
||||
return False
|
||||
DEVICE = ZigBee(ser)
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, close_serial_port)
|
||||
|
||||
def _frame_received(frame):
|
||||
"""Run when a ZigBee frame is received.
|
||||
"""Run when a Zigbee frame is received.
|
||||
|
||||
Pickles the frame, then encodes it into base64 since it contains
|
||||
non JSON serializable binary.
|
||||
|
@ -110,7 +110,7 @@ def setup(hass, config):
|
|||
|
||||
|
||||
def close_serial_port(*args):
|
||||
"""Close the serial port we're using to communicate with the ZigBee."""
|
||||
"""Close the serial port we're using to communicate with the Zigbee."""
|
||||
DEVICE.zb.serial.close()
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ class ZigBeeConfig:
|
|||
"""Return the address of the device.
|
||||
|
||||
If an address has been provided, unhexlify it, otherwise return None
|
||||
as we're talking to our local ZigBee device.
|
||||
as we're talking to our local Zigbee device.
|
||||
"""
|
||||
address = self._config.get("address")
|
||||
if address is not None:
|
||||
|
@ -167,7 +167,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
|
|||
"""A subclass of ZigBeePinConfig."""
|
||||
|
||||
def __init__(self, config):
|
||||
"""Initialise the ZigBee Digital input config."""
|
||||
"""Initialise the Zigbee Digital input config."""
|
||||
super(ZigBeeDigitalInConfig, self).__init__(config)
|
||||
self._bool2state, self._state2bool = self.boolean_maps
|
||||
|
||||
|
@ -194,7 +194,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
|
|||
|
||||
@property
|
||||
def bool2state(self):
|
||||
"""Return a dictionary mapping the internal value to the ZigBee value.
|
||||
"""Return a dictionary mapping the internal value to the Zigbee value.
|
||||
|
||||
For the translation of on/off as being pin high or low.
|
||||
"""
|
||||
|
@ -202,7 +202,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
|
|||
|
||||
@property
|
||||
def state2bool(self):
|
||||
"""Return a dictionary mapping the ZigBee value to the internal value.
|
||||
"""Return a dictionary mapping the Zigbee value to the internal value.
|
||||
|
||||
For the translation of pin high/low as being on or off.
|
||||
"""
|
||||
|
@ -217,7 +217,7 @@ class ZigBeeDigitalOutConfig(ZigBeePinConfig):
|
|||
"""
|
||||
|
||||
def __init__(self, config):
|
||||
"""Initialize the ZigBee Digital out."""
|
||||
"""Initialize the Zigbee Digital out."""
|
||||
super(ZigBeeDigitalOutConfig, self).__init__(config)
|
||||
self._bool2state, self._state2bool = self.boolean_maps
|
||||
self._should_poll = config.get("poll", False)
|
||||
|
@ -260,7 +260,7 @@ class ZigBeeDigitalOutConfig(ZigBeePinConfig):
|
|||
|
||||
|
||||
class ZigBeeAnalogInConfig(ZigBeePinConfig):
|
||||
"""Representation of a ZigBee GPIO pin set to analog in."""
|
||||
"""Representation of a Zigbee GPIO pin set to analog in."""
|
||||
|
||||
@property
|
||||
def max_voltage(self):
|
||||
|
@ -321,7 +321,7 @@ class ZigBeeDigitalIn(Entity):
|
|||
return self._state
|
||||
|
||||
def update(self):
|
||||
"""Ask the ZigBee device what state its input pin is in."""
|
||||
"""Ask the Zigbee device what state its input pin is in."""
|
||||
try:
|
||||
sample = DEVICE.get_sample(self._config.address)
|
||||
except ZIGBEE_TX_FAILURE:
|
||||
|
@ -331,12 +331,12 @@ class ZigBeeDigitalIn(Entity):
|
|||
return
|
||||
except ZIGBEE_EXCEPTION as exc:
|
||||
_LOGGER.exception(
|
||||
"Unable to get sample from ZigBee device: %s", exc)
|
||||
"Unable to get sample from Zigbee device: %s", exc)
|
||||
return
|
||||
pin_name = DIGITAL_PINS[self._config.pin]
|
||||
if pin_name not in sample:
|
||||
_LOGGER.warning(
|
||||
"Pin %s (%s) was not in the sample provided by ZigBee device "
|
||||
"Pin %s (%s) was not in the sample provided by Zigbee device "
|
||||
"%s.",
|
||||
self._config.pin, pin_name, hexlify(self._config.address))
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue