Kevo Plus door locks now working in Home Assistant

No dice on that front either, though the Kevo component wasn’t working before I installed the Homebridge-Kevo add-on either.

Odd. I have no idea.

It doesn’t seem to be a Hassio problem. I’ve just tried getting it to work on a Raspian Lite install with the configuration set to no devices except the Kevo component and I’m still getting the same error.

This may be a dumb question, but you do have a kevo plus bridge, correct? I’m just making sure we touch on everything.

I spent enough years in IT to know that there’s no such thing as a dumb question when troubleshooting.
Yes I do have a Kevo bridge. The MyKevo web site itself works just fine as does the Kevo plugin for HomeBridge.

Can you try running the following command and see if it returns your lock ID? If you’re running hass in a venv, you’ll need to activate it first, and obviously enter your username and password.

python3
from pykevoplus import Kevo
locks = Kevo.GetLocks("[email protected]", "password123")
for lock in locks:
    print(repr(lock))

You should get something like this:

(hass) hass@RPi3:~ $ python3
Python 3.6.0 (default, Jul 15 2017, 10:30:33) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pykevoplus import Kevo
>>> locks = Kevo.GetLocks("[email protected]", "password123")
>>> for lock in locks: 
... 	print(repr(lock))
... 
KevoLock(name=Back Door, id=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, state=Unlocked)
KevoLock(name=Front Door, id=YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY, state=Unlocked)
>>>

After the third line (with my username and password of course), I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.5/site-packages/pykevoplus/__init__.py", lin                                                                      e 88, in GetLocks
    lock_id = lock_info.get("data-lock-id")
AttributeError: 'NoneType' object has no attribute 'get'

I also tried changing my password temporarily to one without special characters to see if maybe that was causing the problem and I still received the same error.

It definitely looks like it’s trying to use the pykevoplus library instead of the pykevocontrol library, based on the install directory. Would you mind trying to manually install the library and run the commands again?

pip3 install pykevocontrol 

You might need to run this as sudo.

Same problem. This is on a clean install of Raspbian as well so there shouldn’t be any copies of PyKevoPlus on it. Trying to uninstall PyKevoPlus with Pip also returns that it’s not installed.

I’m grasping at straws at this point, can you run the following and let me know what it outputs?

pip install show
pip show pykevocontrol

Output should be similar to

(hass) hass@RPi3:~ $ pip3 show pykevocontrol
Name: pykevocontrol
Version: 2.0.0
Summary: Control Kwikset Kevo locks
Home-page: https://github.com/bahnburner/pykevoplus
Author: Tristan Caulfield
Author-email: [email protected]
License: MIT
Location: /srv/hass/lib/python3.6/site-packages
Requires: beautifulsoup4, requests

The only other thing I can think of is possibly an issue between python version 3.5 and 3.6.

I did get it working though it’s a strange bug. On a whim I decided to try with my wife’s email and password and to my surprise it worked. It just doesn’t seem to like my email address.

My solution was to create a new user just for Home Assistant which ultimately makes more sense as it will report that HASS has locked or unlocked the door in the Kevo app rather than my user.

That’s extremely strange, but I’m glad you got it working. As a sidenote, I use a unique email address specifically for hass as well, for that very reason.

The only thing I can possible figure then is maybe it’s not working because I’m the owner of the locks on that account, rather than the admin, but that doesn’t explain why the HomeBridge plugin works.

Just the same, I’m glad I got it working.

Thank you for your help!

You sir, are a GD genius! Thank you!!

It looks like Kwikset has made some server-side changes to intentionally break this component. Things will work for a few minutes after a restart, but then every update will fail with an error 500 from the server. Running the python commands from the cli still work successfully, so this isn’t a global outage.

I’ve reverted to the original method for control until something changes.

Anyone else having the same issue?

error log:

Update for lock.front_door fails
Traceback (most recent call last):
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/lib/python3.5/site-packages/homeassistant/components/lock/kevo.py", line 69, in update
    self._state = self._kevo.GetBoltState().lower()
  File "/srv/hass/lib/python3.5/site-packages/pykevoplus/__init__.py", line 108, in _wrapped
    return method(self, *args, **kwargs)
  File "/srv/hass/lib/python3.5/site-packages/pykevoplus/__init__.py", line 272, in GetBoltState
    self.Refresh()
  File "/srv/hass/lib/python3.5/site-packages/pykevoplus/__init__.py", line 108, in _wrapped
    return method(self, *args, **kwargs)
  File "/srv/hass/lib/python3.5/site-packages/pykevoplus/__init__.py", line 223, in Refresh
    raise KevoError("Error getting lock info: {}".format(info_result.text))
pykevoplus.KevoError: Error getting lock info: {"status":"500","error":"Internal Server Error"}

Mine has not worked for a week or so…

I went back to using separate python scripts and have my locks functioning again. Maybe @gaggle331 can look into what’s going on with the component soon.

Sorry for kinda disappearing after my initial release of the component, I had lots of real life stuff to take care of recently.

However, I’ve been using the component since then and I’ve had 0 issues. I’m unable to replicate the issue you’re having. Is it repeatable? Is it possible that Kwikset implemented a system to deny requests if you’re hitting their servers too much? I personally don’t have any automations that hit my locks more than ~4 times/day, then there’s also the update that gets the current state of the locks. Maybe it’s possible to reduce that update frequency if this is the cause. I’ll look into it.

@Bahnburner can you try the component again and just make it sure it wasn’t a one-off issue?

I’ll give it a shot when I get home. It happened to my quite a few times, but it seemed a reboot would fix it for a short period. Interestingly, it would initially only fail for one of my two locks, but if left long enough, it would fail for the other. I definitely think it’s an intentional move on Kwikset’s end. I’m just unsure how they’re determining what or when to block, as logging into the cli on the same device and running the pykevoplus commands manually still work as expected.

I’m seeing similar errors. My lock will work infrequently, but does work for the most part. I’ve been getting this error every 30 seconds for the last 3 hours.

2018-02-01 10:08:55 ERROR (MainThread) [homeassistant.helpers.entity] Update for lock.side_door fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 199, in async_update_ha_state
    yield from self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 306, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/lock/kevo.py", line 68, in update
    self._state = self._kevo.GetBoltState().lower()
  File "/srv/homeassistant/lib/python3.5/site-packages/pykevoplus/__init__.py", line 108, in _wrapped
    return method(self, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/pykevoplus/__init__.py", line 272, in GetBoltState
    self.Refresh()
  File "/srv/homeassistant/lib/python3.5/site-packages/pykevoplus/__init__.py", line 108, in _wrapped
    return method(self, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/pykevoplus/__init__.py", line 223, in Refresh
    raise KevoError("Error getting lock info: {}".format(info_result.text))
pykevoplus.KevoError: Error getting lock info: {"status":"500","error":"Internal Server Error"}