EntityDescription doesn't need to be generic for NextDNS binary sensor and switch platforms (#116697)

This commit is contained in:
Maciej Bieniek 2024-05-03 13:56:38 +02:00 committed by GitHub
parent cb26e3c633
commit 3c3a948c33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 82 additions and 87 deletions

View File

@ -4,7 +4,6 @@ from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import Generic
from nextdns import ConnectionStatus from nextdns import ConnectionStatus
@ -19,29 +18,27 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import NextDnsConfigEntry from . import NextDnsConfigEntry
from .coordinator import CoordinatorDataT, NextDnsUpdateCoordinator from .coordinator import NextDnsUpdateCoordinator
PARALLEL_UPDATES = 1 PARALLEL_UPDATES = 1
@dataclass(frozen=True, kw_only=True) @dataclass(frozen=True, kw_only=True)
class NextDnsBinarySensorEntityDescription( class NextDnsBinarySensorEntityDescription(BinarySensorEntityDescription):
BinarySensorEntityDescription, Generic[CoordinatorDataT]
):
"""NextDNS binary sensor entity description.""" """NextDNS binary sensor entity description."""
state: Callable[[CoordinatorDataT, str], bool] state: Callable[[ConnectionStatus, str], bool]
SENSORS = ( SENSORS = (
NextDnsBinarySensorEntityDescription[ConnectionStatus]( NextDnsBinarySensorEntityDescription(
key="this_device_nextdns_connection_status", key="this_device_nextdns_connection_status",
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
translation_key="device_connection_status", translation_key="device_connection_status",
device_class=BinarySensorDeviceClass.CONNECTIVITY, device_class=BinarySensorDeviceClass.CONNECTIVITY,
state=lambda data, _: data.connected, state=lambda data, _: data.connected,
), ),
NextDnsBinarySensorEntityDescription[ConnectionStatus]( NextDnsBinarySensorEntityDescription(
key="this_device_profile_connection_status", key="this_device_profile_connection_status",
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
translation_key="device_profile_connection_status", translation_key="device_profile_connection_status",

View File

@ -4,7 +4,7 @@ from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Generic from typing import Any
from aiohttp import ClientError from aiohttp import ClientError
from aiohttp.client_exceptions import ClientConnectorError from aiohttp.client_exceptions import ClientConnectorError
@ -18,503 +18,501 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import NextDnsConfigEntry from . import NextDnsConfigEntry
from .coordinator import CoordinatorDataT, NextDnsUpdateCoordinator from .coordinator import NextDnsUpdateCoordinator
PARALLEL_UPDATES = 1 PARALLEL_UPDATES = 1
@dataclass(frozen=True, kw_only=True) @dataclass(frozen=True, kw_only=True)
class NextDnsSwitchEntityDescription( class NextDnsSwitchEntityDescription(SwitchEntityDescription):
SwitchEntityDescription, Generic[CoordinatorDataT]
):
"""NextDNS switch entity description.""" """NextDNS switch entity description."""
state: Callable[[CoordinatorDataT], bool] state: Callable[[Settings], bool]
SWITCHES = ( SWITCHES = (
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_page", key="block_page",
translation_key="block_page", translation_key="block_page",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_page, state=lambda data: data.block_page,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="cache_boost", key="cache_boost",
translation_key="cache_boost", translation_key="cache_boost",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.cache_boost, state=lambda data: data.cache_boost,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="cname_flattening", key="cname_flattening",
translation_key="cname_flattening", translation_key="cname_flattening",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.cname_flattening, state=lambda data: data.cname_flattening,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="anonymized_ecs", key="anonymized_ecs",
translation_key="anonymized_ecs", translation_key="anonymized_ecs",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.anonymized_ecs, state=lambda data: data.anonymized_ecs,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="logs", key="logs",
translation_key="logs", translation_key="logs",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.logs, state=lambda data: data.logs,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="web3", key="web3",
translation_key="web3", translation_key="web3",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.web3, state=lambda data: data.web3,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="allow_affiliate", key="allow_affiliate",
translation_key="allow_affiliate", translation_key="allow_affiliate",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.allow_affiliate, state=lambda data: data.allow_affiliate,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_disguised_trackers", key="block_disguised_trackers",
translation_key="block_disguised_trackers", translation_key="block_disguised_trackers",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_disguised_trackers, state=lambda data: data.block_disguised_trackers,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="ai_threat_detection", key="ai_threat_detection",
translation_key="ai_threat_detection", translation_key="ai_threat_detection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.ai_threat_detection, state=lambda data: data.ai_threat_detection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_csam", key="block_csam",
translation_key="block_csam", translation_key="block_csam",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_csam, state=lambda data: data.block_csam,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_ddns", key="block_ddns",
translation_key="block_ddns", translation_key="block_ddns",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_ddns, state=lambda data: data.block_ddns,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_nrd", key="block_nrd",
translation_key="block_nrd", translation_key="block_nrd",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_nrd, state=lambda data: data.block_nrd,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_parked_domains", key="block_parked_domains",
translation_key="block_parked_domains", translation_key="block_parked_domains",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_parked_domains, state=lambda data: data.block_parked_domains,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="cryptojacking_protection", key="cryptojacking_protection",
translation_key="cryptojacking_protection", translation_key="cryptojacking_protection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.cryptojacking_protection, state=lambda data: data.cryptojacking_protection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="dga_protection", key="dga_protection",
translation_key="dga_protection", translation_key="dga_protection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.dga_protection, state=lambda data: data.dga_protection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="dns_rebinding_protection", key="dns_rebinding_protection",
translation_key="dns_rebinding_protection", translation_key="dns_rebinding_protection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.dns_rebinding_protection, state=lambda data: data.dns_rebinding_protection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="google_safe_browsing", key="google_safe_browsing",
translation_key="google_safe_browsing", translation_key="google_safe_browsing",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.google_safe_browsing, state=lambda data: data.google_safe_browsing,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="idn_homograph_attacks_protection", key="idn_homograph_attacks_protection",
translation_key="idn_homograph_attacks_protection", translation_key="idn_homograph_attacks_protection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.idn_homograph_attacks_protection, state=lambda data: data.idn_homograph_attacks_protection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="threat_intelligence_feeds", key="threat_intelligence_feeds",
translation_key="threat_intelligence_feeds", translation_key="threat_intelligence_feeds",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.threat_intelligence_feeds, state=lambda data: data.threat_intelligence_feeds,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="typosquatting_protection", key="typosquatting_protection",
translation_key="typosquatting_protection", translation_key="typosquatting_protection",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.typosquatting_protection, state=lambda data: data.typosquatting_protection,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_bypass_methods", key="block_bypass_methods",
translation_key="block_bypass_methods", translation_key="block_bypass_methods",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.block_bypass_methods, state=lambda data: data.block_bypass_methods,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="safesearch", key="safesearch",
translation_key="safesearch", translation_key="safesearch",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.safesearch, state=lambda data: data.safesearch,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="youtube_restricted_mode", key="youtube_restricted_mode",
translation_key="youtube_restricted_mode", translation_key="youtube_restricted_mode",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
state=lambda data: data.youtube_restricted_mode, state=lambda data: data.youtube_restricted_mode,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_9gag", key="block_9gag",
translation_key="block_9gag", translation_key="block_9gag",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_9gag, state=lambda data: data.block_9gag,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_amazon", key="block_amazon",
translation_key="block_amazon", translation_key="block_amazon",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_amazon, state=lambda data: data.block_amazon,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_bereal", key="block_bereal",
translation_key="block_bereal", translation_key="block_bereal",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_bereal, state=lambda data: data.block_bereal,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_blizzard", key="block_blizzard",
translation_key="block_blizzard", translation_key="block_blizzard",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_blizzard, state=lambda data: data.block_blizzard,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_chatgpt", key="block_chatgpt",
translation_key="block_chatgpt", translation_key="block_chatgpt",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_chatgpt, state=lambda data: data.block_chatgpt,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_dailymotion", key="block_dailymotion",
translation_key="block_dailymotion", translation_key="block_dailymotion",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_dailymotion, state=lambda data: data.block_dailymotion,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_discord", key="block_discord",
translation_key="block_discord", translation_key="block_discord",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_discord, state=lambda data: data.block_discord,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_disneyplus", key="block_disneyplus",
translation_key="block_disneyplus", translation_key="block_disneyplus",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_disneyplus, state=lambda data: data.block_disneyplus,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_ebay", key="block_ebay",
translation_key="block_ebay", translation_key="block_ebay",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_ebay, state=lambda data: data.block_ebay,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_facebook", key="block_facebook",
translation_key="block_facebook", translation_key="block_facebook",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_facebook, state=lambda data: data.block_facebook,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_fortnite", key="block_fortnite",
translation_key="block_fortnite", translation_key="block_fortnite",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_fortnite, state=lambda data: data.block_fortnite,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_google_chat", key="block_google_chat",
translation_key="block_google_chat", translation_key="block_google_chat",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_google_chat, state=lambda data: data.block_google_chat,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_hbomax", key="block_hbomax",
translation_key="block_hbomax", translation_key="block_hbomax",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_hbomax, state=lambda data: data.block_hbomax,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_hulu", key="block_hulu",
name="Block Hulu", name="Block Hulu",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_hulu, state=lambda data: data.block_hulu,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_imgur", key="block_imgur",
translation_key="block_imgur", translation_key="block_imgur",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_imgur, state=lambda data: data.block_imgur,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_instagram", key="block_instagram",
translation_key="block_instagram", translation_key="block_instagram",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_instagram, state=lambda data: data.block_instagram,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_leagueoflegends", key="block_leagueoflegends",
translation_key="block_leagueoflegends", translation_key="block_leagueoflegends",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_leagueoflegends, state=lambda data: data.block_leagueoflegends,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_mastodon", key="block_mastodon",
translation_key="block_mastodon", translation_key="block_mastodon",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_mastodon, state=lambda data: data.block_mastodon,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_messenger", key="block_messenger",
translation_key="block_messenger", translation_key="block_messenger",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_messenger, state=lambda data: data.block_messenger,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_minecraft", key="block_minecraft",
translation_key="block_minecraft", translation_key="block_minecraft",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_minecraft, state=lambda data: data.block_minecraft,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_netflix", key="block_netflix",
translation_key="block_netflix", translation_key="block_netflix",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_netflix, state=lambda data: data.block_netflix,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_pinterest", key="block_pinterest",
translation_key="block_pinterest", translation_key="block_pinterest",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_pinterest, state=lambda data: data.block_pinterest,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_playstation_network", key="block_playstation_network",
translation_key="block_playstation_network", translation_key="block_playstation_network",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_playstation_network, state=lambda data: data.block_playstation_network,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_primevideo", key="block_primevideo",
translation_key="block_primevideo", translation_key="block_primevideo",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_primevideo, state=lambda data: data.block_primevideo,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_reddit", key="block_reddit",
translation_key="block_reddit", translation_key="block_reddit",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_reddit, state=lambda data: data.block_reddit,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_roblox", key="block_roblox",
translation_key="block_roblox", translation_key="block_roblox",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_roblox, state=lambda data: data.block_roblox,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_signal", key="block_signal",
translation_key="block_signal", translation_key="block_signal",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_signal, state=lambda data: data.block_signal,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_skype", key="block_skype",
translation_key="block_skype", translation_key="block_skype",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_skype, state=lambda data: data.block_skype,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_snapchat", key="block_snapchat",
translation_key="block_snapchat", translation_key="block_snapchat",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_snapchat, state=lambda data: data.block_snapchat,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_spotify", key="block_spotify",
translation_key="block_spotify", translation_key="block_spotify",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_spotify, state=lambda data: data.block_spotify,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_steam", key="block_steam",
translation_key="block_steam", translation_key="block_steam",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_steam, state=lambda data: data.block_steam,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_telegram", key="block_telegram",
translation_key="block_telegram", translation_key="block_telegram",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_telegram, state=lambda data: data.block_telegram,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_tiktok", key="block_tiktok",
translation_key="block_tiktok", translation_key="block_tiktok",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_tiktok, state=lambda data: data.block_tiktok,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_tinder", key="block_tinder",
translation_key="block_tinder", translation_key="block_tinder",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_tinder, state=lambda data: data.block_tinder,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_tumblr", key="block_tumblr",
translation_key="block_tumblr", translation_key="block_tumblr",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_tumblr, state=lambda data: data.block_tumblr,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_twitch", key="block_twitch",
translation_key="block_twitch", translation_key="block_twitch",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_twitch, state=lambda data: data.block_twitch,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_twitter", key="block_twitter",
translation_key="block_twitter", translation_key="block_twitter",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_twitter, state=lambda data: data.block_twitter,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_vimeo", key="block_vimeo",
translation_key="block_vimeo", translation_key="block_vimeo",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_vimeo, state=lambda data: data.block_vimeo,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_vk", key="block_vk",
translation_key="block_vk", translation_key="block_vk",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_vk, state=lambda data: data.block_vk,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_whatsapp", key="block_whatsapp",
translation_key="block_whatsapp", translation_key="block_whatsapp",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_whatsapp, state=lambda data: data.block_whatsapp,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_xboxlive", key="block_xboxlive",
translation_key="block_xboxlive", translation_key="block_xboxlive",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_xboxlive, state=lambda data: data.block_xboxlive,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_youtube", key="block_youtube",
translation_key="block_youtube", translation_key="block_youtube",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_youtube, state=lambda data: data.block_youtube,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_zoom", key="block_zoom",
translation_key="block_zoom", translation_key="block_zoom",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_zoom, state=lambda data: data.block_zoom,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_dating", key="block_dating",
translation_key="block_dating", translation_key="block_dating",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_dating, state=lambda data: data.block_dating,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_gambling", key="block_gambling",
translation_key="block_gambling", translation_key="block_gambling",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_gambling, state=lambda data: data.block_gambling,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_online_gaming", key="block_online_gaming",
translation_key="block_online_gaming", translation_key="block_online_gaming",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_online_gaming, state=lambda data: data.block_online_gaming,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_piracy", key="block_piracy",
translation_key="block_piracy", translation_key="block_piracy",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_piracy, state=lambda data: data.block_piracy,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_porn", key="block_porn",
translation_key="block_porn", translation_key="block_porn",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_porn, state=lambda data: data.block_porn,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_social_networks", key="block_social_networks",
translation_key="block_social_networks", translation_key="block_social_networks",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
entity_registry_enabled_default=False, entity_registry_enabled_default=False,
state=lambda data: data.block_social_networks, state=lambda data: data.block_social_networks,
), ),
NextDnsSwitchEntityDescription[Settings]( NextDnsSwitchEntityDescription(
key="block_video_streaming", key="block_video_streaming",
translation_key="block_video_streaming", translation_key="block_video_streaming",
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,