Skip to content

Commit

Permalink
Fix #57 - Log is filling with errors
Browse files Browse the repository at this point in the history
  • Loading branch information
elad-bar committed May 6, 2020
1 parent e63516a commit 30f227d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 2020-05-06

**Fixed bugs:**

- Fix Log is filling with errors [\#57](https://github.com/elad-bar/ha-hpprinter/issues/57)

**Implemented enhancements:**

- More descriptive error message when unable to access printer's API at setup or changing options
Expand Down
5 changes: 4 additions & 1 deletion custom_components/hpprinter/managers/HPDeviceData.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,10 @@ def set_printer_consumable_data(self, printer_consumable_data):

@staticmethod
def clean_parameter(data_item, data_key, default_value="N/A"):
result = data_item.get(data_key, {})
if data_item is None:
result = default_value
else:
result = data_item.get(data_key, {})

if not isinstance(result, str):
result = result.get("#text", 0)
Expand Down

0 comments on commit 30f227d

Please sign in to comment.