コード例 #1
0
 def __init__(
     self, client: "Client", state: dict, log_config: LogConfigDataType
 ) -> None:
     """Initialize driver."""
     super().__init__()
     self.client = client
     self.controller = Controller(client, state)
     self.log_config = LogConfig.from_dict(log_config)
コード例 #2
0
ファイル: api.py プロジェクト: KapJI/home-assistant
async def websocket_update_log_config(hass: HomeAssistant,
                                      connection: ActiveConnection,
                                      msg: dict) -> None:
    """Update the driver log config."""
    entry_id = msg[ENTRY_ID]
    client = hass.data[DOMAIN][entry_id][DATA_CLIENT]
    await client.driver.async_update_log_config(LogConfig(**msg[CONFIG]))
    connection.send_result(msg[ID], )
コード例 #3
0
ファイル: api.py プロジェクト: MatthiasLohr/core
async def websocket_update_log_config(
    hass: HomeAssistant,
    connection: ActiveConnection,
    msg: dict,
    entry: ConfigEntry,
    client: Client,
) -> None:
    """Update the driver log config."""
    await client.driver.async_update_log_config(LogConfig(**msg[CONFIG]))
    connection.send_result(msg[ID], )
コード例 #4
0
 async def async_get_log_config(self) -> LogConfig:
     """Return current log config for driver."""
     result = await self.client.async_send_command(
         {"command": "get_log_config"})
     return LogConfig.from_dict(result["config"])
コード例 #5
0
 async def async_update_log_config(self, log_config: LogConfig) -> None:
     """Update log config for driver."""
     await self.client.async_send_command({
         "command": "update_log_config",
         "config": log_config.to_dict(),
     })
コード例 #6
0
 async def async_get_log_config(self) -> LogConfig:
     """Return current log config for driver."""
     result = await self._async_send_command("get_log_config", require_schema=4)
     return LogConfig.from_dict(result["config"])
コード例 #7
0
 async def async_update_log_config(self, log_config: LogConfig) -> None:
     """Update log config for driver."""
     await self._async_send_command(
         "update_log_config", config=log_config.to_dict(), require_schema=4
     )
コード例 #8
0
 def handle_log_config_updated(self, event: Event) -> None:
     """Process a driver log config updated event."""
     event.data["log_config"] = self.log_config = LogConfig.from_dict(
         event.data["config"]
     )