Skip to content

Commit

Permalink
feat(mqtt-discovery): gateway values setting to enable by default Con…
Browse files Browse the repository at this point in the history
…figuration CC entities (#4106)
  • Loading branch information
robertsLando authored Jan 27, 2025
1 parent 54224d2 commit 81ebd61
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
8 changes: 8 additions & 0 deletions api/lib/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export type GatewayValue = {
receiveFunction?: string
qos?: 0 | 1 | 2
retain?: boolean
ccConfigEnableDiscovery?: boolean
}

export type ScheduledJob = {
Expand Down Expand Up @@ -1753,6 +1754,13 @@ export default class Gateway {
default:
return
}

// by default configuration CC discovery entities are disabled
// them can be enabled by setting ccConfigEnableDiscovery to true
// on gateway values configuration
cfg.discovery_payload.enabled_by_default =
!!valueConf?.ccConfigEnableDiscovery

break
}
default:
Expand Down
38 changes: 22 additions & 16 deletions src/components/dialogs/DialogGatewayValue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@
></v-text-field>
</v-col>
<v-col cols="6">
<v-switch
<v-checkbox
label="Poll"
hint="Enable poll of this value. ATTENTION: This could create lot traffic in your network and kill the life of battery powered devices. Use at your own risk"
persistent-hint
v-model="editedValue.enablePoll"
></v-switch>
></v-checkbox>
</v-col>
<v-col v-if="editedValue.enablePoll" cols="6">
<v-text-field
Expand All @@ -151,25 +151,31 @@
type="number"
></v-text-field>
</v-col>
<!--
<v-col cols="6">
<v-switch
label="Verify changes"
hint="Verify changes of this value"
persistent-hint
v-model="editedValue.verifyChanges"
></v-switch>
</v-col>

-->
<v-col
cols="6"
v-if="
editedValue.value &&
editedValue.value.commandClass === 112
"
>
<v-checkbox
label="Enable discovery"
hint="Configuration CC values are disabled by default in MQTT discovery. Set this to true to force enable them"
persistent-hint
v-model="
editedValue.ccConfigEnableDiscovery
"
></v-checkbox>
</v-col>

<v-col cols="6">
<v-switch
<v-checkbox
label="Parse send"
hint="Create a function that parse the value sent via MQTT"
persistent-hint
v-model="editedValue.parseSend"
></v-switch>
></v-checkbox>
</v-col>

<v-container v-if="editedValue.parseSend">
Expand All @@ -189,12 +195,12 @@
</v-container>

<v-col cols="6">
<v-switch
<v-checkbox
label="Parse receive"
hint="Create a function that parse the received value from MQTT"
persistent-hint
v-model="editedValue.parseReceive"
></v-switch>
></v-checkbox>
</v-col>

<v-container v-if="editedValue.parseReceive">
Expand Down

0 comments on commit 81ebd61

Please sign in to comment.