Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving QR code Error when trying to add Leviton Outlet (ZW15R) #2766

Closed
tamorgen opened this issue Oct 27, 2022 · 26 comments
Closed

Receiving QR code Error when trying to add Leviton Outlet (ZW15R) #2766

tamorgen opened this issue Oct 27, 2022 · 26 comments
Assignees
Labels
investigating 🔍 question Further information is requested

Comments

@tamorgen
Copy link

Good afternoon,
I'm trying to add a Leviton Decora Smart Outlet (ZW15R) to my Z-wave network. This is a 700 series Zwave plus outlet, supposedly with S2 support.

When I attempted to add it to my mesh through scanning the QR code, I received the following error: "Error while calling api parseQRCodeString: contains invalid characters (ZW1406).

I purchased 3 of these switches, and I've tried it on two so far, and zero luck.

I tried to add them the old fashioned way, by putting my Z-wave network into inclusion mode, and then held the inclusion button for 7 seconds, then pressed it once more after the light started flashing amber, to put it into inclusion mode per the manual, and it was found and recognized by HA, however, it did not prompt me for a PIN for the S2 security.

I've attempted to contact Leviton nad I was met with perhaps the dumbest Tier 1 I've ever spoken to, and then the rudest Tier 2 who didn't understand or care about the QR code issue. He said, "well t's included, so that's all I can help you with."

So my questions are:

  1. is this QR code a problem with Z-wave-js-ui, or with the manufacturer?
  2. Is there a way to get the prompt for the PIN on this device?
@tamorgen tamorgen added the question Further information is requested label Oct 27, 2022
@robertsLando
Copy link
Member

robertsLando commented Oct 28, 2022

Hi @tamorgen, are you adding it from the provisioning entries table or are you using nodes manager dialog? Is the QR code very small (like 10x10mm)? In case it is so small I can suggest you to take a picture of it, then zoom the picture in your phone and use that as a scan as there is a known issue with small qr codes not read correctly. If this still doens't work you could try to parse the QR code with some other tool and insert the parsed string manually in the provisioning entries table dialog (just click the scan button and go to the 3rd tab of the dialog shown to input the string manually).

cc @AlCalzone

@AlCalzone
Copy link
Member

All the driver ever sees is the QR code's content, so either the code on the device is really shitty, or the UI has trouble reading it.

@robertsLando I had better luck parsing codes reliably by scaling the Webcam image up 2x before attempting detection. Maybe worth a try, ZUI not being able to scan seems to happen semi-frequently.

@robertsLando
Copy link
Member

robertsLando commented Oct 28, 2022

I tried all qrcode readers libraries I found online and none of them is able to read the qo code of my aeotec temperature and humidity sensor.

I think I may need to implement my own one? 😢

As ref: mebjas/html5-qrcode#478

@robertsLando
Copy link
Member

Maybe this could do the trick: mebjas/html5-qrcode#308 (comment)

@tamorgen
Copy link
Author

