diff --git a/CHANGELOG.md b/CHANGELOG.md index a16ec50..7a9fde1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ **Fixed bugs:** +- Fix image drum OPC name [\#51](https://github.com/elad-bar/ha-hpprinter/issues/51) + +## 2020-04-26 + +**Fixed bugs:** + - Fix disabled entities are getting enabled after periodic update (update interval) - Fix offline printer is not updating entities correctly and after restart [\#45](https://github.com/elad-bar/ha-hpprinter/issues/45) [\#47](https://github.com/elad-bar/ha-hpprinter/issues/47) diff --git a/custom_components/hpprinter/helpers/const.py b/custom_components/hpprinter/helpers/const.py index 913b3e9..20cb739 100644 --- a/custom_components/hpprinter/helpers/const.py +++ b/custom_components/hpprinter/helpers/const.py @@ -106,6 +106,8 @@ HP_HEAD_TYPE_INK = "ink" HP_HEAD_TYPE_PRINT_HEAD = "printhead" +HP_ORGANIC_PHOTO_CONDUCTOR = "OPC" +HP_ORGANIC_PHOTO_CONDUCTOR_NAME = "Organic Photo Conductor" HP_INK_MAPPING = {"C": "Cyan", "Y": "Yellow", "M": "Magenta", "K": "Black"} diff --git a/custom_components/hpprinter/managers/HPDeviceData.py b/custom_components/hpprinter/managers/HPDeviceData.py index 1be271a..01e798b 100644 --- a/custom_components/hpprinter/managers/HPDeviceData.py +++ b/custom_components/hpprinter/managers/HPDeviceData.py @@ -347,17 +347,21 @@ def set_printer_consumable_data(self, printer_consumable_data): color = consumable_label_code else: color_map = [] - for color_letter in consumable_label_code: - mapped_color = HP_INK_MAPPING.get(color_letter, color_letter) - color_map.append(mapped_color) + if consumable_label_code == HP_ORGANIC_PHOTO_CONDUCTOR: + color = HP_ORGANIC_PHOTO_CONDUCTOR_NAME + else: + for color_letter in consumable_label_code: + mapped_color = HP_INK_MAPPING.get(color_letter, color_letter) + + color_map.append(mapped_color) - color = "".join(color_map) + color = "".join(color_map) - if color == consumable_label_code: - _LOGGER.warning( - f"Head type {head_type} color mapping for {consumable_label_code} not available" - ) + if color == consumable_label_code: + _LOGGER.warning( + f"Head type {head_type} color mapping for {consumable_label_code} not available" + ) cartridge_key = f"{head_type} {color}"