parameters: (self)
return_statement: return self.async_create_entry(title=title, data=data)
docstring: Generate new entry.
docstring_summary: Generate new entry.
docstring_tokens: Generate new entry .
function: def _save_entry(self):
          """Generate new entry."""
          data = {
              CONF_HOST: self._host,
              CONF_NAME: self._name,
              CONF_PORT: self._tv_info.ws_port,
              CONF_WS_NAME: self._ws_name,
          }
          if self._mac:
              data[CONF_MAC] = self._mac
  
          for key, attr in {
              CONF_ID: ATTR_DEVICE_ID,
              CONF_DEVICE_NAME: ATTR_DEVICE_NAME,
              CONF_DEVICE_MODEL: ATTR_DEVICE_MODEL,
              CONF_DEVICE_OS: ATTR_DEVICE_OS,
          }.items():
              if attr in self._device_info:
                  data[key] = self._device_info[attr]
  
          title = self._name
          if self._api_key and self._device_id:
              data[CONF_API_KEY] = self._api_key
              data[CONF_DEVICE_ID] = self._device_id
              title += " (SmartThings)"
              self.CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL
          else:
              self.CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
  
          _LOGGER.info("Configured new entity %s with host %s", title, self._host)
          return self.async_create_entry(title=title, data=data)
function_tokens: def _save_entry ( self ) : data = { CONF_HOST : self . _host , CONF_NAME : self . _name , CONF_PORT : self . _tv_info . ws_port , CONF_WS_NAME : self . _ws_name , } if self . _mac : data [ CONF_MAC ] = self . _mac for key , attr in { CONF_ID : ATTR_DEVICE_ID , CONF_DEVICE_NAME : ATTR_DEVICE_NAME , CONF_DEVICE_MODEL : ATTR_DEVICE_MODEL , CONF_DEVICE_OS : ATTR_DEVICE_OS , } . items ( ) : if attr in self . _device_info : data [ key ] = self . _device_info [ attr ] title = self . _name if self . _api_key and self . _device_id : data [ CONF_API_KEY ] = self . _api_key data [ CONF_DEVICE_ID ] = self . _device_id title += " (SmartThings)" self . CONNECTION_CLASS = config_entries . CONN_CLASS_CLOUD_POLL else : self . CONNECTION_CLASS = config_entries . CONN_CLASS_LOCAL_POLL _LOGGER . info ( "Configured new entity %s with host %s" , title , self . _host ) return self . async_create_entry ( title = title , data = data )