Giter VIP home page Giter VIP logo

homebridge-printer's Introduction

homebridge-printer

npm npm GitHub last commit verified-by-homebridge Discord Donate

Creating and maintaining Homebridge plugins consume a lot of time and effort, if you would like to share your appreciation, feel free to "Star" or donate.

Click here to review more of my plugins.

Info

This is a dynamic platform plugin for Homebridge to check the state of your ipp (AirPrint) capable printer.

This Plugin creates a Switch Accessory and ContactSensor Accessory with FakeGato functionality. The Switch Accessory shows if the printer is online or offline and the ContactSensor Accessory shows if the printer is printing.

Installation instructions

After Homebridge has been installed:

  • sudo npm i -g homebridge-printer@latest

Basic configuration

{
 "bridge": {
   ...
 },
 "accessories": [
   ...
 ],
 "platforms": [
   {
     "platform": "PrinterPlatform",
     "debug": true,
     "printer":[
       {
         "name": "HP Envy Pro",
         "address": "http://hpf92bab4321ab:631/ipp/printer",
         "polling": 10,
         "marker": true,
         "switchType": "SWITCH",
         "manufacturer": "HP",
         "model": "Envy Pro",
         "serialNumber": "12345"
       }
     ]
   }
 ]
}

See Example Config for more details.

Options

Attributes Required Usage
platform Yes Must be PrinterPlatform
debug No Enables additional output in the log.
printer.address Yes IPP address of the printer.
printer.polling No Printer state polling. (Default: 10s)
printer.marker No If enabled, a new filter characteristic will be shown within printer accessory to show marker level. (Default: false)
printer.switchType No Accessory type of the printer switch. If "CHARACTERISTIC" is choosen, the printer switch will be shown as a characteristic within contact accessory. (Default: SWITCH)
printer.manufacturer No Manufacturer name for display in the Home app.
printer.model No Model name for display in the Home app.
printer.serialNumber No Serialnumber for display in the Home app.

Supported clients

This plugin has been verified to work with the following apps on iOS 12.2 and iOS 12.3 Beta:

  • iOS 14+
  • Apple Home
  • All 3rd party apps like Elgato Eve etc.
  • Homebridge v1.1.6+

Contributing

You can contribute to this homebridge plugin in following ways:

  • Report issues and help verify fixes as they are checked in.
  • Review the source code changes.
  • Contribute bug fixes.
  • Contribute changes to extend the capabilities

Pull requests are accepted.

Troubleshooting

If you have any issues with the plugin then you can run this plugin in debug mode, which will provide some additional information. This might be useful for debugging issues. Just enable debug in your config and restart homebridge.

homebridge-printer's People

Contributors

seydx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-printer's Issues

With which printers does the plugin work?

Hello SeydX,
can you tell me for which printers the plugin should work all ? For all AirPlay printers or only HP ?

I tried it with a Lexmark C3224dw. For this I have entered the IP address in Config but after adding to HK is only the bridge from the plugin is displayed no switch or sensor.

If you have a tip would be cool?

Greetings Nastra

Error 400 with Canon MX925

Hi,
I tried to follow your description with the app to get the correct ipp address and I filled in all the necessary data.
Log File says: PrinterPlatformFEHLERCanon MX920 series Sensor: An error occured during getting state
13.2.2022, 14:38:59 HOOBSPrinter Platform FEHLER Received unexpected response status 400 from the printer.
ipp adress is: http://219E74000000.local./mainmenu.html
which I can access with the browser.
Would be really great if you could help me with that.
regards Praktiker.

Printer Sensor: Can not reach printer!

Thanks for the plugin !

