Exemplo n.º 1
0
async def config_entry_disable(hass, connection, msg):
    """Disable config entry."""
    disabled_by = msg["disabled_by"]
    if disabled_by is not None:
        disabled_by = config_entries.ConfigEntryDisabler(disabled_by)

    result = False
    try:
        result = await hass.config_entries.async_set_disabled_by(
            msg["entry_id"], disabled_by)
    except config_entries.OperationNotAllowed:
        # Failed to unload the config entry
        pass
    except config_entries.UnknownEntry:
        send_entry_not_found(connection, msg["id"])
        return

    result = {"require_restart": not result}

    connection.send_result(msg["id"], result)
Exemplo n.º 2
0
async def config_entry_disable(hass, connection, msg):
    """Disable config entry."""
    if (disabled_by := msg["disabled_by"]) is not None:
        disabled_by = config_entries.ConfigEntryDisabler(disabled_by)