Skip to content

Commit

Permalink
Fix #17 - Improve parsing HP printer (laser) data
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed Feb 20, 2020
1 parent 62d36d7 commit 1e09928
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ target/
ConsumableConfigDyn.json
ProductConfigDyn.json
ProductUsageDyn.json
ConsumableConfigDyn.xml
final.json
ProductConfigDyn.xml
ProductUsageDyn.xml
4 changes: 2 additions & 2 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from custom_components.hpprinter.HPDeviceData import *

logging.basicConfig(level=logging.DEBUG,
filename='myapp.log',
filename='component.log',
filemode='w')

_LOGGER = logging.getLogger(__name__)
Expand All @@ -33,7 +33,7 @@ def store_data(file, content):

@staticmethod
def data_provider(data_type):
with open(f'samples/ink/{data_type}.json') as json_file:
with open(f'samples/HPLJ M401dne/{data_type}.json') as json_file:
data = json.load(json_file)

return data
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hpprinter/HPDeviceData.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def set_usage_data(self):
printer_consumables = consumables_data.get("Consumable")

if printer_consumables is not None:
if "ConsumableStation" in printer_consumables:
if "ConsumableTypeEnum" in printer_consumables:
self.set_printer_consumable_usage_data(printer_consumables)
else:
for key in printer_consumables:
Expand Down

0 comments on commit 1e09928

Please sign in to comment.