jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Schlage BE469 Lock attribute error #195

Closed mfsamuelson closed 1 year ago

mfsamuelson commented 1 year ago

I’ve had 2 of these locks working in HA for about a year now. They are using Hubitat as the zwave hub and I’m using the hubitat integration. All of a sudden when I went in and changed the codes (I did this via the Lock Code Manager in hubitat since I don’t know of a way to change codes from within HA) one of the locks is getting the following error when I try and lock or unlock it via HA: " Failed to call service lock/unlock. Code ‘’ for locking Back Door Lock doesn’t match pattern ^\d{6}$ ". When I lock or unlock either device from Hubitat it works. The other lock also works fine from HA. When I started inspecting the devices, I found that the lock that is now not working has an additional attribute named “Code Length” with a value of “6”. The list of attributes in the dropdown shows it along with the other attributes like the codes and their names. That device also has a text field that says ‘Code’ that allows a code to be typed in and a button for Lock/Unlock using that typed code. The other device (that is still working from HA) does not have that ‘Code’ field or the additional attribute “Code Length”. I’m assuming HA doesn’t know what to correctly do with that attribute and the service is failing. I then went into Hubitat and looked at the settings on the lock that doesn’t work in HA, the one that has the extra attribute of ‘Code length’. I compared it to the lock that still works in HA, and that lock did not have the ‘Code length’ set in Hubitat. It did have the place for it, and a red ‘required’ field. Once I set the Code length on that lock, it added the attribute through the integration and into HA. That lock now gets the same error. I don’t know if Hubitat had an update for the device to now include the Code length as an attribute or what, but it seems like the integration in HA is not able to properly consume that attribute from Hubitat and now neither lock works in HA. Anyone seen similar issues?

2exclusive commented 1 year ago

I'm getting the same issue since I updated the hubitat integration add on in homeassistant. I get the " Failed to call service lock/unlock. Code ‘’ for locking Garage Entry Door Lock doesn’t match pattern ^\d{6}$ " Any fix for this ?

jason0x43 commented 1 year ago

That error is happening at the Home Assistant side. Home assistant lock components have supported an input format check for a long time (to verify that you typed in a code of the proper format), but HA didn't actually start using the check until relatively recently.

From the error, HA expects a 6-digit numeric code. Is that correct (and is that what you're using)?

2exclusive commented 1 year ago

hey Jason, yes my lock code is a 6 digit number. interesting part is that it gets update status but executing lock or unlock door function from HA it gives that error. Is there anything i can do to fix it on the HA side ?

jason0x43 commented 1 year ago

Are you seeing exactly the same error as @mfsamuelson? Specifically,

Failed to call service lock/unlock. Code ‘’ for locking Back Door Lock doesn’t match pattern ^\d{6}$

If that's the case, are you actually sending the code?

mfsamuelson commented 1 year ago

Yes, I am getting the same error. When I go to the device and open up the Controls, it has a textbox for entering a code, and when I enter a valid code manually and click the 'Lock' (or 'Unlock' depending on current status) it does work. But there doesn't seem to be a place to store this for the rest of HA to use. On that same Controls page there is 'Unlock' and 'Lock' at the top next to the name of the device ('Garage Door Lock' in this case) and clicking either of those gives the error shown above. The only way it works is by manually entering a code and clicking the 'Unlock' in between the 'Code' textbox and 'Attributes' dropdown when viewing the properties of the device.

On my dashboard I am using a Glance Card to control those lock devices, "tap_action: > action: toggle" are the only properties.

2exclusive commented 1 year ago

Yes, I am getting the same error. When I go to the device and open up the Controls, it has a textbox for entering a code, and when I enter a valid code manually and click the 'Lock' (or 'Unlock' depending on current status) it does work. But there doesn't seem to be a place to store this for the rest of HA to use. On that same Controls page there is 'Unlock' and 'Lock' at the top next to the name of the device ('Garage Door Lock' in this case) and clicking either of those gives the error shown above. The only way it works is by manually entering a code and clicking the 'Unlock' in between the 'Code' textbox and 'Attributes' dropdown when viewing the properties of the device.

On my dashboard I am using a Glance Card to control those lock devices, "tap_action: > action: toggle" are the only properties.

same exact issue for me also, this was never the case before. so may look like HA update broke this or hubitat update but Jason confirmed its on the HA side

jason0x43 commented 1 year ago

It has a textbox for entering a code, and when I enter a valid code manually and click the 'Lock' (or 'Unlock' depending on current status) it does work

Great, that's at least means things are working.

It sounds like the integration was previously able to unlock the locks without sending a code, or at least by sending an empty code. Now that HA is paying attention to the lock code format, it doesn't like that (because an empty code doesn't follow the format).

I'll update the integration to make the code optional.

2exclusive commented 1 year ago

Great news Jason! this would definitely resolve the issue we are facing. thanks again in advance. Ill definitely test it out as soon as you release it. let me know.

2exclusive commented 1 year ago

what's your "buy me a coffee" link also so I can contribute.

jason0x43 commented 1 year ago

This should be fixed in v0.8.6. Give that a try and let me know if it resolves your issue.

mfsamuelson commented 1 year ago

That did it! Thank you for the quick update!

jason0x43 commented 1 year ago

what's your "buy me a coffee" link also so I can contribute.

Bottom of the README (as of a few minutes ago). Zero pressure, but you're not the first person to ask, so I figured I might as well add one. 🙂

2exclusive commented 1 year ago

what's your "buy me a coffee" link also so I can contribute.

Bottom of the README (as of a few minutes ago). Zero pressure, but you're not the first person to ask, so I figured I might as well add one. 🙂

many thanks, that worked!!!! Coffee on me (sent)