Bump brother to 2.2.0 (#88618)
parent
205c5ccbf3
commit
64e39c9c81
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import async_timeout
|
import async_timeout
|
||||||
from brother import Brother, BrotherSensors, SnmpError, UnsupportedModel
|
from brother import Brother, BrotherSensors, SnmpError, UnsupportedModelError
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_TYPE, Platform
|
from homeassistant.const import CONF_HOST, CONF_TYPE, Platform
|
||||||
|
@ -81,6 +81,6 @@ class BrotherDataUpdateCoordinator(DataUpdateCoordinator[BrotherSensors]):
|
||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(20):
|
async with async_timeout.timeout(20):
|
||||||
data = await self.brother.async_update()
|
data = await self.brother.async_update()
|
||||||
except (ConnectionError, SnmpError, UnsupportedModel) as error:
|
except (ConnectionError, SnmpError, UnsupportedModelError) as error:
|
||||||
raise UpdateFailed(error) from error
|
raise UpdateFailed(error) from error
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from brother import Brother, SnmpError, UnsupportedModel
|
from brother import Brother, SnmpError, UnsupportedModelError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries, exceptions
|
from homeassistant import config_entries, exceptions
|
||||||
|
@ -62,7 +62,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
errors["base"] = "cannot_connect"
|
errors["base"] = "cannot_connect"
|
||||||
except SnmpError:
|
except SnmpError:
|
||||||
errors["base"] = "snmp_error"
|
errors["base"] = "snmp_error"
|
||||||
except UnsupportedModel:
|
except UnsupportedModelError:
|
||||||
return self.async_abort(reason="unsupported_model")
|
return self.async_abort(reason="unsupported_model")
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
|
@ -86,7 +86,7 @@ class BrotherConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self.host, snmp_engine=snmp_engine, model=model
|
self.host, snmp_engine=snmp_engine, model=model
|
||||||
)
|
)
|
||||||
await self.brother.async_update()
|
await self.brother.async_update()
|
||||||
except UnsupportedModel:
|
except UnsupportedModelError:
|
||||||
return self.async_abort(reason="unsupported_model")
|
return self.async_abort(reason="unsupported_model")
|
||||||
except (ConnectionError, SnmpError):
|
except (ConnectionError, SnmpError):
|
||||||
return self.async_abort(reason="cannot_connect")
|
return self.async_abort(reason="cannot_connect")
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"iot_class": "local_polling",
|
"iot_class": "local_polling",
|
||||||
"loggers": ["brother", "pyasn1", "pysmi", "pysnmp"],
|
"loggers": ["brother", "pyasn1", "pysmi", "pysnmp"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["brother==2.1.1"],
|
"requirements": ["brother==2.2.0"],
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
{
|
{
|
||||||
"type": "_printer._tcp.local.",
|
"type": "_printer._tcp.local.",
|
||||||
|
|
|
@ -480,7 +480,7 @@ boto3==1.20.24
|
||||||
broadlink==0.18.3
|
broadlink==0.18.3
|
||||||
|
|
||||||
# homeassistant.components.brother
|
# homeassistant.components.brother
|
||||||
brother==2.1.1
|
brother==2.2.0
|
||||||
|
|
||||||
# homeassistant.components.brottsplatskartan
|
# homeassistant.components.brottsplatskartan
|
||||||
brottsplatskartan==0.0.1
|
brottsplatskartan==0.0.1
|
||||||
|
|
|
@ -393,7 +393,7 @@ boschshcpy==0.2.35
|
||||||
broadlink==0.18.3
|
broadlink==0.18.3
|
||||||
|
|
||||||
# homeassistant.components.brother
|
# homeassistant.components.brother
|
||||||
brother==2.1.1
|
brother==2.2.0
|
||||||
|
|
||||||
# homeassistant.components.brunt
|
# homeassistant.components.brunt
|
||||||
brunt==1.2.0
|
brunt==1.2.0
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import json
|
import json
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from brother import SnmpError, UnsupportedModel
|
from brother import SnmpError, UnsupportedModelError
|
||||||
|
|
||||||
from homeassistant import data_entry_flow
|
from homeassistant import data_entry_flow
|
||||||
from homeassistant.components import zeroconf
|
from homeassistant.components import zeroconf
|
||||||
|
@ -116,7 +116,7 @@ async def test_snmp_error(hass: HomeAssistant) -> None:
|
||||||
async def test_unsupported_model_error(hass: HomeAssistant) -> None:
|
async def test_unsupported_model_error(hass: HomeAssistant) -> None:
|
||||||
"""Test unsupported printer model error."""
|
"""Test unsupported printer model error."""
|
||||||
with patch("brother.Brother.initialize"), patch(
|
with patch("brother.Brother.initialize"), patch(
|
||||||
"brother.Brother._get_data", side_effect=UnsupportedModel("error")
|
"brother.Brother._get_data", side_effect=UnsupportedModelError("error")
|
||||||
):
|
):
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
DOMAIN, context={"source": SOURCE_USER}, data=CONFIG
|
||||||
|
|
|
@ -22,7 +22,7 @@ async def test_entry_diagnostics(
|
||||||
diagnostics_data = json.loads(load_fixture("diagnostics_data.json", "brother"))
|
diagnostics_data = json.loads(load_fixture("diagnostics_data.json", "brother"))
|
||||||
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
|
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
|
||||||
with patch("brother.Brother.initialize"), patch(
|
with patch("brother.Brother.initialize"), patch(
|
||||||
"brother.datetime", utcnow=Mock(return_value=test_time)
|
"brother.datetime", now=Mock(return_value=test_time)
|
||||||
), patch(
|
), patch(
|
||||||
"brother.Brother._get_data",
|
"brother.Brother._get_data",
|
||||||
return_value=json.loads(load_fixture("printer_data.json", "brother")),
|
return_value=json.loads(load_fixture("printer_data.json", "brother")),
|
||||||
|
|
|
@ -48,7 +48,7 @@ async def test_sensors(hass: HomeAssistant) -> None:
|
||||||
)
|
)
|
||||||
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
|
test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC)
|
||||||
with patch("brother.Brother.initialize"), patch(
|
with patch("brother.Brother.initialize"), patch(
|
||||||
"brother.datetime", utcnow=Mock(return_value=test_time)
|
"brother.datetime", now=Mock(return_value=test_time)
|
||||||
), patch(
|
), patch(
|
||||||
"brother.Brother._get_data",
|
"brother.Brother._get_data",
|
||||||
return_value=json.loads(load_fixture("printer_data.json", "brother")),
|
return_value=json.loads(load_fixture("printer_data.json", "brother")),
|
||||||
|
|
Loading…
Reference in New Issue