I'm adding it from the Manage Node's screen (Action --> Manage Nodes --> Inclusion -- > Name and Location --> Scan QR Code

The QR code isn't terribly small. It's the same size as others that have functioned properly (Enbrighten Switches, Zooz Switches). I've tried both from the box QR and the receptacle QR. If it was too small, generally I'd have problems focusing on it, but this scans it straight away and then gives me the error. I have three of these devices and they all do the same thing.

@robertsLando
Copy link
Member

Ok so the problem is not a small QR code, I think it may be something related to zwavejs method that parse the QR string, @AlCalzone should I move this to zwave-js?

@tamorgen
Copy link
Author

One other piece of information. I just tried to add the device using the QR text, and it's failing to add as well. This time, it gives me an error about the length of the code. (Not valid. Must be 52 digits long and starts with "90".)

The code I'm trying to enter is:

18XXX-55502-60104-02250-44975-53279-60438-60082 (PIN partially excluded)

It's only 40 characters, so where are the other 12 characters supposed to come from?

@robertsLando
Copy link
Member

Seems also it doesn't start with '90' at all, that validation is taken from zwave-js so I have no clue why this happens, let's see what Al says

@tamorgen
Copy link
Author

So I noticed. I'm wondering if Leviton isn't following an industry standard.

@AlCalzone
Copy link
Member

Is the QR code just the DSK (40 digits)? That's not a smart start QR code then, but we should probably detect it as a valid S2 DSK. It won't help much though, only spare you from entering the 5 digit PIN.

@tamorgen
Copy link
Author

tamorgen commented Oct 28, 2022

It only appears to show 40 digits, yes. Their website claims it is SmartStart:

https://www.leviton.com/en/products/zw15r-1bz

"Z-Wave 700 Series Chipset includes S2 security and SmartStart"

Edit: To be clear, I'm just stating what they claim. I'm not claiming they are right.

@robertsLando
Copy link
Member

@AlCalzone So what about this?

@AlCalzone
Copy link
Member

@AlCalzone
Copy link
Member

This issue is the 2nd part of the linked one, only without the zws2dsk prefix, so I think we can close this.
In any case the QR code is an S2 QR code, but not a SmartStart QR code, so a manual inclusion will still be necessary.

@tamorgen
Copy link
Author

tamorgen commented Nov 13, 2022

Sorry, I’ve been out of town for a few days. I did get a reply from Leviton engineering and they claim the whole code is in the QR code. Below is their response.

If the whole code is there, why is Z Wave JS only providing me with the DSK when it scans the code and throwing this error?

Hi Tim,
 
Our technical services team asked us to look into this for you. I appreciate the detailed information you provided, but we haven’t been able to replicate what you are reporting.
 
Using an iPhone 11 with iOS 16.1 and the built-in camera app, along with a 3rd party app from the App-Store,  I was able to scan QR codes you provided (in the images). I got the entire Smart Start Code, starting with the start character of Z. I included photos on this email, and I also broke it down into the sections as per the spec below:
 
90 01 25692 131  18440…
90 01 26206 131  13834…
90 01 57401 131  60096
 
We encode the entire string in the QR code, but only print the DSK in text form on the box. You should be able to scan the QR code, so I suspect there is some other problem.
 
What app are you using to scan the QR code?
What is the exact issue you are facing when you try to enroll with the QR code? (Do you get an error, failure to enroll, etc.?)
Can you use just the camera app or a 3rd party QR code scanner to scan the QR code and verify my results?
Do you have a link to this discussion on Github?
 
Thanks,
 
Aaron
 
 
Aaron Ard
Senior Director, Engineering, Residential

@tamorgen
Copy link
Author

tamorgen commented Nov 13, 2022

I did try scanning the QR codes as he suggested, and it does scan with Smart Start prefix before the DSK. However, it appears that there are more numbers included after the DSK. I don’t know if that’s normal behavior when scanning from the iOS camera or not. It shows in the Google search bar after I scan the code, the whole code as Aaron suggested, but then there are 38 digits after the DSK:

00100409601794022000029000560000200263

@AlCalzone
Copy link
Member

Can you share the entire text content of the QR code?

@tamorgen
Copy link
Author

Can you share the entire text content of the QR code?

900125692131184405550260104022504497553279604386008200100409601794022000029000560000200263

@tamorgen
Copy link
Author

tamorgen commented Nov 17, 2022

I believe I may have come up with an explanation for the invalid character error. I appears to be in the generation of the QR code by Leviton, because I'm seeing it on all three Leviton devices I've tried to add, and none of the other 25 Smart Start devices I have on my network.

I went to manual add one of the outlets a short time ago by copying the string output by the iOS camera on my iPhone, and pasting it into the manual text entry field for QR Code text in the Nodes Manager. When I copied the entire text, I got an error “Not valid. Must be 52 digits long and starts with “90”, similar to my earlier attempts of just entering the SDK that was on the label.

I noticed however, that the QR cod text copied from the camera included a trailing space after the last digit. When I backspaced, the QR code was accepted.

IMG_0040

I checked the other two outlets, and they all had the same trailing spaces.

My guess is that when I used the scan by camera feature in the app, it is also detecting the trailing space, but throwing invalid characters error that I initially provided.

I haven’t seen this with any other companies Smart Start QR code. I’ve added many devices including Zooz, Jasco/Enbrighten, and Yale locks with QR code, and the Leviton devices are the only ones doing this. I would appear that there is an issue with the QR code generation that is adding this extra space, that other devices are not experiencing.

I think this is an issue for Leviton to solve. The problem is fixed for me now by manually adding and correcting the text.

The only thing I could say that the app could do is do a sanity check when it scans the QR code with the camera, look for trailing spaces, and delete them. I would think that would avoid this problem in the future.

@AlCalzone
Copy link
Member

Fair enough, I've put this on my to do list. Thanks for investigating. Can you let Leviton know too?

@tamorgen
Copy link
Author

Fair enough, I've put this on my to do list. Thanks for investigating. Can you let Leviton know too?

I emailed them before I posted here. I have not received a response from them yet.

@AlCalzone
Copy link
Member

@robertsLando that error message looks like it comes from Z-UI? Is there an additional check on your end that also needs to be fixed?

@robertsLando
Copy link
Member

Yeah that's a frontend validation, I used the code you had on your side, does that changed?

https://github.com/zwave-js/zwave-js-ui/blob/master/src/components/Confirm.vue#L423

@AlCalzone
Copy link
Member

The next version is going to trim() the QR code before validating it. I guess you could replace whitespace with "" in the text field too.

@robertsLando
Copy link
Member

I can add v-model.trim for this, it's automatically handeld by vue

@robertsLando
Copy link
Member

Done

robertsLando added a commit that referenced this issue Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating 🔍 question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants