Skip to content

Commit

Permalink
feat(ui): add link to zwavejs devices db (#708)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Feb 23, 2021
1 parent d5ef37e commit ebb5036
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/ZwaveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,14 @@ function initNode (zwaveNode) {
}

node.deviceId = getDeviceID(node)
node.hexId = `${utils.num2hex(node.manufacturerId)}-${utils.num2hex(
node.productId
)}-${utils.num2hex(node.productType)}`

const hexIds = [
utils.num2hex(node.manufacturerId),
utils.num2hex(node.productId),
utils.num2hex(node.productType)
]
node.hexId = `${hexIds[0]}-${hexIds[2]}-${hexIds[1]}`
node.dbLink = `https://devices.zwave-js.io/?jumpTo=${hexIds[0]}:${hexIds[2]}:${hexIds[1]}:${node.firmwareVersion}`

this.getGroups(zwaveNode.id, true)
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/nodes-table/NodeDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<span class="subtitle font-weight-bold">{{
`${node.deviceId} (${node.hexId})`
}}</span>
<v-icon @click="openLink(node.dbLink)" class="ml-2">ios_share</v-icon>
</v-row>

<v-row>
Expand Down Expand Up @@ -184,6 +185,9 @@ export default {
},
methods: {
...mapMutations(['showSnackbar']),
openLink (link) {
window.open(link, '_blank')
},
apiRequest (apiName, args) {
if (this.socket.connected) {
const data = {
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export type Z2MNode = {
ready: boolean
failed: boolean
lastActive: number
dbLink: string
interviewCompleted: boolean
maxBaudRate: number
interviewStage: InterviewStage
Expand Down

0 comments on commit ebb5036

Please sign in to comment.