elad-bar / ha-hpprinter

HP Printer Integration
93 stars 27 forks source link

error when set it up #1

Closed moshe19803 closed 5 years ago

moshe19803 commented 5 years ago

Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/hpprinter/home_assistant.py", line 29, in refresh_data self.update() File "/config/custom_components/hpprinter/home_assistant.py", line 63, in update self.create_printer_sensor(printer_data) File "/config/custom_components/hpprinter/home_assistant.py", line 84, in create_printer_sensor total_printed_pages = total_printed.get("#text", 0) AttributeError: 'str' object has no attribute 'get'

elad-bar commented 5 years ago

can you please send the xml result from your printer, URL: http://{host}/DevMgmt/ProductUsageDyn.xml

that will allow me to reproduce the issue and provide solution

thanks

moshe19803 commented 5 years ago

hi, see atteced

thx

‫בתאריך יום א׳, 10 בנוב׳ 2019 ב-11:04 מאת ‪elad-bar‬‏ <‪ notifications@github.com‬‏>:‬

can you please send the xml result from your printer, URL: http://{host}/DevMgmt/ProductUsageDyn.xml

that will allow me to reproduce the issue and provide solution

thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elad-bar/ha-hpprinter/issues/1?email_source=notifications&email_token=AIQTH3QMKSDVJIPXJEUXBNTQS7FB5A5CNFSM4JLLMJF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUYVAI#issuecomment-552176257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQTH3R5STW6VGZRTZ7VEPTQS7FB5ANCNFSM4JLLMJFQ .

elad-bar commented 5 years ago

hi, no attachment, can you upload and send link to the file?

thanks

jcollas commented 5 years ago

Same issue. In my case, the printer is an HP LaserJet 200 color M251nw

ProductUsageDyn.txt


File "/config/custom_components/hpprinter/home_assistant.py", line 84, in create_printer_sensor total_printed_pages = total_printed.get("#text", 0) AttributeError: 'str' object has no attribute 'get'

elad-bar commented 5 years ago

great, will try working on that later today, seems not too complex to adjust it

elad-bar commented 5 years ago

Please check, thanks

jcollas commented 5 years ago

Works perfectly for me. Thanks for this.

tetragram55 commented 5 years ago

I have a MFP M281fdw I’m getting this error:

Error doing job: Future exception was never retrieved Traceback (most recent call last): File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/hpprinter/home_assistant.py", line 29, in refresh_data self.update() File "/config/custom_components/hpprinter/home_assistant.py", line 66, in update self.create_scanner_sensor(scanner_data) File "/config/custom_components/hpprinter/home_assistant.py", line 116, in create_scanner_sensor adf_images_count = adf_images.get("#text", 0) AttributeError: 'str' object has no attribute 'get'

phdelodder commented 5 years ago

I have a "HP Officejet 6700 Premium e-All-in-One", getting the same sort of the same error:

2019-11-10 21:56:26 ERROR (SyncWorker_16) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/hpprinter/home_assistant.py", line 29, in refresh_data
    self.update()
  File "/config/custom_components/hpprinter/home_assistant.py", line 66, in update
    self.create_scanner_sensor(scanner_data)
  File "/config/custom_components/hpprinter/home_assistant.py", line 118, in create_scanner_sensor
    duplex_sheets_count = duplex_sheets.get("#text", 0)
AttributeError: 'str' object has no attribute 'get'

ProductUsageDyn.txt

elad-bar commented 5 years ago

@tetragram55 , @phdelodder , pushed another fix, it caused due to an attribute that available in some of the models which requires different parsing, in your printers that kind of attribute is not available which requires dynamic handling whether that attribute available or not, fixed it for all parameters, Please check again.

thanks

elad-bar commented 5 years ago

can I close that issue?

moshe19803 commented 5 years ago

Yes Thx

Moshe Perez Head of Product Architecture Technology Design, Video Services

Emeq Haela • Israel Tel +972 299 04488 • Mobile +972 50 8899359 Moshe.perez@ses.com

Connect with us at www.ses.comhttp://www.ses.com

Twitter • Facebook • YouTube • LinkedIn • Instagram

DISCLAIMER: This e-mail contains proprietary information, some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this e-mail, please notify the author by replying to this e-mail. If you are not the intended recipient, you must not use, disclose, distribute, print or rely on this e-mail.


From: elad-bar notifications@github.com Sent: Tuesday, November 12, 2019 9:28:24 AM To: elad-bar/ha-hpprinter ha-hpprinter@noreply.github.com Cc: moshe19803 moshe.perez@gmail.com; Author author@noreply.github.com Subject: Re: [elad-bar/ha-hpprinter] error when set it up (#1)

can I close that issue?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/elad-bar/ha-hpprinter/issues/1?email_source=notifications&email_token=AIQTH3WDERDVVGABDJNKU2DQTJLJRA5CNFSM4JLLMJF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZJRCQ#issuecomment-552769674, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIQTH3X27CKWJBQFQBVN7ILQTJLJRANCNFSM4JLLMJFQ.