Skip to content
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

Proper handling of the device_id representation #228

Merged
merged 2 commits into from
Feb 17, 2018

Conversation

syssi
Copy link
Collaborator

@syssi syssi commented Feb 17, 2018

No description provided.

@coveralls
Copy link

coveralls commented Feb 17, 2018

Coverage Status

Coverage increased (+0.02%) to 67.977% when pulling d712e90 on syssi:feature/construct-missing-unhexlify into afeaa81 on rytilahti:master.

miio/device.py Outdated
@@ -243,7 +243,7 @@ def send(self, command: str, parameters: Any=None, retry_count=3) -> Any:
data, addr = s.recvfrom(1024)
m = Message.parse(data, token=self.token)
self._device_ts = m.header.value.ts
self._device_id = m.header.value.device_id
self._device_id = binascii.hexlify(m.header.value.device_id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rytilahti Does the device_id change over time? I hope not. I assume this line could be removed.

@syssi syssi changed the title Missing binascii.unhexlify/binascii.hexlify added Proper handling of the device_id representation Feb 17, 2018
@syssi syssi merged commit 026cf90 into rytilahti:master Feb 17, 2018
@rytilahti
Copy link
Owner

rytilahti commented Feb 18, 2018

@syssi Wrt. your (now-removed) question about changes in device id over time, I suppose it should not be doing that. The only reason I added Hex to that value was to see it pretty-printed out without any extra changes elsewhere in the code, but I suppose that field could simply be left to be bytes and then convert it when printing it out.

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