seydx / homebridge-printer

Homebridge plugin for ipp (AirPrint) capable printer
MIT License
42 stars 4 forks source link

Error: self signed certificate #2

Closed solbadguy2010 closed 3 years ago

solbadguy2010 commented 3 years ago

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?

solbadguy2010 commented 3 years ago

{ "name": "PrinterPlatform", "printer": [ { "name": "HP Laserjet M277dw", "address": "http://M277dw.local./hp/device/info_config_AirPrint.html?tab=Networking&menu=AirPrintStatus", "manufacturer": "Hewlett-Packard", "model": "Color LaserJet MFP M277dw", "serialNumber": "VNB8J4W31P" }, { "name": "Dymo LabelWriter 450", "address": "https://Mac-Mini.local.:631/printers/DYMO_LabelWriter_450", "manufacturer": "Dymo", "model": "LabelWriter 450", "serialNumber": "1516021750111" } ], "platform": "PrinterPlatform" }

fototeddy commented 3 years ago

simple way would be to try using http://Mac-Mini.local.:631/printers/DYMO_LabelWriter_450 instead of https://Mac-Mini.local.:631/printers/DYMO_LabelWriter_450

because certificate handling is something that is done in http://github.com/sealsystems/node-ipp and not directly in this plugin

so maybe you can use a non https connection or other way would be to convince your Mac to publish your printer also over http or directly over ipp// it seams that you Mac is publishing the dymo via CUPS and the you can try ipp://Mac-Mini.local:631/printers/DYMO_LabelWriter_450 that works for me with my CUPS shared printers ver well because CUPS can publish printers in different ways

another hint might by that your Adressen contain a . on an place where it should no be it should be .local:PORTNUMBER and not .local.:PORTNUMBER

solbadguy2010 commented 3 years ago

Hey, this was gold. When i used http instead of https it showed "Web Gui is deactivated" in the browser. I needed to execute "cupsctl WebInterface=yes" in the Macs terminal and the Web Gui was accessable. Afterwards the plugin was working.

Thank you!

solbadguy2010 commented 3 years ago

Sadly the contact-sensor does not react to prints. any idea here?

fototeddy commented 3 years ago

When Compact Sensor is Not working look at the Open Pullrequest i placed yesterday. There is an error in the Switch.js for printers with only one marker

You habe to add [....] at two points to fix this

solbadguy2010 commented 3 years ago

I added the breakets in the Switch.js and rebooted homebrige. Plugin is still working with the HP and also the Canon now as before. But the Dymo connected to the Mac still does not trigger the contect sensor. Here is my config again. I tried ipp and http. No difference. No error in the logs.

            {
                "name": "Dymo LabelWriter 450",
                "address": "ipp://Mac-Mini.local:631/printers/DYMO_LabelWriter_450",
                "manufacturer": "Dymo",
                "model": "LabelWriter 450",
                "serialNumber": "1516021750111"
            }, 
fototeddy commented 3 years ago

What is the debug line for the dymo Printer when you enable debug in config? Maybe there is something Else wrong for the ipp messages Send by the cups for dymo

solbadguy2010 commented 3 years ago

This are all lines outputted by the plugin with debug enabled and after a fresh Homebridge restart. It then keeps repeating.

homebridge.log.txt

solbadguy2010 commented 3 years ago

Just an idea: The Dymo is printing with thermo transfer and is really fast. Printing takes 2 Seconds for a Label. Is it possible, that the plugin simply does not read its state often enough and the prints are finished between two queries?

fototeddy commented 3 years ago

Well the plugin reeds the State every 60secodns so this could be a Point

does the Canon contact Sensor work?

if Canon is working ist might be the dymo Speed

if Canon also is Not working it is another error with the Marker Level read out

solbadguy2010 commented 3 years ago

HP and Canon are working. They both use their own Wifi and Airprint implementation. The Dymo is USB only, therefore i need the Mac Mini to get it online.

fototeddy commented 3 years ago

Ok Then the dymo seems to be to fast.

I think somewhere in the Code is a Point where the renew Time is set. I have to Look deeper. Or maybe cups can set a Delay lets say 60 seconds or so. But i don‘t know cups Good enough

solbadguy2010 commented 3 years ago

Have prove now. Paper was empty and therefore printing on the dymo took longer, now the plugin triggered.

32510CB8-AF1F-4024-B7A7-6EAF5AC441D1

seydx commented 3 years ago

In v1.0.1 you can now adjust the polling timer via config.json (default 10s)