예제 #1
0
    async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult:
        """Handle DHCP discovery."""
        hostname = discovery_info.hostname
        gateway_id = hostname[8:22]

        _LOGGER.debug("DHCP discovery detected gateway %s", obfuscate_id(gateway_id))
        return await self._process_discovery(gateway_id)
예제 #2
0
    async def async_step_zeroconf(
            self, discovery_info: zeroconf.ZeroconfServiceInfo) -> FlowResult:
        """Handle ZeroConf discovery."""
        properties = discovery_info.properties
        gateway_id = properties["gateway_pin"]

        LOGGER.debug("ZeroConf discovery detected gateway %s",
                     obfuscate_id(gateway_id))
        return await self._process_discovery(gateway_id)
예제 #3
0
    async def async_step_dhcp(self, discovery_info: dhcp.DhcpServiceInfo) -> FlowResult:
        """Handle DHCP discovery."""
        hostname = discovery_info.hostname
        gateway_id = hostname[8:22]

        LOGGER.debug("DHCP discovery detected gateway %s", obfuscate_id(gateway_id))

        await self.async_set_unique_id(gateway_id)
        self._abort_if_unique_id_configured()

        return await self.async_step_user()
예제 #4
0
    async def async_step_zeroconf(
        self, discovery_info: zeroconf.ZeroconfServiceInfo
    ) -> FlowResult:
        """Handle ZeroConf discovery."""

        # abort if we already have exactly this bridge id/host
        properties = discovery_info.properties
        gateway_id = properties["gateway_pin"]

        _LOGGER.debug(
            "ZeroConf discovery detected gateway %s", obfuscate_id(gateway_id)
        )
        return await self._process_discovery(gateway_id)