Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Fix toner topic and name
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniu committed Nov 14, 2019
1 parent d557223 commit b0cdc7a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/brother-printer-status/brother-printer-status.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
class BrotherPrinterStatus(hass.Hass):
def initialize(self):

__version__ = "0.4.1"
__version__ = "0.4.2"

# max value of the height of the black image on the printer's webpage
self.MAX_IMAGE_HEIGHT = 56
Expand Down Expand Up @@ -152,14 +152,14 @@ def set_toner_status(self, page, value, color):
except TypeError:
return
if toner:
sensor = "toner_" + color
entity = self.SENSOR_PREFIX.format(sensor)
sensor = "toner-{}".format(color)
entity = self.SENSOR_PREFIX.format(sensor.replace("-", "_"))
if self.use_mqtt:
topic = self.TOPIC.format(sensor)
model = self.printer_model(page)
payload = {
"name": "Printer " + sensor,
"uniq_id": self.mac_simple + "-" + "toner" + "-" + color,
"name": "Printer " + sensor.replace("-", " "),
"uniq_id": self.mac_simple + "-" + sensor,
"dev": {
"ids": self.mac_simple,
"cns": [["mac", self.mac]],
Expand All @@ -174,7 +174,7 @@ def set_toner_status(self, page, value, color):
self.mqtt_publish(topic, payload, entity, sensor, toner)
else:
attributes = {
"friendly_name": "Printer " + sensor,
"friendly_name": "Printer " + sensor.replace("-", " "),
"icon": "mdi:flask-outline",
"unit_of_measurement": "%",
}
Expand Down

0 comments on commit b0cdc7a

Please sign in to comment.