@zwave-js/cc 15.7.0 → 15.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81,6 +81,10 @@ export type ConfigurationCCAPISetOptions = {
81
81
  bitMask: number;
82
82
  value: number;
83
83
  });
84
+ /**
85
+ * Updates the stored metadata labels and descriptions from the device config file.
86
+ */
87
+ export declare function refreshMetadataStringsFromConfigFile(ctx: GetValueDB & GetDeviceConfig, nodeId: number, endpointIndex: number): void;
84
88
  export declare class ConfigurationCCAPI extends CCAPI {
85
89
  supportsCommand(cmd: ConfigurationCommand): MaybeNotKnown<boolean>;
86
90
  protected get [SET_VALUE](): SetValueImplementation;
@@ -45,7 +45,8 @@ __export(ConfigurationCC_exports, {
45
45
  ConfigurationCCPropertiesReport: () => ConfigurationCCPropertiesReport,
46
46
  ConfigurationCCReport: () => ConfigurationCCReport,
47
47
  ConfigurationCCSet: () => ConfigurationCCSet,
48
- ConfigurationCCValues: () => import_CCValues_generated.ConfigurationCCValues
48
+ ConfigurationCCValues: () => import_CCValues_generated.ConfigurationCCValues,
49
+ refreshMetadataStringsFromConfigFile: () => refreshMetadataStringsFromConfigFile
49
50
  });
50
51
  module.exports = __toCommonJS(ConfigurationCC_exports);
51
52
  var __validateArgs = __toESM(require("./ConfigurationCC._validateArgs.js"), 1);
@@ -206,6 +207,40 @@ function getParamInformationFromConfigFile(ctx, nodeId, endpointIndex) {
206
207
  }
207
208
  }
208
209
  __name(getParamInformationFromConfigFile, "getParamInformationFromConfigFile");
210
+ function refreshMetadataStringsFromConfigFile(ctx, nodeId, endpointIndex) {
211
+ const paramInfo = getParamInformationFromConfigFile(ctx, nodeId, endpointIndex);
212
+ if (!paramInfo)
213
+ return;
214
+ const valueDB = ctx.getValueDB(nodeId);
215
+ for (const [param, info] of paramInfo.entries()) {
216
+ const valueId = import_CCValues_generated.ConfigurationCCValues.paramInformation(param.parameter, param.valueBitMask).endpoint(endpointIndex);
217
+ const existing = valueDB.getMetadata(valueId);
218
+ if (!existing)
219
+ continue;
220
+ if (!existing.isFromConfig)
221
+ continue;
222
+ let didChange = false;
223
+ if (info.label !== existing.label) {
224
+ existing.label = info.label;
225
+ didChange = true;
226
+ }
227
+ if (info.description !== existing.description) {
228
+ existing.description = info.description;
229
+ didChange = true;
230
+ }
231
+ if (existing.states) {
232
+ for (const option of info.options) {
233
+ if (option.value in existing.states && existing.states[option.value] !== option.label) {
234
+ existing.states[option.value] = option.label;
235
+ didChange = true;
236
+ }
237
+ }
238
+ }
239
+ if (didChange)
240
+ valueDB.setMetadata(valueId, existing);
241
+ }
242
+ }
243
+ __name(refreshMetadataStringsFromConfigFile, "refreshMetadataStringsFromConfigFile");
209
244
  let ConfigurationCCAPI = (() => {
210
245
  let _classDecorators = [(0, import_CommandClassDecorators.API)(import_core.CommandClasses.Configuration)];
211
246
  let _classDescriptor;
@@ -2171,6 +2206,7 @@ __name(serializeValue, "serializeValue");
2171
2206
  ConfigurationCCPropertiesReport,
2172
2207
  ConfigurationCCReport,
2173
2208
  ConfigurationCCSet,
2174
- ConfigurationCCValues
2209
+ ConfigurationCCValues,
2210
+ refreshMetadataStringsFromConfigFile
2175
2211
  });
2176
2212
  //# sourceMappingURL=ConfigurationCC.js.map