Skip to content

Proper handling of the device_id representation#228

Merged
syssi merged 2 commits intorytilahti:masterfrom
syssi:feature/construct-missing-unhexlify
Feb 17, 2018
Merged

Proper handling of the device_id representation#228
syssi merged 2 commits intorytilahti:masterfrom
syssi:feature/construct-missing-unhexlify

Conversation

@syssi
Copy link
Copy Markdown
Collaborator

@syssi syssi commented Feb 17, 2018

No description provided.

@coveralls
Copy link
Copy Markdown

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
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
Copy Markdown
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
Copy Markdown
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