Skip to content

Commit

Permalink
Remove heuristic friendly name filtering against non-LTE devices
Browse files Browse the repository at this point in the history
This is fragile at best, and actually prevents some devices from being
considered. Leave it to the user to decide instead.
  • Loading branch information
scop committed Dec 14, 2022
1 parent c431a1f commit f12e378
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 23 deletions.
12 changes: 0 additions & 12 deletions homeassistant/components/huawei_lte/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from collections.abc import Mapping
import logging
import re
from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse

Expand Down Expand Up @@ -236,17 +235,6 @@ def get_device_info(
async def async_step_ssdp(self, discovery_info: ssdp.SsdpServiceInfo) -> FlowResult:
"""Handle SSDP initiated config flow."""

# Attempt to distinguish from other non-LTE Huawei router devices, at least
# some of the ones we are interested in include friendlyNames like
# "Mobile Wi-Fi", "4G CPE 3", and "华为4G路由 B525". (The last one is
# an example why there are no word boundary markers around the regex.)
if not re.search(
r"[45]G|LTE|Mobile",
discovery_info.upnp.get(ssdp.ATTR_UPNP_FRIENDLY_NAME, ""),
re.IGNORECASE,
):
return self.async_abort(reason="not_huawei_lte")

if TYPE_CHECKING:
assert discovery_info.ssdp_location
url = url_normalize(
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/huawei_lte/strings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"config": {
"abort": {
"not_huawei_lte": "Not a Huawei LTE device",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
},
"error": {
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/huawei_lte/translations/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"config": {
"abort": {
"not_huawei_lte": "Not a Huawei LTE device",
"reauth_successful": "Re-authentication was successful"
},
"error": {
Expand Down
9 changes: 0 additions & 9 deletions tests/components/huawei_lte/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,6 @@ async def test_success(hass, login_requests_mock):
"errors": {},
},
),
(
{
ssdp.ATTR_UPNP_FRIENDLY_NAME: "Some other device",
},
{
"type": data_entry_flow.FlowResultType.ABORT,
"reason": "not_huawei_lte",
},
),
),
)
async def test_ssdp(hass, upnp_data, expected_result):
Expand Down

0 comments on commit f12e378

Please sign in to comment.