-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Nuki opener #43
Comments
Please give the current master branch a try. from pynuki import NukiBridge
nb = NukiBridge.discover()
nb.token = "XXXXXXX"
print(nb.locks)
print(nb.openers) |
I have the same problem using this on HA, their nuki component is using this pynuki lib. This is the error HA is reporting when trying to unlock my opener: As you can see, this parameter is not in the url, and that is the cause of the error. If you put it manually in the url (deviceType=2, for the opener) it works like a charm. The same thing will happen with the lockStatus endpoint. I think a solution could be the inclusion of this parameter in the lock and unlock methods in both bridge.py and lock.py, but I'm not confident in my Python abilities to do it myself :) |
@pschmitt, here you go. Right now, I only have an opener and no lock: from pynuki import NukiBridge
nb = NukiBridge.discover()
nb[0].token = "XXXXXXX" Then the output is: >>> print(nb[0].locks)
[<NukiLock: {'deviceType': 2, 'nukiId': xxxxxxxxx, 'name': 'opener', 'firmwareVersion': '1.3.1', 'mode': 2, 'state': 1, 'stateName': 'online', 'batteryCritical': False}>]
>>> print(nb[0].openers)
[<NukiOpener: {'deviceType': 2, 'nukiId': xxxxxxxxx, 'name': 'Öffner', 'firmwareVersion': '1.3.1', 'mode': 2, 'state': 1, 'stateName': 'online', 'batteryCritical': False}>] |
If you make the following changes to lock(), unlock(), and open() in https://github.com/home-assistant/core/blob/master/homeassistant/components/nuki/lock.py, it should work for you:
|
@thomkaufmann Your "fix" should work anymore since 1.3.4. Can any of you try out 1.3.4? |
@pschmitt That's right, it no longer works with 1.3.4:
|
Just to clarify:
Home Assistant is out of scope for now. Openers were only discovered because of #48. I need to focus on pynuki first. I'll probably issue a PR to hass once the pynuki stuff is sorted out here. Should the |
Thanks for you work on this :) The openers have a feature called "Ring to Open" (rto) which, when activated, triggers the building/community door to buzz you in when you ring your apartment's buzzer. |
Thansk for the clarification. I implemented some of these methods here. |
Yup, those are all of the actions needed. |
Is it working now? Can I make some local test? |
@alceasan It won't yet work in HA, but you can test pynuki using the lock_action() method in bridge.py:
Using your nuki_id's from the locks and openers calls above, you can use the lock_action method to control them. For example:
You can refer to constants.py for the action values. And you can easily monitor the state changes using your browser: http://[Bridge IP]:8080/list?token=XXXXXXX @pschmitt I'm happy to help where I can, so please let me know how to contribute. |
You should also be able to do the following: from pynuki import NukiBridge
nb = NukiBridge.discover()
br = nb[0]
br.token = "YOUR_TOKEN"
br.openers[0].activate_rto()
br.openers[0].deactivate_rto() @thomkaufmann If you'd like to tackle the Home Assistant integration update that'd be great. It shouldn't be much work. A few pointers:
Also I'd like to make sure that we can get the RTO state in pynuki's |
I released 1.3.5 with your changes @thomkaufmann |
@pschmitt Great! I'm working on the HASS integration. I'm new to HASS, so I appreciate the pointers above. |
I'll take a look once you submit your PR. Thanks a lot for your help. |
PR submitted: home-assistant/core#35695 |
Cool, cool. But why did you close it? |
Oh, sorry, I updated the pynuki version in manifest.json and fixed the typo. I submitted a new pull request: home-assistant/core#35702 |
You could just have left it as is. If it is the commit history that worries you, don't. Maintainers can squash commits if your branch's history is too messy. It's what the Home Assistant maintainers normally do as well if I am not mistaken. |
No idea if this goes here. But i get an error with the nuki opener. As far as i could read from a HA forum post by you, you don't have one? If i can test stuff for you, please do tell. The error is as follows.
404 Client Error: Not Found for url: http://[MYip]:8080/lockAction?token=[MyToken]&nukiId=[MyNukiID]&action=3&noWait=1
The text was updated successfully, but these errors were encountered: