Skip to content

Commit 9b17d90

Browse files
authored
Suppress 'found an unsupported model' warning (#1850)
This is not needed anymore, as #1845 reports on missing identifiers and roborocks are covered by a wildcard matcher in devicefactory. The original reason for adding this warning was to gather a list of devices that we should add to the supported devices list for devicefactory, but I think we are well covered now at least for roborock (closing the issues below, other integrations need to be adapted to use wildcards where feasible).
1 parent 4e2c5ee commit 9b17d90

File tree

2 files changed

+0
-28
lines changed

2 files changed

+0
-28
lines changed

miio/device.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@ def _fetch_info(self) -> DeviceInfo:
138138
devinfo = DeviceInfo(self.send("miIO.info"))
139139
self._info = devinfo
140140
_LOGGER.debug("Detected model %s", devinfo.model)
141-
cls = self.__class__.__name__
142-
# Ignore bases and generic classes
143-
bases = ["Device", "MiotDevice", "GenericMiot"]
144-
if devinfo.model not in self.supported_models and cls not in bases:
145-
_LOGGER.warning(
146-
"Found an unsupported model '%s' for class '%s'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/",
147-
devinfo.model,
148-
cls,
149-
)
150141

151142
return devinfo
152143
except PayloadDecodeException as ex:

miio/tests/test_device.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
DeviceStatus,
1111
MiotDevice,
1212
PropertyDescriptor,
13-
RoborockVacuum,
1413
)
1514
from miio.exceptions import DeviceInfoUnavailableException, PayloadDecodeException
1615

@@ -120,24 +119,6 @@ def test_forced_model(mocker):
120119
info.assert_not_called()
121120

122121

123-
@pytest.mark.parametrize(
124-
"cls,hidden", [(Device, True), (MiotDevice, True), (RoborockVacuum, False)]
125-
)
126-
def test_missing_supported(mocker, caplog, cls, hidden):
127-
"""Make sure warning is logged if the device is unsupported for the class."""
128-
_ = mocker.patch("miio.Device.send")
129-
130-
d = cls("127.0.0.1", "68ffffffffffffffffffffffffffffff")
131-
d._fetch_info()
132-
133-
if hidden:
134-
assert "Found an unsupported model" not in caplog.text
135-
assert f"for class {cls.__name__!r}" not in caplog.text
136-
else:
137-
assert "Found an unsupported model" in caplog.text
138-
assert f"for class {cls.__name__!r}" in caplog.text
139-
140-
141122
@pytest.mark.parametrize("cls", DEVICE_CLASSES)
142123
def test_device_ctor_model(cls):
143124
"""Make sure that every device subclass ctor accepts model kwarg."""

0 commit comments

Comments
 (0)