-
Notifications
You must be signed in to change notification settings - Fork 11
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
Generate UUID1 from MAC address #32
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I consider to release my clone with the 'add-color' branch merged. If you can update your changes, I will merge yours into my repo. And push it out as a new 'official' release, as this one has become stale.
@@ -36,7 +36,11 @@ class Twinkly { | |||
return this.requestService.get("gestalt", false) | |||
.then(json => { | |||
this.name = json.device_name; | |||
this.uuid = json.uuid; | |||
if (json.uuid == "00000000-0000-0000-0000-000000000000") { | |||
this.uuid = `00000000-0000-1000-8000-${json.mac.replaceAll(":", "")}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to just use zeroes instead of the '1000' and the '8000' sequence in the time-stamp part, and ignore 'versions' etc.
@@ -36,7 +36,11 @@ class Twinkly { | |||
return this.requestService.get("gestalt", false) | |||
.then(json => { | |||
this.name = json.device_name; | |||
this.uuid = json.uuid; | |||
if (json.uuid == "00000000-0000-0000-0000-000000000000") { | |||
this.uuid = `00000000-0000-1000-8000-${json.mac.replaceAll(":", "")}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add .toUpper()
to prettify the output as it is in the twinkly controllers
I looooove your changes, this was something bothering me for a while. Excited you have fixed it already!! |
@@ -36,7 +36,11 @@ class Twinkly { | |||
return this.requestService.get("gestalt", false) | |||
.then(json => { | |||
this.name = json.device_name; | |||
this.uuid = json.uuid; | |||
if (json.uuid == "00000000-0000-0000-0000-000000000000") { | |||
this.uuid = `00000000-0000-1000-8000-${json.mac.replaceAll(":", "")}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaceAl(":" ...
must be replace(/:/g ...
, since we need to support node.js v14
I've included this pull request with some minor changes: |
I have three Twinkly lights. Two are
TW175SEUM06
and one isTW175SEUP07
.The two
TW175SEUM06
report"uuid":"00000000-0000-0000-0000-000000000000"
and hence the plugin kept sayingFound known device
IP address changed to
and alternating between the IPs of the twoTW175SEUM06
s.For reference:
This PR generates a deterministic UUID version1 from the MAC address of the Twinkly if a nil UUID is detected.
My two
TW175SEUM06
are now uniquely identifiable and all appears to be working: