Use typed config entry in mastodon (#132249)

This commit is contained in:
epenet 2024-12-04 09:54:29 +01:00 committed by GitHub
parent 5600ad0d82
commit 2ebc229d8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -81,7 +81,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: MastodonConfigEntry) ->
) )
async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: async def async_migrate_entry(hass: HomeAssistant, entry: MastodonConfigEntry) -> bool:
"""Migrate old config.""" """Migrate old config."""
if entry.version == 1 and entry.minor_version == 1: if entry.version == 1 and entry.minor_version == 1:
@ -113,7 +113,7 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
return True return True
def setup_mastodon(entry: ConfigEntry) -> tuple[Mastodon, dict, dict]: def setup_mastodon(entry: MastodonConfigEntry) -> tuple[Mastodon, dict, dict]:
"""Get mastodon details.""" """Get mastodon details."""
client = create_mastodon_client( client = create_mastodon_client(
entry.data[CONF_BASE_URL], entry.data[CONF_BASE_URL],

View File

@ -8,7 +8,7 @@ from mastodon.Mastodon import MastodonNetworkError, MastodonUnauthorizedError
import voluptuous as vol import voluptuous as vol
from yarl import URL from yarl import URL
from homeassistant.config_entries import ConfigEntry, ConfigFlow, ConfigFlowResult from homeassistant.config_entries import ConfigFlow, ConfigFlowResult
from homeassistant.const import ( from homeassistant.const import (
CONF_ACCESS_TOKEN, CONF_ACCESS_TOKEN,
CONF_CLIENT_ID, CONF_CLIENT_ID,
@ -53,7 +53,6 @@ class MastodonConfigFlow(ConfigFlow, domain=DOMAIN):
VERSION = 1 VERSION = 1
MINOR_VERSION = 2 MINOR_VERSION = 2
config_entry: ConfigEntry
def check_connection( def check_connection(
self, self,