mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Bump brother
library to version 1.1.0 (#57892)
This commit is contained in:
parent
0b932b53c9
commit
85c6942f55
@ -90,11 +90,14 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
self._async_abort_entries_match({CONF_HOST: self.host})
|
self._async_abort_entries_match({CONF_HOST: self.host})
|
||||||
|
|
||||||
snmp_engine = get_snmp_engine(self.hass)
|
snmp_engine = get_snmp_engine(self.hass)
|
||||||
|
model = discovery_info.get("properties", {}).get("product")
|
||||||
|
|
||||||
self.brother = Brother(self.host, snmp_engine=snmp_engine)
|
|
||||||
try:
|
try:
|
||||||
|
self.brother = Brother(self.host, snmp_engine=snmp_engine, model=model)
|
||||||
await self.brother.async_update()
|
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")
|
return self.async_abort(reason="cannot_connect")
|
||||||
|
|
||||||
# Check if already configured
|
# Check if already configured
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Brother Printer",
|
"name": "Brother Printer",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/brother",
|
"documentation": "https://www.home-assistant.io/integrations/brother",
|
||||||
"codeowners": ["@bieniu"],
|
"codeowners": ["@bieniu"],
|
||||||
"requirements": ["brother==1.0.2"],
|
"requirements": ["brother==1.1.0"],
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
{
|
{
|
||||||
"type": "_printer._tcp.local.",
|
"type": "_printer._tcp.local.",
|
||||||
|
@ -431,7 +431,7 @@ bravia-tv==1.0.11
|
|||||||
broadlink==0.17.0
|
broadlink==0.17.0
|
||||||
|
|
||||||
# homeassistant.components.brother
|
# homeassistant.components.brother
|
||||||
brother==1.0.2
|
brother==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.brottsplatskartan
|
# homeassistant.components.brottsplatskartan
|
||||||
brottsplatskartan==0.0.1
|
brottsplatskartan==0.0.1
|
||||||
|
@ -269,7 +269,7 @@ bravia-tv==1.0.11
|
|||||||
broadlink==0.17.0
|
broadlink==0.17.0
|
||||||
|
|
||||||
# homeassistant.components.brother
|
# homeassistant.components.brother
|
||||||
brother==1.0.2
|
brother==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.bsblan
|
# homeassistant.components.bsblan
|
||||||
bsblan==0.4.0
|
bsblan==0.4.0
|
||||||
|
@ -150,6 +150,24 @@ async def test_zeroconf_snmp_error(hass):
|
|||||||
assert result["reason"] == "cannot_connect"
|
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):
|
async def test_zeroconf_device_exists_abort(hass):
|
||||||
"""Test we abort zeroconf flow if Brother printer already configured."""
|
"""Test we abort zeroconf flow if Brother printer already configured."""
|
||||||
with patch(
|
with patch(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user