Closed Palmer-Pesta closed 1 year ago
Note: After looking at breaking changes, it might be the upgrade to python 3.9 -> 3.10.
I also had this problem and it seems to be async_lock and async_unlock should be accepting arguments but currently are not. I made a small change and now the locks are working. I don't know a lot about this system, but I am basing it off this change I saw in the Home Assistant Core repo.
--- async def async_lock(self):
+++ async def async_lock(self, **kwargs):
--- async def async_unlock(self):
+++ async def async_unlock(self, **kwargs):
Hi @Palmer-Pesta! Glad to hear this integration is working out for you!
Guess you saw my latest release. Low key I haven't updated my HA instance yet & make sure everything works out there but i'm guessing its all good since the issue is closed! Let me know if theres any other issues in general though
Also thanks for the help @tjleach98!
This error originated from a custom integration.
Logger: homeassistant.loader
Source: custom_components/smartrent/lock.py:63
Integration: SmartRent (documentation, issues)
First occurred: 3:01:20 PM (2 occurrences)
Last logged: 3:04:30 PM
Unexpected exception importing platform custom_components.smartrent.lock
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 749, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 766, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/config/custom_components/smartrent/lock.py", line 22, in <module>
class SmartrentLock(LockEntity):
File "/config/custom_components/smartrent/lock.py", line 63, in SmartrentLock
async def async_lock(self, **kwargs: Any):
NameError: name 'Any' is not defined
Apologies, I might have too hastefully resolved this issue. It looks like it is now rejecting the Any
keyword.
--- async def async_lock(self, **kwargs: Any):
+++ async def async_lock(self, **kwargs):
--- async def async_unlock(self, **kwargs: Any):
+++ async def async_unlock(self, **kwargs):
Please note I made the following changes and the integration works again.
Since upgrading not only does my lock not work, but it can't even be set up. Please help!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 749, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 766, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
Same issue as above. You can edit the code by control + f to find it in vscode (under custom_components) and remove the : Any
. Note: you will then need to remove the device integration and readd it. Don't redownload or uninstall in hacs only the HA devices page. Or just wait until a new release of this library is published.
Sorry ya'll! I just pushed out a new release. Should restore the functionality of the locks.
I was able to update my HA instance to latest and test it there too. So the original issue should be fixed as well.
Let me know if anything else is goin wrong and I can take a look at things
Confirmed that these changes worked. Closing the issue now. Thanks for your help, Zach!
It's no problem! Thanks for the great feedback & helping me test out stuff!
Sorry for noob question, but I am also having this same issue. I've deleted and reinstalled the integration, and my Home assistant is up to date (2023.2.3)
Yet I get the following error when triggering lock/unlock from the frontend:
Failed to call service lock/lock. SmartrentLock.async_lock() got an unexpected keyword argument 'entity_id'
@yousefmansy1 after you reinstalled the SmartRent integration have you restarted your Homeassistant instance?
Yes I have restarted my HA instance.
Is there a way to validate the version of the plug in I'm using?
Im actually not sure if theres a way to view the info reliably with the UI 🤔
But if you have command line access you can output some information that contains the version number for the integration.
You should be able to navigate to wherever homeassistant stores config and then view the file in custom_components/smartrent/manifest.json
$ cat config/custom_components/smartrent/manifest.json
{
"domain": "smartrent",
"name": "SmartRent",
"documentation": "https://github.com/ZacheryThomas/homeassistant-smartrent",
"issue_tracker": "https://github.com/ZacheryThomas/homeassistant-smartrent/issues",
"dependencies": [],
"codeowners": ["@zacherythomas"],
"config_flow": true,
"requirements": ["smartrent.py==0.3.1"],
"iot_class": "cloud_push",
"version": "0.3.5"
}
Yep that looks to be the issue. Despite reinstalling, I'm somehow on 0.3.2
{
"domain": "smartrent",
"name": "SmartRent",
"documentation": "https://github.com/ZacheryThomas/homeassistant-smartrent",
"issue_tracker": "https://github.com/ZacheryThomas/homeassistant-smartrent/issues",
"dependencies": [],
"codeowners": ["@zacherythomas"],
"config_flow": true,
"requirements": ["smartrent.py==0.3.0"],
"iot_class": "cloud_push",
"version": "0.3.2"
}
So pt2 of noob question, how can I ensure I'm installing the latest version of an integration? I'm using the web interface but perhaps there's a better way?
@yousefmansy1 what normally works for me is when you are on the HACS page for Smartrent is clicking:
If thats not working at all you can delete your custom-component/smartrent
directory and then install things manually. You can download the code as a zip file, unzip it then move the content from my repos homeassistant-smartrent/custom-component/smartrent
into the right location in your HA instance
Here is some more info about that method: https://github.com/ZacheryThomas/homeassistant-smartrent#installing-manually
I had a major brain fart, I forgot about the HACS store showing its own updates. It updated perfectly through there and my lock integration works perfectly fine now.
Thanks!
haha no problem!! Glad you got everything working out!
First, I want to say great job on this integration; I use it a lot.
Recently I've hit this stack trace when trying to lock/unlock. Everything else works, and I've tried to uninstall, wipe pvcs, etc.