def setup_platform(hass, config, add_devices, discovery_info=None): """Set up Zigbee Home Automation switches.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return add_devices([Switch(**discovery_info)])
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation fans.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return async_add_devices([ZhaFan(**discovery_info)], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation binary sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return from zigpy.zcl.clusters.security import IasZone in_clusters = discovery_info['in_clusters'] device_class = None cluster = in_clusters[IasZone.cluster_id] if discovery_info['new_join']: yield from cluster.bind() ieee = cluster.endpoint.device.application.ieee yield from cluster.write_attributes({'cie_addr': ieee}) try: zone_type = yield from cluster['zone_type'] device_class = CLASS_MAPPING.get(zone_type, None) except Exception: # pylint: disable=broad-except # If we fail to read from the device, use a non-specific class pass sensor = BinarySensor(device_class, **discovery_info) async_add_devices([sensor])
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation lights.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return endpoint = discovery_info['endpoint'] if hasattr(endpoint, 'light_color'): caps = await zha.safe_read(endpoint.light_color, ['color_capabilities']) discovery_info['color_capabilities'] = caps.get('color_capabilities') if discovery_info['color_capabilities'] is None: # ZCL Version 4 devices don't support the color_capabilities # attribute. In this version XY support is mandatory, but we need # to probe to determine if the device supports color temperature. discovery_info['color_capabilities'] = CAPABILITIES_COLOR_XY result = await zha.safe_read(endpoint.light_color, ['color_temperature']) if result.get('color_temperature') is not UNSUPPORTED_ATTRIBUTE: discovery_info['color_capabilities'] |= CAPABILITIES_COLOR_TEMP async_add_devices([Light(**discovery_info)], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation binary sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return from bellows.zigbee.zcl.clusters.security import IasZone clusters = discovery_info['clusters'] device_class = None cluster = [c for c in clusters if isinstance(c, IasZone)][0] if discovery_info['new_join']: yield from cluster.bind() ieee = cluster.endpoint.device.application.ieee yield from cluster.write_attributes({'cie_addr': ieee}) try: zone_type = yield from cluster['zone_type'] device_class = CLASS_MAPPING.get(zone_type, None) except Exception: # pylint: disable=broad-except # If we fail to read from the device, use a non-specific class pass sensor = BinarySensor(device_class, **discovery_info) async_add_devices([sensor])
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation binary sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return from zigpy.zcl.clusters.security import IasZone in_clusters = discovery_info['in_clusters'] device_class = None cluster = in_clusters[IasZone.cluster_id] if discovery_info['new_join']: await cluster.bind() ieee = cluster.endpoint.device.application.ieee await cluster.write_attributes({'cie_addr': ieee}) try: zone_type = await cluster['zone_type'] device_class = CLASS_MAPPING.get(zone_type, None) except Exception: # pylint: disable=broad-except # If we fail to read from the device, use a non-specific class pass sensor = BinarySensor(device_class, **discovery_info) async_add_devices([sensor], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up Zigbee Home Automation sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return sensor = yield from make_sensor(discovery_info) async_add_devices([sensor])
def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Zigbee Home Automation fans.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return async_add_entities([ZhaFan(**discovery_info)], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up Zigbee Home Automation sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return sensor = yield from make_sensor(discovery_info) async_add_devices([sensor], update_before_add=True)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up Zigbee Home Automation sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return sensor = await make_sensor(discovery_info) async_add_entities([sensor], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation lights.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return endpoint = discovery_info['endpoint'] try: discovery_info['color_capabilities'] \ = yield from endpoint.light_color['color_capabilities'] except (AttributeError, KeyError): pass async_add_devices([Light(**discovery_info)], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation lights.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return endpoint = discovery_info['endpoint'] try: primaries = yield from endpoint.light_color['num_primaries'] discovery_info['num_primaries'] = primaries except (AttributeError, KeyError): pass async_add_devices([Light(**discovery_info)])
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Zigbee Home Automation switches.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return from zigpy.zcl.clusters.general import OnOff in_clusters = discovery_info['in_clusters'] cluster = in_clusters[OnOff.cluster_id] await cluster.bind() await cluster.configure_reporting(0, 0, 600, 1,) async_add_entities([Switch(**discovery_info)], update_before_add=True)
async def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation binary sensors.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return from zigpy.zcl.clusters.general import OnOff from zigpy.zcl.clusters.security import IasZone if IasZone.cluster_id in discovery_info['in_clusters']: await _async_setup_iaszone(hass, config, async_add_devices, discovery_info) elif OnOff.cluster_id in discovery_info['out_clusters']: await _async_setup_remote(hass, config, async_add_devices, discovery_info)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the Zigbee Home Automation switches.""" from zigpy.zcl.clusters.general import OnOff discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return switch = Switch(**discovery_info) if discovery_info['new_join']: in_clusters = discovery_info['in_clusters'] cluster = in_clusters[OnOff.cluster_id] await zha.configure_reporting( switch.entity_id, cluster, switch.value_attribute, min_report=0, max_report=600, reportable_change=1 ) async_add_entities([switch], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation lights.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return endpoint = discovery_info['endpoint'] if hasattr(endpoint, 'light_color'): caps = yield from zha.safe_read( endpoint.light_color, ['color_capabilities']) discovery_info['color_capabilities'] = caps.get('color_capabilities') if discovery_info['color_capabilities'] is None: # ZCL Version 4 devices don't support the color_capabilities # attribute. In this version XY support is mandatory, but we need # to probe to determine if the device supports color temperature. discovery_info['color_capabilities'] = CAPABILITIES_COLOR_XY result = yield from zha.safe_read( endpoint.light_color, ['color_temperature']) if result.get('color_temperature') is not UNSUPPORTED_ATTRIBUTE: discovery_info['color_capabilities'] |= CAPABILITIES_COLOR_TEMP async_add_devices([Light(**discovery_info)], update_before_add=True)
def async_setup_platform(hass, config, async_add_devices, discovery_info=None): """Set up the Zigbee Home Automation lights.""" discovery_info = zha.get_discovery_info(hass, discovery_info) if discovery_info is None: return endpoint = discovery_info['endpoint'] try: discovery_info['color_capabilities'] \ = yield from endpoint.light_color['color_capabilities'] except (AttributeError, KeyError): pass if discovery_info.get('color_capabilities') is None: # ZCL Version 4 devices don't support the color_capabilities attribute. # In this version XY support is mandatory, but we need to probe to # determine if the device supports color temperature. discovery_info['color_capabilities'] = CAPABILITIES_COLOR_XY result = yield from safe_read(endpoint.light_color, ['color_temperature']) if result.get('color_temperature') is not UNSUPPORTED_ATTRIBUTE: discovery_info['color_capabilities'] |= CAPABILITIES_COLOR_TEMP async_add_devices([Light(**discovery_info)], update_before_add=True)