Bump brother
library to version 1.1.0 (#57892)
This commit is contained in:
parent
0b932b53c9
commit
85c6942f55
5 changed files with 26 additions and 5 deletions
|
@ -90,11 +90,14 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
self._async_abort_entries_match({CONF_HOST: self.host})
|
||||
|
||||
snmp_engine = get_snmp_engine(self.hass)
|
||||
model = discovery_info.get("properties", {}).get("product")
|
||||
|
||||
self.brother = Brother(self.host, snmp_engine=snmp_engine)
|
||||
try:
|
||||
self.brother = Brother(self.host, snmp_engine=snmp_engine, model=model)
|
||||
await self.brother.async_update()
|
||||
except (ConnectionError, SnmpError, UnsupportedModel):
|
||||
except UnsupportedModel:
|
||||
return self.async_abort(reason="unsupported_model")
|
||||
except (ConnectionError, SnmpError):
|
||||
return self.async_abort(reason="cannot_connect")
|
||||
|
||||
# Check if already configured
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Brother Printer",
|
||||
"documentation": "https://www.home-assistant.io/integrations/brother",
|
||||
"codeowners": ["@bieniu"],
|
||||
"requirements": ["brother==1.0.2"],
|
||||
"requirements": ["brother==1.1.0"],
|
||||
"zeroconf": [
|
||||
{
|
||||
"type": "_printer._tcp.local.",
|
||||
|
|
|
@ -431,7 +431,7 @@ bravia-tv==1.0.11
|
|||
broadlink==0.17.0
|
||||
|
||||
# homeassistant.components.brother
|
||||
brother==1.0.2
|
||||
brother==1.1.0
|
||||
|
||||
# homeassistant.components.brottsplatskartan
|
||||
brottsplatskartan==0.0.1
|
||||
|
|
|
@ -269,7 +269,7 @@ bravia-tv==1.0.11
|
|||
broadlink==0.17.0
|
||||
|
||||
# homeassistant.components.brother
|
||||
brother==1.0.2
|
||||
brother==1.1.0
|
||||
|
||||
# homeassistant.components.bsblan
|
||||
bsblan==0.4.0
|
||||
|
|
|
@ -150,6 +150,24 @@ async def test_zeroconf_snmp_error(hass):
|
|||
assert result["reason"] == "cannot_connect"
|
||||
|
||||
|
||||
async def test_zeroconf_unsupported_model(hass):
|
||||
"""Test unsupported printer model error."""
|
||||
with patch("brother.Brother._get_data") as mock_get_data:
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_ZEROCONF},
|
||||
data={
|
||||
"hostname": "example.local.",
|
||||
"name": "Brother Printer",
|
||||
"properties": {"product": "MFC-8660DN"},
|
||||
},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "unsupported_model"
|
||||
assert len(mock_get_data.mock_calls) == 0
|
||||
|
||||
|
||||
async def test_zeroconf_device_exists_abort(hass):
|
||||
"""Test we abort zeroconf flow if Brother printer already configured."""
|
||||
with patch(
|
||||
|
|
Loading…
Add table
Reference in a new issue