Ejemplo n.º 1
0
    async def async_create_device(cls, hass: HomeAssistant,
                                  ssdp_location: str) -> Device:
        """Create UPnP/IGD device."""
        upnp_device = await async_create_upnp_device(hass, ssdp_location)

        # Create profile wrapper.
        igd_device = IgdDevice(upnp_device, None)
        device = cls(hass, igd_device)

        return device
Ejemplo n.º 2
0
    async def async_create_device(cls, hass: HomeAssistantType, ssdp_description: str):
        """Create UPnP/IGD device."""
        # build async_upnp_client requester
        session = async_get_clientsession(hass)
        requester = AiohttpSessionRequester(session, True)

        # create async_upnp_client device
        factory = UpnpFactory(requester, disable_state_variable_validation=True)
        upnp_device = await factory.async_create_device(ssdp_description)

        igd_device = IgdDevice(upnp_device, None)

        return cls(igd_device)
Ejemplo n.º 3
0
async def async_create_device(hass: HomeAssistant,
                              ssdp_location: str) -> Device:
    """Create UPnP/IGD device."""
    session = async_get_clientsession(hass, verify_ssl=False)
    requester = AiohttpSessionRequester(session, with_sleep=True, timeout=20)

    factory = UpnpFactory(requester, disable_state_variable_validation=True)
    upnp_device = await factory.async_create_device(ssdp_location)

    # Create profile wrapper.
    igd_device = IgdDevice(upnp_device, None)
    device = Device(hass, igd_device)

    return device
Ejemplo n.º 4
0
    async def async_create_device(cls, hass: HomeAssistant,
                                  ssdp_location: str) -> Device:
        """Create UPnP/IGD device."""
        upnp_device = await async_create_upnp_device(hass, ssdp_location)

        # Create profile wrapper.
        igd_device = IgdDevice(upnp_device, None)
        device = cls(hass, igd_device)

        # Register SSDP callback for updates.
        usn = f"{upnp_device.udn}::{upnp_device.device_type}"
        await ssdp.async_register_callback(hass, device.async_ssdp_callback,
                                           {"usn": usn})

        return device
Ejemplo n.º 5
0
    async def async_create_device(
        cls, hass: HomeAssistant, ssdp_location: str
    ) -> Device:
        """Create UPnP/IGD device."""
        # Build async_upnp_client requester.
        session = async_get_clientsession(hass)
        requester = AiohttpSessionRequester(session, True, 10)

        # Create async_upnp_client device.
        factory = UpnpFactory(requester, disable_state_variable_validation=True)
        upnp_device = await factory.async_create_device(ssdp_location)

        # Create profile wrapper.
        igd_device = IgdDevice(upnp_device, None)

        # Create updater.
        local_ip = _get_local_ip(hass)
        device_updater = DeviceUpdater(
            device=upnp_device, factory=factory, source_ip=local_ip
        )

        return cls(igd_device, device_updater)