async def discovery_update(self, discovery_payload):
     """Handle updated discovery message."""
     config = PLATFORM_SCHEMA(discovery_payload)
     self._config = config
     await self.device_info_discovery_update(config)
     await self._subscribe_topics()
     self.async_write_op_state()
Exemple #2
0
async def async_setup_platform(opp,
                               config,
                               async_add_entities,
                               discovery_info=None):
    """Set up a MJPEG IP Camera."""
    filter_urllib3_logging()

    if discovery_info:
        config = PLATFORM_SCHEMA(discovery_info)
    async_add_entities([MjpegCamera(config)])
 async def async_discover(discovery_payload):
     """Discover and add a MQTT camera."""
     try:
         discovery_hash = discovery_payload.pop(ATTR_DISCOVERY_HASH)
         config = PLATFORM_SCHEMA(discovery_payload)
         await _async_setup_entity(config, async_add_entities, config_entry,
                                   discovery_hash)
     except Exception:
         if discovery_hash:
             clear_discovery_hash(opp, discovery_hash)
         raise