diff --git a/homeassistant/components/brother/manifest.json b/homeassistant/components/brother/manifest.json index bc63de34b2a..0e534147cb1 100644 --- a/homeassistant/components/brother/manifest.json +++ b/homeassistant/components/brother/manifest.json @@ -3,7 +3,7 @@ "name": "Brother Printer", "documentation": "https://www.home-assistant.io/integrations/brother", "codeowners": ["@bieniu"], - "requirements": ["brother==0.1.18"], + "requirements": ["brother==0.1.20"], "zeroconf": [{"type": "_printer._tcp.local.", "name":"Brother*"}], "config_flow": true, "quality_scale": "platinum" diff --git a/homeassistant/components/brother/sensor.py b/homeassistant/components/brother/sensor.py index 97890e83cff..40e2deae67d 100644 --- a/homeassistant/components/brother/sensor.py +++ b/homeassistant/components/brother/sensor.py @@ -1,9 +1,6 @@ """Support for the Brother service.""" -from datetime import timedelta - from homeassistant.const import DEVICE_CLASS_TIMESTAMP from homeassistant.helpers.update_coordinator import CoordinatorEntity -from homeassistant.util.dt import utcnow from .const import ( ATTR_BLACK_DRUM_COUNTER, @@ -79,8 +76,7 @@ class BrotherPrinterSensor(CoordinatorEntity): def state(self): """Return the state.""" if self.kind == ATTR_UPTIME: - uptime = utcnow() - timedelta(seconds=self.coordinator.data.get(self.kind)) - return uptime.replace(microsecond=0).isoformat() + return self.coordinator.data.get(self.kind).isoformat() return self.coordinator.data.get(self.kind) @property diff --git a/requirements_all.txt b/requirements_all.txt index 197d1bc1aa8..c93bdd10b47 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -383,7 +383,7 @@ bravia-tv==1.0.8 broadlink==0.16.0 # homeassistant.components.brother -brother==0.1.18 +brother==0.1.20 # homeassistant.components.brottsplatskartan brottsplatskartan==0.0.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 1ff2ab833f4..41e73aa3db3 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -207,7 +207,7 @@ bravia-tv==1.0.8 broadlink==0.16.0 # homeassistant.components.brother -brother==0.1.18 +brother==0.1.20 # homeassistant.components.bsblan bsblan==0.4.0 diff --git a/tests/components/brother/test_sensor.py b/tests/components/brother/test_sensor.py index ac32e1b983c..3f9ee9394b7 100644 --- a/tests/components/brother/test_sensor.py +++ b/tests/components/brother/test_sensor.py @@ -16,7 +16,7 @@ from homeassistant.const import ( from homeassistant.setup import async_setup_component 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.components.brother import init_integration @@ -39,9 +39,7 @@ async def test_sensors(hass): disabled_by=None, ) test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC) - with patch( - "homeassistant.components.brother.sensor.utcnow", return_value=test_time - ), patch( + with patch("brother.datetime", utcnow=Mock(return_value=test_time)), patch( "brother.Brother._get_data", return_value=json.loads(load_fixture("brother_printer_data.json")), ):