def async_myhandle(zeroconf: Zeroconf, service_type: str, name: str, state_change: ServiceStateChange):
_LOGGER.error(name)
async def async_say_hello(hass):
zc = await zeroconf.async_get_async_instance(hass)
browser = AsyncServiceBrowser(zc.zeroconf, ['_ewelink._tcp.local.'], handlers=[async_myhandle])
_LOGGER.error(browser)
while True:
_LOGGER.error('xxxxxxxxxxxxxxxxxxx')
await asyncio.sleep(1)
async def async_setup_platform(hass: HomeAssistant, config: ConfigType, add_entities: AddEntitiesCallback, discovery_info: DiscoveryInfoType | None = None):
hass.loop.create_task(async_say_hello(hass))
add_entities([ExampleSensor(hass)])
this line:
_LOGGER.error(name)
not print name
callback function not work…why?
no error,but "_LOGGER.error(name) " not print.
this line:
_LOGGER.error(‘xxxxxxxxxxxxxxxxxxx’)
is work fine…