def setup_platform(hass, config, add_devices_callback, discovery_info=None): """Setup the Demo roller shutters.""" import RFXtrx as rfxtrxmod # Add rollershutter from config file rollershutters = rfxtrx.get_devices_from_config(config, RfxtrxRollershutter) add_devices_callback(rollershutters) def rollershutter_update(event): """Callback for roller shutter updates from the RFXtrx gateway.""" if not isinstance(event.device, rfxtrxmod.LightingDevice) or \ event.device.known_to_be_dimmable or \ not event.device.known_to_be_rollershutter: return new_device = rfxtrx.get_new_device(event, config, RfxtrxRollershutter) if new_device: add_devices_callback([new_device]) rfxtrx.apply_received_command(event) # Subscribe to main rfxtrx events if rollershutter_update not in rfxtrx.RECEIVED_EVT_SUBSCRIBERS: rfxtrx.RECEIVED_EVT_SUBSCRIBERS.append(rollershutter_update)
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the RFXtrx cover.""" import RFXtrx as rfxtrxmod covers = rfxtrx.get_devices_from_config(config, RfxtrxCover) add_entities(covers) def cover_update(event): """Handle cover updates from the RFXtrx gateway.""" if ( not isinstance(event.device, rfxtrxmod.LightingDevice) or event.device.known_to_be_dimmable or not event.device.known_to_be_rollershutter ): return new_device = rfxtrx.get_new_device(event, config, RfxtrxCover) if new_device: add_entities([new_device]) rfxtrx.apply_received_command(event) # Subscribe to main RFXtrx events if cover_update not in rfxtrx.RECEIVED_EVT_SUBSCRIBERS: rfxtrx.RECEIVED_EVT_SUBSCRIBERS.append(cover_update)
def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the RFXtrx platform.""" import RFXtrx as rfxtrxmod lights = rfxtrx.get_devices_from_config(config, RfxtrxLight) add_entities(lights) def light_update(event): """Handle light updates from the RFXtrx gateway.""" if not isinstance(event.device, rfxtrxmod.LightingDevice) or \ not event.device.known_to_be_dimmable: return new_device = rfxtrx.get_new_device(event, config, RfxtrxLight) if new_device: add_entities([new_device]) rfxtrx.apply_received_command(event) # Subscribe to main RFXtrx events if light_update not in rfxtrx.RECEIVED_EVT_SUBSCRIBERS: rfxtrx.RECEIVED_EVT_SUBSCRIBERS.append(light_update)
def setup_platform(hass, config, add_devices, discovery_info=None): """Setup the RFXtrx platform.""" import RFXtrx as rfxtrxmod lights = rfxtrx.get_devices_from_config(config, RfxtrxLight) add_devices(lights) def light_update(event): """Callback for light updates from the RFXtrx gateway.""" if not isinstance(event.device, rfxtrxmod.LightingDevice) or \ not event.device.known_to_be_dimmable: return new_device = rfxtrx.get_new_device(event, config, RfxtrxLight) if new_device: add_devices([new_device]) rfxtrx.apply_received_command(event) # Subscribe to main rfxtrx events if light_update not in rfxtrx.RECEIVED_EVT_SUBSCRIBERS: rfxtrx.RECEIVED_EVT_SUBSCRIBERS.append(light_update)
def setup_platform(hass, config, add_devices_callback, discovery_info=None): """Setup the RFXtrx platform.""" import RFXtrx as rfxtrxmod # Add switch from config file switches = rfxtrx.get_devices_from_config(config, RfxtrxSwitch) add_devices_callback(switches) def switch_update(event): """Callback for sensor updates from the RFXtrx gateway.""" if not isinstance(event.device, rfxtrxmod.LightingDevice) or \ event.device.known_to_be_dimmable: return new_device = rfxtrx.get_new_device(event, config, RfxtrxSwitch) if new_device: add_devices_callback([new_device]) rfxtrx.apply_received_command(event) # Subscribe to main rfxtrx events if switch_update not in rfxtrx.RECEIVED_EVT_SUBSCRIBERS: rfxtrx.RECEIVED_EVT_SUBSCRIBERS.append(switch_update)