Update name (fixes #17752) (#17756)

This commit is contained in:
Fabian Affolter 2018-10-24 18:59:52 +02:00 committed by GitHub
parent c7c0ed89c8
commit 54d463e746
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 23 deletions

View file

@ -13,7 +13,7 @@ _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['zha'] DEPENDENCIES = ['zha']
# ZigBee Cluster Library Zone Type to Home Assistant device class # Zigbee Cluster Library Zone Type to Home Assistant device class
CLASS_MAPPING = { CLASS_MAPPING = {
0x000d: 'motion', 0x000d: 'motion',
0x0015: 'opening', 0x0015: 'opening',
@ -145,7 +145,7 @@ class Remote(zha.Entity, BinarySensorDevice):
_domain = DOMAIN _domain = DOMAIN
class OnOffListener: class OnOffListener:
"""Listener for the OnOff ZigBee cluster.""" """Listener for the OnOff Zigbee cluster."""
def __init__(self, entity): def __init__(self, entity):
"""Initialize OnOffListener.""" """Initialize OnOffListener."""
@ -170,7 +170,7 @@ class Remote(zha.Entity, BinarySensorDevice):
pass pass
class LevelListener: class LevelListener:
"""Listener for the LevelControl ZigBee cluster.""" """Listener for the LevelControl Zigbee cluster."""
def __init__(self, entity): def __init__(self, entity):
"""Initialize LevelListener.""" """Initialize LevelListener."""

View file

@ -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 For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.zigbee/ 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): 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( add_entities(
[ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))], True) [ZigBeeBinarySensor(hass, ZigBeeDigitalInConfig(config))], True)

View file

@ -106,7 +106,7 @@ class XiaomiGenericSwitch(XiaomiDevice, SwitchDevice):
@property @property
def should_poll(self): 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 return self._supports_power_consumption
def turn_on(self, **kwargs): def turn_on(self, **kwargs):

View file

@ -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 For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.zigbee/ 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): 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))]) add_entities([ZigBeeSwitch(hass, ZigBeeDigitalOutConfig(config))])
class ZigBeeSwitch(ZigBeeDigitalOut, SwitchDevice): class ZigBeeSwitch(ZigBeeDigitalOut, SwitchDevice):
"""Representation of a ZigBee Digital Out device.""" """Representation of a Zigbee Digital Out device."""
pass pass

View file

@ -1,5 +1,5 @@
""" """
Support for ZigBee devices. Support for Zigbee devices.
For more details about this component, please refer to the documentation at For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zigbee/ https://home-assistant.io/components/zigbee/
@ -60,7 +60,7 @@ PLATFORM_SCHEMA = vol.Schema({
def setup(hass, config): def setup(hass, config):
"""Set up the connection to the ZigBee device.""" """Set up the connection to the Zigbee device."""
global DEVICE global DEVICE
global GPIO_DIGITAL_OUTPUT_LOW global GPIO_DIGITAL_OUTPUT_LOW
global GPIO_DIGITAL_OUTPUT_HIGH global GPIO_DIGITAL_OUTPUT_HIGH
@ -91,13 +91,13 @@ def setup(hass, config):
try: try:
ser = Serial(usb_device, baud) ser = Serial(usb_device, baud)
except SerialException as exc: 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 return False
DEVICE = ZigBee(ser) DEVICE = ZigBee(ser)
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, close_serial_port) hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, close_serial_port)
def _frame_received(frame): 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 Pickles the frame, then encodes it into base64 since it contains
non JSON serializable binary. non JSON serializable binary.
@ -110,7 +110,7 @@ def setup(hass, config):
def close_serial_port(*args): 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() DEVICE.zb.serial.close()
@ -141,7 +141,7 @@ class ZigBeeConfig:
"""Return the address of the device. """Return the address of the device.
If an address has been provided, unhexlify it, otherwise return None 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") address = self._config.get("address")
if address is not None: if address is not None:
@ -167,7 +167,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
"""A subclass of ZigBeePinConfig.""" """A subclass of ZigBeePinConfig."""
def __init__(self, config): def __init__(self, config):
"""Initialise the ZigBee Digital input config.""" """Initialise the Zigbee Digital input config."""
super(ZigBeeDigitalInConfig, self).__init__(config) super(ZigBeeDigitalInConfig, self).__init__(config)
self._bool2state, self._state2bool = self.boolean_maps self._bool2state, self._state2bool = self.boolean_maps
@ -194,7 +194,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
@property @property
def bool2state(self): 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. For the translation of on/off as being pin high or low.
""" """
@ -202,7 +202,7 @@ class ZigBeeDigitalInConfig(ZigBeePinConfig):
@property @property
def state2bool(self): 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. For the translation of pin high/low as being on or off.
""" """
@ -217,7 +217,7 @@ class ZigBeeDigitalOutConfig(ZigBeePinConfig):
""" """
def __init__(self, config): def __init__(self, config):
"""Initialize the ZigBee Digital out.""" """Initialize the Zigbee Digital out."""
super(ZigBeeDigitalOutConfig, self).__init__(config) super(ZigBeeDigitalOutConfig, self).__init__(config)
self._bool2state, self._state2bool = self.boolean_maps self._bool2state, self._state2bool = self.boolean_maps
self._should_poll = config.get("poll", False) self._should_poll = config.get("poll", False)
@ -260,7 +260,7 @@ class ZigBeeDigitalOutConfig(ZigBeePinConfig):
class ZigBeeAnalogInConfig(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 @property
def max_voltage(self): def max_voltage(self):
@ -321,7 +321,7 @@ class ZigBeeDigitalIn(Entity):
return self._state return self._state
def update(self): 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: try:
sample = DEVICE.get_sample(self._config.address) sample = DEVICE.get_sample(self._config.address)
except ZIGBEE_TX_FAILURE: except ZIGBEE_TX_FAILURE:
@ -331,12 +331,12 @@ class ZigBeeDigitalIn(Entity):
return return
except ZIGBEE_EXCEPTION as exc: except ZIGBEE_EXCEPTION as exc:
_LOGGER.exception( _LOGGER.exception(
"Unable to get sample from ZigBee device: %s", exc) "Unable to get sample from Zigbee device: %s", exc)
return return
pin_name = DIGITAL_PINS[self._config.pin] pin_name = DIGITAL_PINS[self._config.pin]
if pin_name not in sample: if pin_name not in sample:
_LOGGER.warning( _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.", "%s.",
self._config.pin, pin_name, hexlify(self._config.address)) self._config.pin, pin_name, hexlify(self._config.address))
return return