Exemplo n.º 1
0
async def async_setup_platform(hass,
                               hass_config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the LCN light platform."""
    if discovery_info is None:
        return

    import pypck

    devices = []
    for config in discovery_info:
        address, connection_id = config[CONF_ADDRESS]
        addr = pypck.lcn_addr.LcnAddr(*address)
        connections = hass.data[DATA_LCN][CONF_CONNECTIONS]
        connection = get_connection(connections, connection_id)
        address_connection = connection.get_address_conn(addr)

        if config[CONF_OUTPUT] in OUTPUT_PORTS:
            device = LcnOutputLight(config, address_connection)
        else:  # in RELAY_PORTS
            device = LcnRelayLight(config, address_connection)

        devices.append(device)

    async_add_entities(devices)
Exemplo n.º 2
0
async def async_setup_platform(hass,
                               hass_config,
                               async_add_entities,
                               discovery_info=None):
    """Set up the LCN light platform."""
    import pypck

    devices = []
    for config in discovery_info:
        address, connection_id = config[CONF_ADDRESS]
        addr = pypck.lcn_addr.LcnAddr(*address)
        connections = hass.data[DATA_LCN][CONF_CONNECTIONS]
        connection = get_connection(connections, connection_id)
        address_connection = connection.get_address_conn(addr)

        devices.append(LcnOutputLight(config, address_connection))
    async_add_entities(devices)
Exemplo n.º 3
0
async def async_setup_platform(hass, hass_config, async_add_entities,
                               discovery_info=None):
    """Setups the LCN cover platform."""
    if discovery_info is None:
        return

    import pypck

    devices = []
    for config in discovery_info:
        address, connection_id = config[CONF_ADDRESS]
        addr = pypck.lcn_addr.LcnAddr(*address)
        connections = hass.data[DATA_LCN][CONF_CONNECTIONS]
        connection = get_connection(connections, connection_id)
        address_connection = connection.get_address_conn(addr)

        devices.append(LcnCover(config, address_connection))

    async_add_entities(devices)
Exemplo n.º 4
0
async def async_setup_platform(hass, hass_config, async_add_entities,
                               discovery_info=None):
    """Set up the LCN switch platform."""
    if discovery_info is None:
        return

    import pypck

    devices = []
    for config in discovery_info:
        address, connection_id = config[CONF_ADDRESS]
        addr = pypck.lcn_addr.LcnAddr(*address)
        connections = hass.data[DATA_LCN][CONF_CONNECTIONS]
        connection = get_connection(connections, connection_id)
        address_connection = connection.get_address_conn(addr)

        if config[CONF_OUTPUT] in OUTPUT_PORTS:
            device = LcnOutputSwitch(config, address_connection)
        else:  # in RELAY_PORTS
            device = LcnRelaySwitch(config, address_connection)

        devices.append(device)

    async_add_entities(devices)