original_docstring: Set up tuya cover dynamically through tuya discovery.
docstring: Set up tuya cover dynamically through tuya discovery.
docstring_tokens: Set up tuya cover dynamically through tuya discovery .
code: async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities):
      """Set up tuya cover dynamically through tuya discovery."""
      print("cover init")
  
      hass.data[DOMAIN][TUYA_HA_TUYA_MAP].update(TUYA_HA_MAP)
  
      async def async_discover_device(dev_ids):
          """Discover and add a discovered tuya cover."""
          print("cover add->", dev_ids)
          if not dev_ids:
              return
          entities = await hass.async_add_executor_job(
              _setup_entities,
              hass,
              dev_ids
          )
          async_add_entities(entities)
  
      async_dispatcher_connect(
          hass, TUYA_DISCOVERY_NEW.format(DEVICE_DOMAIN), async_discover_device
      )
  
      device_manager = hass.data[DOMAIN][TUYA_DEVICE_MANAGER]
      device_ids = []
      for (device_id, device) in device_manager.deviceMap.items():
          if device.category in TUYA_HA_MAP.keys():
              device_ids.append(device_id)
      await async_discover_device(device_ids)
code_tokens: async def async_setup_entry ( hass : HomeAssistant , entry : ConfigEntry , async_add_entities ) : print ( "cover init" ) hass . data [ DOMAIN ] [ TUYA_HA_TUYA_MAP ] . update ( TUYA_HA_MAP ) async def async_discover_device ( dev_ids ) : """Discover and add a discovered tuya cover.""" print ( "cover add->" , dev_ids ) if not dev_ids : return entities = await hass . async_add_executor_job ( _setup_entities , hass , dev_ids ) async_add_entities ( entities ) async_dispatcher_connect ( hass , TUYA_DISCOVERY_NEW . format ( DEVICE_DOMAIN ) , async_discover_device ) device_manager = hass . data [ DOMAIN ] [ TUYA_DEVICE_MANAGER ] device_ids = [ ] for ( device_id , device ) in device_manager . deviceMap . items ( ) : if device . category in TUYA_HA_MAP . keys ( ) : device_ids . append ( device_id ) await async_discover_device ( device_ids )
short_docstring: Set up tuya cover dynamically through tuya discovery.
short_docstring_tokens: Set up tuya cover dynamically through tuya discovery .
comment: """Set up tuya cover dynamically through tuya discovery."""$SEP$"""Discover and add a discovered tuya cover."""