Bump brother library to version 0.1.15 (#39226)

This commit is contained in:
Maciej Bieniek authored and GitHub committed 2020-08-26 10:55:57 +02:00
1 parent 067efc7805
commit 2568932c1c
6 files changed
+33 -16

No files matched your search

+2 -6
View File
@@ -1,5 +1,5 @@
"""Constants for Brother integration."""
from homeassistant.const import TIME_DAYS, UNIT_PERCENTAGE
from homeassistant.const import UNIT_PERCENTAGE
ATTR_BELT_UNIT_REMAINING_LIFE = "belt_unit_remaining_life"
ATTR_BLACK_DRUM_COUNTER = "black_drum_counter"
@@ -162,9 +162,5 @@ SENSOR_TYPES = {
ATTR_LABEL: ATTR_YELLOW_INK_REMAINING.replace("_", " ").title(),
ATTR_UNIT: UNIT_PERCENTAGE,
},
ATTR_UPTIME: {
ATTR_ICON: "mdi:timer-outline",
ATTR_LABEL: ATTR_UPTIME.title(),
ATTR_UNIT: TIME_DAYS,
},
ATTR_UPTIME: {ATTR_ICON: None, ATTR_LABEL: ATTR_UPTIME.title(), ATTR_UNIT: None},
}
@@ -3,7 +3,7 @@
"name": "Brother Printer",
"documentation": "https://www.home-assistant.io/integrations/brother",
"codeowners": ["@bieniu"],
"requirements": ["brother==0.1.14"],
"requirements": ["brother==0.1.15"],
"zeroconf": ["_printer._tcp.local."],
"config_flow": true,
"quality_scale": "platinum"
@@ -1,7 +1,10 @@
"""Support for the Brother service."""
from datetime import timedelta
import logging
from homeassistant.const import DEVICE_CLASS_TIMESTAMP
from homeassistant.helpers.entity import Entity
from homeassistant.util.dt import utcnow
from .const import (
ATTR_BLACK_DRUM_COUNTER,
@@ -20,6 +23,7 @@ from .const import (
ATTR_MAGENTA_DRUM_REMAINING_PAGES,
ATTR_MANUFACTURER,
ATTR_UNIT,
ATTR_UPTIME,
ATTR_YELLOW_DRUM_COUNTER,
ATTR_YELLOW_DRUM_REMAINING_LIFE,
ATTR_YELLOW_DRUM_REMAINING_PAGES,
@@ -76,8 +80,18 @@ class BrotherPrinterSensor(Entity):
@property
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)
@property
def device_class(self):
"""Return the class of this sensor."""
if self.kind == ATTR_UPTIME:
return DEVICE_CLASS_TIMESTAMP
return None
@property
def device_state_attributes(self):
"""Return the state attributes."""