Skip to content

Update device.py#59

Closed
svh1985 wants to merge 1 commit into
pschmitt:masterfrom
svh1985:master
Closed

Update device.py#59
svh1985 wants to merge 1 commit into
pschmitt:masterfrom
svh1985:master

Conversation

@svh1985
Copy link
Copy Markdown

@svh1985 svh1985 commented Aug 2, 2020

Added support for the magnetic door sensor which comes with Nuki 2.0:
https://developer.nuki.io/page/nuki-bridge-http-api-1-11/4/#heading--doorsensor-states

Ran a test against my bridge:

from pynuki import NukiBridge

bridges = NukiBridge.discover()
br = bridges[0]
br.token = "MY_TOKEN"

print(br.devices[0].door_sensor_state_name)
print(br.devices[0].door_sensor_state)

Output door closed:

door closed
2

Output door opened:

door opened
3

Added support for door sensor Nuki 2.0
Copy link
Copy Markdown
Owner

@pschmitt pschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. Please see my comment.

Comment thread pynuki/device.py
def state_name(self):
return self._json.get("stateName")

@property
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATM the device class is not the right place for this. It was meant as a base class that hosts all the common attributes. You mentioned this is for Niki 2.0 devices only. It would make more sense to create a new NukiV2 that inherits from NukiLock or even better: an intermediate class NukiBaseLock and a NukiV1 and NukiV2 that both inherit from it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, seems to be good idea, how i can help/improve you to build code ?

Copy link
Copy Markdown
Owner

@pschmitt pschmitt Aug 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. What helps most is PRs :)

@pschmitt
Copy link
Copy Markdown
Owner

Closing as #61 has been merged.

@pschmitt pschmitt closed this Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants