Skip to content

Commit

Permalink
fix: controller supported protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jan 31, 2024
1 parent 59ce90e commit 9b2c563
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 10 additions & 0 deletions api/lib/ZwaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6012,12 +6012,22 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
} else {
logger.info('RF region is not supported by controller')
}

// when RF region changes, check if long range is supported
if (
this.driver.controller.supportsLongRange !==
node.supportsLongRange
) {
node.supportsLongRange =
this.driver.controller.supportsLongRange
}
}

this.emitNodeUpdate(node, {
powerlevel: node.powerlevel,
measured0dBm: node.measured0dBm,
RFRegion: node.RFRegion,
supportsLongRange: node.supportsLongRange,
})
}

Expand Down
8 changes: 6 additions & 2 deletions src/components/nodes-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,12 @@
v-if="!item.isControllerNode"
:value="richValue(item, 'protocol')"
/>
<div title="Long range" v-else>
{{ item.supportsLongRange ? 'LR ✅' : 'LR ❌' }}
<div v-else>
<rich-value :value="getControllerProtocolIcon(false)" />
<rich-value
v-if="item.supportsLongRange"
:value="getControllerProtocolIcon(true)"
/>
</div>
</template>
<template v-slot:[`item.failed`]="{ item }">
Expand Down
15 changes: 15 additions & 0 deletions src/components/nodes-table/nodes-table.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import draggable from 'vuedraggable'
import colors from 'vuetify/lib/util/colors'
import { ManagedItems } from '@/modules/ManagedItems'
import { Protocols } from '@zwave-js/core/safe'

import { mapState } from 'pinia'
import {
Expand Down Expand Up @@ -256,6 +257,20 @@ export default {

return undefined
},
getControllerProtocolIcon(longRange) {
const protocol = longRange
? Protocols.ZWaveLongRange
: Protocols.ZWave

return {
align: 'center',
icon: mdiZWave,
iconStyle: `color: ${getProtocolColor({
protocol,
})}`,
description: getProtocol({ protocol }),
}
},
groupValue(group) {
return this.managedNodes.groupValue(group)
},
Expand Down

0 comments on commit 9b2c563

Please sign in to comment.