Bump Brother library to version 0.1.20 (#43628)

This commit is contained in:
Maciej Bieniek 2020-11-28 21:17:16 +01:00 committed by GitHub
parent 337b8d279e
commit a4ae2d210e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 12 deletions

View file

@ -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==0.1.18"], "requirements": ["brother==0.1.20"],
"zeroconf": [{"type": "_printer._tcp.local.", "name":"Brother*"}], "zeroconf": [{"type": "_printer._tcp.local.", "name":"Brother*"}],
"config_flow": true, "config_flow": true,
"quality_scale": "platinum" "quality_scale": "platinum"

View file

@ -1,9 +1,6 @@
"""Support for the Brother service.""" """Support for the Brother service."""
from datetime import timedelta
from homeassistant.const import DEVICE_CLASS_TIMESTAMP from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.util.dt import utcnow
from .const import ( from .const import (
ATTR_BLACK_DRUM_COUNTER, ATTR_BLACK_DRUM_COUNTER,
@ -79,8 +76,7 @@ class BrotherPrinterSensor(CoordinatorEntity):
def state(self): def state(self):
"""Return the state.""" """Return the state."""
if self.kind == ATTR_UPTIME: if self.kind == ATTR_UPTIME:
uptime = utcnow() - timedelta(seconds=self.coordinator.data.get(self.kind)) return self.coordinator.data.get(self.kind).isoformat()
return uptime.replace(microsecond=0).isoformat()
return self.coordinator.data.get(self.kind) return self.coordinator.data.get(self.kind)
@property @property

View file

@ -383,7 +383,7 @@ bravia-tv==1.0.8
broadlink==0.16.0 broadlink==0.16.0
# homeassistant.components.brother # homeassistant.components.brother
brother==0.1.18 brother==0.1.20
# homeassistant.components.brottsplatskartan # homeassistant.components.brottsplatskartan
brottsplatskartan==0.0.1 brottsplatskartan==0.0.1

View file

@ -207,7 +207,7 @@ bravia-tv==1.0.8
broadlink==0.16.0 broadlink==0.16.0
# homeassistant.components.brother # homeassistant.components.brother
brother==0.1.18 brother==0.1.20
# homeassistant.components.bsblan # homeassistant.components.bsblan
bsblan==0.4.0 bsblan==0.4.0

View file

@ -16,7 +16,7 @@ from homeassistant.const import (
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component
from homeassistant.util.dt import UTC, utcnow from homeassistant.util.dt import UTC, utcnow
from tests.async_mock import patch from tests.async_mock import Mock, patch
from tests.common import async_fire_time_changed, load_fixture from tests.common import async_fire_time_changed, load_fixture
from tests.components.brother import init_integration from tests.components.brother import init_integration
@ -39,9 +39,7 @@ async def test_sensors(hass):
disabled_by=None, disabled_by=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( with patch("brother.datetime", utcnow=Mock(return_value=test_time)), patch(
"homeassistant.components.brother.sensor.utcnow", return_value=test_time
), patch(
"brother.Brother._get_data", "brother.Brother._get_data",
return_value=json.loads(load_fixture("brother_printer_data.json")), return_value=json.loads(load_fixture("brother_printer_data.json")),
): ):