I have installed a Canon G6040 via ethernet and my configuration is as follows:
"name": "PrinterPlatform",
"debug": true,
"printer": [
{
"name": "Printer",
"address": "http://192.168.1.247.local:631/ipp/printer",
"polling": 10,
"marker": false,
"switchType": "SWITCH",
"manufacturer": "Canon",
"model": "G6040",

I can use the AirPrint function of the printer with no problem from various devices.

The Discovery application shows for IPP, adminurl=000000779FE8.local/index.html?page=PAGE_AAP
But trying with http://000000779FE8.local:631/ipp/printer produced errors.
I also disabled the Marker because I was getting errors and Homebridge loads with no red errors,

After reading other resolved issues I also tried http://192.168.1.247.local:631/ipp/printer
I also get no error messages in Homebridge with this address but the plugin does not trigger either the switch or the sensor.

Homebridge is reporting at startup:
Printer Sensor: Configuring accessory...
Printer Switch: Configuring accessory..

so it seems it will work but it doesn;t, after a while:
"Printer Sensor: Can not reach printer!"

Have I got the IPP address wrong?

An error occured during getting state

The contact sensor is always closed and the switch is always off in the home app. They're both unresponsive.

Logs:
[18/07/2022, 05:02:39] [PrinterPlatform] HP Color LaserJet Pro MFP M479fdw Sensor: An error occured during getting state
[18/07/2022, 05:02:39] [PrinterPlatform] self signed certificate

Config:
{
"name": "PrinterPlatform",
"debug": true,
"printer": [
{
"name": "HP Color LaserJet Pro MFP M479fdw",
"address": "https://hpf80dac7bfb21.local./#hId-pgAirPrint",
"polling": 10,
"marker": true,
"switchType": "SWITCH",
"manufacturer": "Hewlett-Packard",
"model": "W1A80A",
"serialNumber": "MXBCNBH0CN"
}
],
"_bridge": {
"username": "0E:1D:50:4F:12:41",
"port": 38031
},
"platform": "PrinterPlatform"
}

Illegal value on filter life level

Hi everyone,
Today Homebridge 1.3.0 was released, and since the update, homebridge-printer write every 10 seconds in the logs: [2/20/2021, 5:57:30 PM] [homebridge-printer] This plugin generated a warning from the characteristic 'Filter Life Level': characteristic was supplied illegal value: number -2 exceeded minimum of 0. See https://git.io/JtMGR for more info. without being in debug mode.

Does anyone have this problem? In Apple Home app, everything works perfectly, including the contact sensor when the printer is printing or the switch on/off.

Sincerely,
Victor

Problem with Epson ET-2550

Firts i got Error 426:

25.2.2021, 23:24:05 [PrinterPlatform] Error: Received unexpected response status 426 from the printer.
at ClientRequest. (/home/hoobs/.hoobs/node_modules/@sealsystems/ipp/lib/request.js:85:12)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:284:9)
at Socket.Readable.push (_stream_readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

After a while it changed to:
25.2.2021, 23:38:56 [PrinterPlatform] Error: Received unexpected response status 404 from the printer.
at ClientRequest. (/home/hoobs/.hoobs/node_modules/@sealsystems/ipp/lib/request.js:85:12)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:284:9)
at Socket.Readable.push (_stream_readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

in Apple Home see only the switch and Contactsnsor , when i print no changes !

my config fiele:

[
{
"name": "Epson ET-2550",
"address": "http://192.168.178.41:631/ipp/printer",
"polling": 10,
"manufacturer": "Epson",
"model": "ET-2550",
"serialNumber": "12345"
}
]

try as well with ipp instead of http and with lower and larger polling time No changes

mabe it is important i use Hoobs

HOOBS 3 Version 3.3.2
Node Version 14.15.1

Config Issue

Hi @seydx

Please can you help me?

So here is my config file - when I click Save in Hoobs it returns to the config page and its blank with only []
Its as if it isn’t saving correctly.

Do you have any advice? Is it because the IPP is incorrect - I followed the previous thread saying it should be after the Admin= bit.

Thanks

{
"bridge": {
...
},
"accessories": [
...
],
"platforms": [
{
"platform": "PrinterPlatform",
"debug": true,
"printer":[
{
"name": "HP Envy 4520",
"address": "http://HPA08CFDB142E7.local./#hId-pgAirPrint",
"polling": 10,
"marker": true,
"switchType": "SWITCH",
"manufacturer": "HP",
"model": "Envy 4520",
"serialNumber": "B142E7"
}
]
}
]
}

Error: self signed certificate

Hi,
i am using this plugin successfully with an HP printer that it Airprint capablable on its own. Working great!
I now wanted to also add an USB-Printer that is attached and shared in the network from my Mac Mini. I get the following error with this printer:

[14/01/2021, 13:31:38] [PrinterPlatform] Dymo LabelWriter 450: An error occured during getting state
[14/01/2021, 13:31:38] [PrinterPlatform] Error: self signed certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1497:34)
at TLSSocket.emit (events.js:315:20)
at TLSSocket._finishInit (_tls_wrap.js:932:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:706:12) {
code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}

Is there a way to allow the plugin to accept self signed certs?

Contact Sensor

Contact sensor not working for me. I've read your Pull Request regarding this but not 100% what I need to do and how. Some tips would be really good on how I get this part working. Thanks

Many errors on Homebridge's log after last update

I'm receiving this message, around one every second, since last update:

[25/02/2021, 09:30:45] [homebridge-printer] This plugin generated a warning from the characteristic 'Filter Life Level': characteristic value expected float and received undefined. See https://git.io/JtMGR for more info.

Any Idea ?

Error: Received unexpected response status 401 from the printer.

My third printer give me this error:

[14/01/2021, 14:07:48] [PrinterPlatform] Canon Selphy CP1300: An error occured during getting state
[14/01/2021, 14:07:48] [PrinterPlatform] Error: Received unexpected response status 401 from the printer.
at ClientRequest. (/usr/local/lib/node_modules/homebridge-printer/node_modules/@sealsystems/ipp/lib/request.js:85:12)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

Error: Received unexpected response status 426 from the printer

Hi SeydX,

I installed a new Epson ET-2756 printer in homebridge-print and got following error-message:

[4/9/2021, 3:41:29 PM] [PrinterPlatform] Epson ET-2756 Sensor: An error occured during adding filter services
[4/9/2021, 3:41:29 PM] [PrinterPlatform] Error: Received unexpected response status 426 from the printer.
at ClientRequest. (/homebridge/node_modules/homebridge-printer/node_modules/@sealsystems/ipp/lib/request.js:85:12)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:315:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)

