elad-bar / ha-hpprinter Goto Github PK
View Code? Open in Web Editor NEWHP Printer Integration
HP Printer Integration
Hi
Since my HA Core does not allow mDNS, I need to use the printer's IP address. My router crashed today and the printer's IP address has changed. I wanted to change the IP in the hp-printer integration configuration but that doesn't seem possible?
First thank you for the nice integration.
But this integration is slowing down home assistant.
Also if i change the icons via custom ui, this changes don't get displayed after restart home assistant.
If i remove this integration, home assistant is working normal.
Here is the printer file:
Printer.txt
It's now possible to have logo for custom integrations: https://developers.home-assistant.io/blog/2020/05/08/logos-custom-integrations/
It could be cool to have an icon for your integration
Hi
Good integration, but i have a pinter HP LaserJet 400 M401dne. He found me it ok but show only correct status and printed pages. No show me status of toner… Look on screen. Show NA NA and 0% but actual state toner is 50%.
What i must share you to add support full my printer with your integration?
My XML
https://drive.google.com/file/d/1dvWLcHa8zZCkaKPogophH_r82Sui1eeS/view?usp=sharing
hpprinter:
devies: should be devices
- host: hostname / IP
name: printer name (Optional - Default - HP Printer)
I've got it all setup and the page and binary sensors are working, but this is a monochrome printer and the ink levels are not showing. Attached is the reporting sensors and errors, and the xml files. Any thoughts?
It would be nice to be able to install this custom integration through HACS...
More info here
Before had this error not. After update to 62d36d7 i see this error:
Head type Printhead color mapping for CMYK not available
2:26 PM custom_components/hpprinter/HPDeviceData.py (WARNING)
After an install and restart of version a7fbebe I am seeing "This integration has no devices." I added the IP address in the Host field, I double checked that the IP address is still assigned to the printer, and that the printer is on (it has been for 30 minutes now).
I did change the default name from "HP Printer" to "Color Laserjet".
Log Details (ERROR)
Logger: custom_components.hpprinter.managers.HPDeviceData
Source: custom_components/hpprinter/managers/HPDeviceData.py:82
Integration: HP Printer (documentation)
First occurred: 5:17:25 PM (714 occurrences)
Last logged: 6:59:59 PM
Failed to set printer consumable usage data (HP MFP M225dw @), Error: 'str' object has no attribute 'get', Line: 279
After updating to the last updated
my printer entity disappear
I have loaded the integration succesfull for a while now. Since a couple of updates ago, I removed the deprecated YAML configuration and added my printer via the HA Integration panel.
Seems to work all fine, except when I change a name of 1 or more sensors. It works just fine, until I reboot home assistant, the sensor names gets resetted to their original name.
Is this a problem with the integration? Since I don't seem to have the problem with any other integrations.
Hi,
would it be possible to add support for the HP Officejet 4500 G510g-m? 🙈
After adding the integration, it says "Unsupported API" when adding the printer... Or should that device be already supported? Its an older one but has a webpage where all information that this integration provides seems to be presented as well.
The model number is CB867A. The firmware version is MLM1FN0943AR.
HA: v0.109.3
(installed via) HACS: v0.24.3
This integration: commit #cccee35
Thanks for considering!
Logs are full with:
[custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:21:29.004311+00:00
I'd think it'll be better to rather control their printout or move it to DEBUG
Installing this component my knx setup stop working on homeassistant boot. Removing it all works fine.
HI,
Would be nice to see the icon that is used for ink level to "mdi-cup-water" that shows a ink cartridge icon :)
I tried to change it in customise but doesn't seem to work
There have been a number of reports of the Home Assistant QNAP integration breaking when the HP Printer integration is installed:
I believe this might be caused by HASS requiring xmltodict 0.12 (which the qnap sensor also has an indirect dependency on) but this plugin requiring version .04
Is it possible for this plugin to work with version 0.12 instead? I'm wondering if that may fix this.
Please note I have not 100% confirmed this - just passing along that affected users of the qnap sensor all seem to have installed this plugin at some point.
Now integration has no devices after fresh install, maybe issue 52 needs to be reopened:
#52
I'm failing to connect an HP Color LaserJet CM1312nfi MFP. It's not PPI capable or else Home Assistant would pick it up automatically (a newer printer with PPI support works without problems in HA). Does ha-hpprinter require PPI support from printers?
This is the only error message I get in the log when trying to add the integration (using the correct IP address and I can open its webgui):
2020-04-20 15:58:46 WARNING (MainThread) [custom_components.hpprinter.config_flow] Failed to access HP Printer (HP Color LaserJet CM1312nfi MFP)
I have installed this via HACS, restarted an then put in the info in the integration. Nothing is in the developer states. I used Printer Name “xxxx xxxxx” and Host HPxxxxxx (obtained fro the HP Smart App.
I also tried with IP address in the host.
I am running 3.9/0.105.2 in HA
Any thoughts?
This sensor used to show number of pages printed, now shows "On Pages"
Attributes:
Color 0
Monochrome 0
Jams 4
Cancelled 203
Hi,
i added:
hpprinter:
host: 192.168.0.XX
name: 'HP'
won't work :( nothing happen after a restart
Thanks for this custom component. I added my HP OfficeJet Pro 8730 and I get the data nicely. However, instead of seeing a single device with multiple sensors, I see a device for each measurement (ink values, scanned/printed pages) which contains a single sensor. Wouldn't it make more sense, to bundle all that data under the device?
Missing brands for this integration.
https://rc.home-assistant.io/blog/2020/03/27/release-108/
Integration logos & icons
We have created a new repository on GitHub containing all the brand icons and logos Home Assistant is able to integrate with. These images are, for example, used in our documentation.
In 0.108, we made a start on using the content from this repository in the Home Assistant frontend. The device information page got a layout update and the integrations page as well.
These pages will now show the icons and logos matching the integration.
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'
Hello,
I have an HP Deskjet 3050, I installed the integration (version 6184073) via HACS and configured my printer via the GUI, all sensors were displayed correctly.
But after a few hours, my printer is no longer accessible, the W-LAN lamp flashes quickly and the display shows "ERROR". The only way to fix this is to disconnect the printer from the power supply and restart it. The problem did not occur after disabling the integration.
Regards
Sören
Added a printer via the new version. The binary sensor appears in the Developer States but none of the sensors appear. Also although my printer shows on the network, it is showing at disconnected.
Thanks for this integration and considering this request.
from homeassistant.helpers import aiohttp_client
aiohttp_client.async_get_clientsession(self.hass)
Everything seems to be working so far, but I did get the following error after disabling one of the sensors.
Log Details (WARNING)
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:284
First occurred: 7:07:41 AM (1 occurrences)
Last logged: 7:07:41 AM
Entity sensor.office_printer_printhead_cyanmagentayellowblack is incorrectly being triggered for updates while it is disabled. This is a bug in the hpprinter integration.
Just installed v109.0 and get this in the log:
Logger: homeassistant.helpers.translation
Source: helpers/translation.py:206
First occurred: 7:11:03 PM (4 occurrences)
Last logged: 7:11:04 PM
hpprinter: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this
Thanks for this integration and considering this request.
The printer data doesn't change too frequently and the update time is a nice chunk of the event loop time.
I've just updated to the latest version of this integration.
When I install it through the GUI I am presented with this dialog box:
There are no labels for the input box (using English language for UI). First one is for the printer's name I suppose, no clue what the second one should be, IP address?
I'm seeing very frequent updates from the printer:
2020-04-14 12:20:02 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:02.915915+00:00
2020-04-14 12:20:13 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:13.004869+00:00
2020-04-14 12:20:24 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:24.008534+00:00
2020-04-14 12:20:34 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:34.055757+00:00
2020-04-14 12:20:45 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:45.007623+00:00
2020-04-14 12:20:56 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:20:56.007781+00:00
2020-04-14 12:21:07 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:21:07.007402+00:00
2020-04-14 12:21:18 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:21:18.008786+00:00
2020-04-14 12:21:29 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:21:29.004311+00:00
2020-04-14 12:21:40 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-04-14 09:21:40.007588+00:00
This looks like once every 10 seconds.
I'd like to change it for example to once in 5 mins or so.
I get the following errors:
Logger: homeassistant.setup
Source: setup.py:288
First occurred: 16:48:40 (4 occurrences)
Last logged: 17:31:13
Unable to set up dependencies of hpprinter. Setup failed for dependencies: logger
Logger: aiohttp.server
Source: setup.py:290
First occurred: 16:48:40 (4 occurrences)
Last logged: 17:31:13
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 73, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 125, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 112, in post
return await super().post(request)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 54, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 63, in post
handler, context={"source": config_entries.SOURCE_USER}
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 112, in async_init
flow = await self.async_create_flow(handler, context=context, data=data)
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 501, in async_create_flow
await async_process_deps_reqs(self.hass, self._hass_config, integration)
File "/usr/src/homeassistant/homeassistant/setup.py", line 290, in async_process_deps_reqs
raise HomeAssistantError("Could not set up all dependencies.")
homeassistant.exceptions.HomeAssistantError: Could not set up all dependencies.
I am seeing this on the logs each time the integration updates sensors. Does not appear to affect the sensors with the exception of the printhead sensor which is '0'
This is monitoring an HP OfficeJet 8720
I'm also including screenshot of the frontend so you can see the sensors updating with exception of the printhead.
Please let me know if you need any other logs to troubleshoot this. Thank you.
2020-03-05 14:34:01 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-03-05 19:34:01.002571+00:00 2020-03-05 14:34:06 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 275, in data_received messages, upgraded, tail = self._request_parser.feed_data(data) File "aiohttp\_http_parser.pyx", line 523, in aiohttp._http_parser.HttpParser.feed_data aiohttp.http_exceptions.BadStatusLine: invalid HTTP method 2020-03-05 14:34:11 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-03-05 19:34:11.004930+00:00
Entities not available after turn off printer
The integration title is now :HP Printer and has not entities.
Also, The cog button shows a dialog box with a tick box with no title, 60 on an input line and a log level drop down box, none have titles, have tried a dark and light theme just in case
Was working this morning before I updated
2020-02-29 23:50:02 INFO (MainThread) [custom_components.hpprinter.HPPrinterAPI] Cannot retrieve data (ProductUsageDyn) from printer, Error: , Line: 87
2020-02-29 23:50:03 INFO (MainThread) [custom_components.hpprinter.HPPrinterAPI] Cannot retrieve data (ProductConfigDyn) from printer, Error: , Line: 87
2020-02-29 23:50:03 INFO (MainThread) [custom_components.hpprinter.HPPrinterAPI] Cannot retrieve data (ProductStatusDyn) from printer, Error: , Line: 87
2020-02-29 23:50:03 INFO (MainThread) [custom_components.hpprinter.HPPrinterAPI] Cannot retrieve data (ConsumableConfigDyn) from printer, Error: , Line: 87
2020-02-29 23:50:07 INFO (MainThread) [custom_components.hpprinter.home_assistant] Updating 2020-02-29 22:49:55.749199+00:00
2020-02-29 23:50:09 INFO (MainThread) [custom_components.hpprinter.HPPrinterAPI] Cannot retrieve data (ProductConfigDyn) from printer, Error: , Line: 87
2020-02-29 23:50:09 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform hpprinter is taking over 10 seconds.
Log Details (ERROR)
Logger: custom_components.hpprinter.managers.HPDeviceData
Source: custom_components/hpprinter/managers/HPDeviceData.py:82
Integration: HP Printer (documentation)
First occurred: 11:18:09 PM (7 occurrences)
Last logged: 11:18:09 PM
Failed to set printer consumable usage data (HP MFP M225dw @ IP xxx.xxx.xxx.xxx), Error: 'str' object has no attribute 'get', Line: 279
After new update the sensor 'status' is always off.
Here is my printer configuration:
With release f1a8584, to HP LaserJet 200 color M251.
ERROR (MainThread) [custom_components.hpprinter.HPPrinterAPI] Failed to extract from array AutoOnEvent of ['ethernetJob', 'wirelessJob', 'controlPanelTouch', 'usbJob'], Error: string indices must be integers, Line: 164
Would you consider adding a sensor instead of binary sensor for state? So instead of on/off it would show on/idle/printing/off etc.
- platform: command_line
name: printer_status
scan_interval: 10
command: curl -s http://ip/DevMgmt/ProductStatusDyn.xml | grep "pscat:StatusCategory" | sed 's/\s*<.*>\(.*\)<.*>/\1/' | tail +2
- platform: template
sensors:
printer_status_template:
value_template: >-
{% if is_state("sensor.printer_status", "ready") %}
On
{% elif is_state("sensor.printer_status", "inPowerSave") %}
Idle
{% elif is_state("sensor.printer_status", "processing") %}
Printing
{% elif is_state("sensor.printer_status", "") %}
Off
{% else %}
{{ states.sensor.printer_status.state }}
{% endif %}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.