Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
#75 - move to longer unique id as suggested in vintlabs/fauxmoESP#166…
Browse files Browse the repository at this point in the history
  • Loading branch information
michbeck100 committed Sep 27, 2021
1 parent d45310f commit 5fe77d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ jspm_packages
# Intellij IDEA
.idea
*.iml

echo-database
pimatic-database.sqlite*
config.json
5 changes: 3 additions & 2 deletions lib/hue.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = (env) =>
if Object.keys(devices).length < 50
return (deviceName, buttonId) =>
uniqueId = ("0" + (Object.keys(devices).length + 1).toString(16)).slice(-2).toUpperCase()
uniqueId = @macAddress + ":00:" + uniqueId + "-" + uniqueId
deviceId = @_hash(deviceName)
devices[deviceId] = {
id: deviceId,
Expand All @@ -59,10 +60,10 @@ module.exports = (env) =>
}
device: device,
name: deviceName,
uniqueId: "00:17:88:5E:D3:" + uniqueId + "-" + uniqueId,
uniqueId: uniqueId,
buttonId: buttonId
}
env.logger.debug("successfully added device #{deviceName} as dimmable light")
env.logger.debug("successfully added device #{deviceName} with uniqueId=#{uniqueId}")
else
env.logger.warn("Max number of devices exceeded.")
return () ->
Expand Down

0 comments on commit 5fe77d8

Please sign in to comment.