Corresponding config enrty is:

            {
                "name": "Epson ET-2756",
                "address": "http://epson-et-2756:631/ipp/print",
                "polling": 30,
                "marker": true,
                "manufacturer": "Epson",
                "model": "Eco Tank ET-2756",
                "serialNumber": "123"
            }

If I use IP number instead of DNS name I got the same. With marker = false I gott also this error, but without details error message first time after restarting hombridge.

Maybe helpful additional information from Discovery app on my iPhone:
mopria-certified = 1.3
rp = ipp/print
TLS = 1.2
txtvers = 1
ty = EPSON ET-2750 Series

Thanks in advance.

HP printer sensor closed

Hi,
I installed plugin, logs are showing successful communication with printer.

[17/04/2021, 18:10:55] [PrinterPlatform] HP DeskJet 2676 Sensor: {"version":"2.0","statusCode":"successful-ok","id":30832407,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en"},"printer-attributes-tag":{"printer-make-and-model":"HP DeskJet 2600 series","printer-state":"idle","printer-is-accepting-jobs":true,"queued-job-count":0,"printer-up-time":3403}}

This is config:
{
"name": "PrinterPlatform",
"debug": true,
"printer": [
{
"name": "HP DeskJet 2676",
"address": "http://HP84A93EC66DAE.local./#hld-pgAirPrint",
"polling": 10,
"marker": false,
"switchType": "SWITCH",
"manufacturer": "HP",
"model": "DeskJet 2676",
}

But sensor shows as closed. No more information.
Screenshot 2021-04-17 at 6 12 40 PM

Same thing in Apple HomeApp.

Is it expected behaviour?

Error message

When the printer is off, homebridge/homekit shows that the printer is on and I get this error message:

}
[27.2.2021, 14:19:31] [PrinterPlatform] LaserJet: An error occured during getting state
[27.2.2021, 14:19:31] [PrinterPlatform] Error: getaddrinfo ENOTFOUND laserjet.local
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'laserjet.local'
}

Is there any possibility to solve it and show the correct status in homebridge/homekit?

config:

{
    "name": "PrinterPlatform",
    "debug": false,
    "printer": [
        {
            "name": "LaserJet",
            "address": "http://laserjet.local:631/hp/device/info_deviceStatus.html?tab=Home&menu=DevStatus",
            "polling": 10
        }
    ],
    "platform": "PrinterPlatform"
}

Thanks in advance.

BR, steff

not able to get info from printer

Hi,
I Ihave HP Airprint supported printer. But I don't get printing status as mentioned in description.

Does it require separate ContactSensor accessory to show printer is printing? If yes then which contact sensor is required?

Not able to identify config for switch and contact sensor accessory in plugin. sorry for basic question but I am new to this setup.

Error 400

Now that I discovered you have a bunch of other awesome homebridge plugins, I installed this one but am facing an issue with I think the ipp address.

Using the Discovery iOS app, I could get details of the printer, I tried with adminurl = http://B06F18000000.local./mainmenu.html, also http://b06f18000000.local & http://b06f18000000.local:631

[3/3/2021, 2:52:01 PM] [PrinterPlatform] Canon MX920: An error occured during getting state
[3/3/2021, 2:52:01 PM] [PrinterPlatform] Error: Received unexpected response status 400 from the printer.

Any ideas? The links above are accessible via a browser, I land on an AirPrint settings webpage.
Thanks

EDIT: out of curiosity, I tried changing b06f18000000.local to the actual IP address, then the message is different:


[3/3/2021, 2:58:15 PM] [PrinterPlatform] Canon MX920: An error occured during adding filter services
[3/3/2021, 2:58:15 PM] [PrinterPlatform] {"version":"2.0","statusCode":"client-error-not-found","id":44046087,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en-us","status-message":"The printer or class was not found."}} 

Trouble with Switch

Hello,

I have a trouble with SWITCH. I tried address from DNS checker like http://NPI029ABF.local./hp/device/info_config_AirPrint.html?tab=Networking&menu=AirPrintStatus but it not reacheble .. work only
ipp://npi029abf.local. or http://192.168.7.35:631

but If I click on switch in HK I see this log in Homebridge UI:

[30. 12. 2021 20:59:06] [PrinterPlatform] HP LaserJet Pro Switch: Switching state not supported yet

sensor still repeat msg:

[30. 12. 2021 20:58:37] [PrinterPlatform] HP LaserJet Pro Sensor: {"version":"2.0","statusCode":"successful-ok","id":76796492,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en"},"printer-attributes-tag":{"printer-make-and-model":"HP LaserJet 200 colorMFP M276n","printer-state":"idle","printer-is-accepting-jobs":true,"queued-job-count":0,"printer-up-time":1650575,"marker-names":["Cyan Cartridge HP CF211A","Magenta Cartridge HP CF213A","Yellow Cartridge HP CF212A","Black Cartridge HP CF210X"],"marker-levels":[34,39,26,90]}}

[30. 12. 2021 20:58:51] [PrinterPlatform] HP LaserJet Pro Sensor: {"version":"2.0","statusCode":"successful-ok","id":69278195,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en"},"printer-attributes-tag":{"printer-make-and-model":"HP LaserJet 200 colorMFP M276n","printer-state":"idle","printer-is-accepting-jobs":true,"queued-job-count":0,"printer-up-time":1650588,"marker-names":["Cyan Cartridge HP CF211A","Magenta Cartridge HP CF213A","Yellow Cartridge HP CF212A","Black Cartridge HP CF210X"],"marker-levels":[34,39,26,90]}}

[30. 12. 2021 20:58:54] [Homebridge UI] Starting terminal session

[30. 12. 2021 20:59:04] [PrinterPlatform] HP LaserJet Pro Sensor: {"version":"2.0","statusCode":"successful-ok","id":27329502,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en"},"printer-attributes-tag":{"printer-make-and-model":"HP LaserJet 200 colorMFP M276n","printer-state":"idle","printer-is-accepting-jobs":true,"queued-job-count":0,"printer-up-time":1650602,"marker-names":["Cyan Cartridge HP CF211A","Magenta Cartridge HP CF213A","Yellow Cartridge HP CF212A","Black Cartridge HP CF210X"],"marker-levels":[34,39,26,90]}}

Can you help me pls?

Printer Config:

"name": "PrinterPlatform",
"debug": true,
"printer": [
{
"name": "HP LaserJet Pro",
"address": "ipp://npi029abf.local.",
"polling": 10,
"marker": true,
"switchType": "SWITCH",
"manufacturer": "HP LaserJet",
"model": "M276n",
"serialNumber": "CNF8GBV1NK"

homebridge-printer broken in new versions (last working is 1.0.3)

Last version that is still working for me is 1.0.3

Printer switch never turns on with newer versions (1.1.x).

Log:
[7. 4. 2022 23:34:12] [PrinterPlatform] Printer: {"version":"2.0","statusCode":"successful-ok","id":55443581,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en-us","printer-uri":"http://10.0.1.174:631/ipp/print"},"printer-attributes-tag":{"queued-job-count":0,"marker-names":"Black Toner_S/N_:CRUM-210617A7433","marker-levels":30,"printer-make-and-model":"HP Laser MFP 135w","printer-is-accepting-jobs":true,"printer-state":"idle","printer-up-time":31976}}

My config:
{
"platform": "PrinterPlatform",
"debug": true,
"printer": [
{
"name": "Printer",
"address": "http://10.0.1.174:631/ipp/print",
"polling": 10,
"marker": true,
"switchType": "SWITCH",
"manufacturer": "HP",
"model": "HP Laser MFP 135w",
"serialNumber": xxxxxxxxxx"
}
]
},

Online/Offline state not recognized

Hi @seydx, the switch does not seem to function based on online/offline state, whereas the contact sensor works perfectly.

I have a Canon MG4250 and the switch does not turn on when the printer is online. The contact sensor accessory correctly changes state when the printer is printing, and changes back when done printing, but the switch accessory never changes.

Thanks in advance for looking into this

Error: For Each on Printer with on Marker

When I Add my HP Laserjet everything works fine but I get these Error in the Log. My Printer is behind a CUPS server.
Seems something is wrong about the markers

[PrinterPlatform] TypeError: markers.forEach is not a function
    at SwitchAccessory.getService (/root/.hoobs/node_modules/homebridge-printer/src/accessories/switch.js:50:21)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

The Debug Log of the Plugin is as follows

[PrinterPlatform] HP LaserJet: {"version":"2.0","statusCode":"successful-ok","id":3177504,"operation-attributes-tag":{"attributes-charset":"utf-8","attributes-natural-language":"en-us"},"printer-attributes-tag":{"printer-is-accepting-jobs":true,"printer-state":"idle","printer-up-time":1611551364,"queued-job-count":0,"marker-levels":63,"marker-names":"Patrone Schwarz HP CE505A","printer-make-and-model":"HP LaserJet P2055 Postscript (recommended)"}}

so the log seems to have information for markers and marker-level (despite the printer it self says 58% marker) but that might be some CUPS issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.