From 2f51c3936c0a6997767e7e36cd15e9d4eb670381 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek Date: Thu, 24 Sep 2026 21:34:23 +0200 Subject: [PATCH] Add support for new NextDNS settings (#182102) --- homeassistant/components/nextdns/icons.json | 3 + homeassistant/components/nextdns/strings.json | 15 ++ homeassistant/components/nextdns/switch.py | 30 +++ .../components/nextdns/fixtures/settings.json | 12 +- .../nextdns/snapshots/test_switch.ambr | 250 ++++++++++++++++++ 5 files changed, 304 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/nextdns/icons.json b/homeassistant/components/nextdns/icons.json index 95141681f213..7c21a31801f5 100644 --- a/homeassistant/components/nextdns/icons.json +++ b/homeassistant/components/nextdns/icons.json @@ -207,6 +207,9 @@ "block_tumblr": { "default": "mdi:image-outline" }, + "block_tunneling_endpoints": { + "default": "mdi:vpn" + }, "block_twitch": { "default": "mdi:twitch" }, diff --git a/homeassistant/components/nextdns/strings.json b/homeassistant/components/nextdns/strings.json index b4a7f1d889aa..dfc3d6b18226 100644 --- a/homeassistant/components/nextdns/strings.json +++ b/homeassistant/components/nextdns/strings.json @@ -210,12 +210,18 @@ "block_dailymotion": { "name": "Block Dailymotion" }, + "block_data_drop_services": { + "name": "Block data-drop services" + }, "block_dating": { "name": "Block dating" }, "block_ddns": { "name": "Block dynamic DNS hostnames" }, + "block_decentralized_web_gateways": { + "name": "Block decentralized web gateways" + }, "block_discord": { "name": "Block Discord" }, @@ -234,6 +240,9 @@ "block_fortnite": { "name": "Block Fortnite" }, + "block_free_hosting_domains": { + "name": "Block free hosting domains" + }, "block_gambling": { "name": "Block gambling" }, @@ -297,6 +306,9 @@ "block_reddit": { "name": "Block Reddit" }, + "block_residential_hosting": { + "name": "Block residential hosting" + }, "block_roblox": { "name": "Block Roblox" }, @@ -330,6 +342,9 @@ "block_tumblr": { "name": "Block Tumblr" }, + "block_tunneling_endpoints": { + "name": "Block tunneling endpoints" + }, "block_twitch": { "name": "Block Twitch" }, diff --git a/homeassistant/components/nextdns/switch.py b/homeassistant/components/nextdns/switch.py index c207baa956be..c921190f342a 100644 --- a/homeassistant/components/nextdns/switch.py +++ b/homeassistant/components/nextdns/switch.py @@ -114,6 +114,36 @@ SWITCHES = ( entity_category=EntityCategory.CONFIG, state=lambda data: data.block_parked_domains, ), + NextDnsSwitchEntityDescription( + key="block_data_drop_services", + translation_key="block_data_drop_services", + entity_category=EntityCategory.CONFIG, + state=lambda data: data.block_data_drop_services, + ), + NextDnsSwitchEntityDescription( + key="block_decentralized_web_gateways", + translation_key="block_decentralized_web_gateways", + entity_category=EntityCategory.CONFIG, + state=lambda data: data.block_decentralized_web_gateways, + ), + NextDnsSwitchEntityDescription( + key="block_free_hosting_domains", + translation_key="block_free_hosting_domains", + entity_category=EntityCategory.CONFIG, + state=lambda data: data.block_free_hosting_domains, + ), + NextDnsSwitchEntityDescription( + key="block_residential_hosting", + translation_key="block_residential_hosting", + entity_category=EntityCategory.CONFIG, + state=lambda data: data.block_residential_hosting, + ), + NextDnsSwitchEntityDescription( + key="block_tunneling_endpoints", + translation_key="block_tunneling_endpoints", + entity_category=EntityCategory.CONFIG, + state=lambda data: data.block_tunneling_endpoints, + ), NextDnsSwitchEntityDescription( key="cryptojacking_protection", translation_key="cryptojacking_protection", diff --git a/tests/components/nextdns/fixtures/settings.json b/tests/components/nextdns/fixtures/settings.json index 3bebb1a0b8fa..b4f2b30c9571 100644 --- a/tests/components/nextdns/fixtures/settings.json +++ b/tests/components/nextdns/fixtures/settings.json @@ -5,11 +5,16 @@ "bav": true, "block_bypass_methods": true, "block_csam": true, + "block_data_drop_services": true, + "block_decentralized_web_gateways": true, "block_ddns": true, + "block_free_hosting_domains": true, "block_disguised_trackers": true, "block_nrd": true, "block_page": false, "block_parked_domains": true, + "block_residential_hosting": true, + "block_tunneling_endpoints": true, "cache_boost": true, "cname_flattening": true, "cryptojacking_protection": true, @@ -74,10 +79,5 @@ "block_piracy": true, "block_porn": true, "block_social_networks": true, - "block_video_streaming": true, - "block_data_drop_services": true, - "block_decentralized_web_gateways": true, - "block_free_hosting_domains": true, - "block_residential_hosting": true, - "block_tunneling_endpoints": true + "block_video_streaming": true } diff --git a/tests/components/nextdns/snapshots/test_switch.ambr b/tests/components/nextdns/snapshots/test_switch.ambr index 704b58bdbfb5..e32995fcde8c 100644 --- a/tests/components/nextdns/snapshots/test_switch.ambr +++ b/tests/components/nextdns/snapshots/test_switch.ambr @@ -549,6 +549,56 @@ 'state': 'on', }) # --- +# name: test_switch[switch.fake_profile_block_data_drop_services-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.fake_profile_block_data_drop_services', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Block data-drop services', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Block data-drop services', + 'platform': 'nextdns', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'block_data_drop_services', + 'unique_id': 'xyz12_block_data_drop_services', + 'unit_of_measurement': None, + }) +# --- +# name: test_switch[switch.fake_profile_block_data_drop_services-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Fake Profile Block data-drop services', + }), + 'context': , + 'entity_id': 'switch.fake_profile_block_data_drop_services', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_switch[switch.fake_profile_block_dating-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -599,6 +649,56 @@ 'state': 'on', }) # --- +# name: test_switch[switch.fake_profile_block_decentralized_web_gateways-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.fake_profile_block_decentralized_web_gateways', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Block decentralized web gateways', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Block decentralized web gateways', + 'platform': 'nextdns', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'block_decentralized_web_gateways', + 'unique_id': 'xyz12_block_decentralized_web_gateways', + 'unit_of_measurement': None, + }) +# --- +# name: test_switch[switch.fake_profile_block_decentralized_web_gateways-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Fake Profile Block decentralized web gateways', + }), + 'context': , + 'entity_id': 'switch.fake_profile_block_decentralized_web_gateways', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_switch[switch.fake_profile_block_discord-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -949,6 +1049,56 @@ 'state': 'on', }) # --- +# name: test_switch[switch.fake_profile_block_free_hosting_domains-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.fake_profile_block_free_hosting_domains', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Block free hosting domains', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Block free hosting domains', + 'platform': 'nextdns', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'block_free_hosting_domains', + 'unique_id': 'xyz12_block_free_hosting_domains', + 'unit_of_measurement': None, + }) +# --- +# name: test_switch[switch.fake_profile_block_free_hosting_domains-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Fake Profile Block free hosting domains', + }), + 'context': , + 'entity_id': 'switch.fake_profile_block_free_hosting_domains', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_switch[switch.fake_profile_block_gambling-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -1999,6 +2149,56 @@ 'state': 'on', }) # --- +# name: test_switch[switch.fake_profile_block_residential_hosting-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.fake_profile_block_residential_hosting', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Block residential hosting', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Block residential hosting', + 'platform': 'nextdns', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'block_residential_hosting', + 'unique_id': 'xyz12_block_residential_hosting', + 'unit_of_measurement': None, + }) +# --- +# name: test_switch[switch.fake_profile_block_residential_hosting-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Fake Profile Block residential hosting', + }), + 'context': , + 'entity_id': 'switch.fake_profile_block_residential_hosting', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_switch[switch.fake_profile_block_roblox-entry] EntityRegistryEntrySnapshot({ 'aliases': list([ @@ -2549,6 +2749,56 @@ 'state': 'on', }) # --- +# name: test_switch[switch.fake_profile_block_tunneling_endpoints-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': , + 'entity_id': 'switch.fake_profile_block_tunneling_endpoints', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Block tunneling endpoints', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Block tunneling endpoints', + 'platform': 'nextdns', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'block_tunneling_endpoints', + 'unique_id': 'xyz12_block_tunneling_endpoints', + 'unit_of_measurement': None, + }) +# --- +# name: test_switch[switch.fake_profile_block_tunneling_endpoints-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Fake Profile Block tunneling endpoints', + }), + 'context': , + 'entity_id': 'switch.fake_profile_block_tunneling_endpoints', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- # name: test_switch[switch.fake_profile_block_twitch-entry] EntityRegistryEntrySnapshot({ 'aliases': list([