matterbridge-example-dynamic-platform 2.0.18 → 2.0.19-dev-20260606-273db3d

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.
package/CHANGELOG.md CHANGED
@@ -28,6 +28,21 @@ If you like this project and find it useful, please consider giving it a star on
28
28
 
29
29
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
30
30
 
31
+ ## [2.0.19] - Dev branch
32
+
33
+ ### Added
34
+
35
+ - [fan]: Set FanControl.fanMode on remote FanControl.percentSetting changes. Thanks Ludovic BOUÉ (https://github.com/Luligu/matterbridge-example-dynamic-platform/issues/55).
36
+
37
+ ### Changed
38
+
39
+ - [package]: Update dependencies.
40
+ - [package]: Bump `@types/node` to v.25.9.2.
41
+ - [package]: Bump `eslint-plugin-jsdoc` to v.63.0.2.
42
+ - [package]: Bump `npm-check-updates` to v.22.2.3.
43
+
44
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
45
+
31
46
  ## [2.0.18] - 2026-06-05
32
47
 
33
48
  ### Breaking changes
package/dist/module.js CHANGED
@@ -1096,42 +1096,52 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1096
1096
  .createDefaultFanControlClusterServer()
1097
1097
  .addRequiredClusterServers();
1098
1098
  this.fanDefault = await this.addDevice(this.fanDefault);
1099
- await this.fanDefault?.subscribeAttribute(FanControl.Cluster.id, 'fanMode', (newValue, oldValue, context) => void (async () => {
1100
- this.fanDefault?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.offline === true ? 'offline' : 'online'}`);
1101
- if (context.offline === true)
1099
+ await this.fanDefault?.subscribeAttribute(FanControl, 'fanMode', (newValue, oldValue, context) => void (async () => {
1100
+ this.fanDefault?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1101
+ if (context.fabric === undefined)
1102
1102
  return;
1103
1103
  if (newValue === FanControl.FanMode.Off) {
1104
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', 0, this.fanDefault?.log);
1105
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 0, this.fanDefault?.log);
1104
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', 0, this.fanDefault?.log);
1105
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 0, this.fanDefault?.log);
1106
1106
  }
1107
1107
  else if (newValue === FanControl.FanMode.Low) {
1108
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', 33, this.fanDefault?.log);
1109
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 33, this.fanDefault?.log);
1108
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', 33, this.fanDefault?.log);
1109
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 33, this.fanDefault?.log);
1110
1110
  }
1111
1111
  else if (newValue === FanControl.FanMode.Medium) {
1112
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', 66, this.fanDefault?.log);
1113
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 66, this.fanDefault?.log);
1112
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', 66, this.fanDefault?.log);
1113
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 66, this.fanDefault?.log);
1114
1114
  }
1115
1115
  else if (newValue === FanControl.FanMode.High) {
1116
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanDefault?.log);
1117
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanDefault?.log);
1116
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', 100, this.fanDefault?.log);
1117
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 100, this.fanDefault?.log);
1118
1118
  }
1119
1119
  else if (newValue === FanControl.FanMode.On) {
1120
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'fanMode', FanControl.FanMode.High, this.fanDefault?.log);
1121
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanDefault?.log);
1122
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanDefault?.log);
1120
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanDefault?.log);
1121
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', 100, this.fanDefault?.log);
1122
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 100, this.fanDefault?.log);
1123
1123
  }
1124
1124
  else if (newValue === FanControl.FanMode.Auto) {
1125
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentSetting', null, this.fanDefault?.log);
1126
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 50, this.fanDefault?.log);
1125
+ await this.fanDefault?.setAttribute(FanControl, 'percentSetting', null, this.fanDefault?.log);
1126
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', 50, this.fanDefault?.log);
1127
1127
  }
1128
1128
  })(), this.fanDefault.log);
1129
- await this.fanDefault?.subscribeAttribute(FanControl.Cluster.id, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1130
- this.fanDefault?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.offline === true ? 'offline' : 'online'}`);
1131
- if (context.offline === true)
1129
+ await this.fanDefault?.subscribeAttribute(FanControl, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1130
+ this.fanDefault?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1131
+ if (context.fabric === undefined)
1132
1132
  return;
1133
1133
  if (isValidNumber(newValue, 0, 100))
1134
- await this.fanDefault?.setAttribute(FanControl.Cluster.id, 'percentCurrent', newValue, this.fanDefault?.log);
1134
+ await this.fanDefault?.setAttribute(FanControl, 'percentCurrent', newValue, this.fanDefault?.log);
1135
+ if (isValidNumber(newValue, 0, 0))
1136
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Off, this.fanDefault?.log);
1137
+ if (isValidNumber(newValue, 1, 33))
1138
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Low, this.fanDefault?.log);
1139
+ if (isValidNumber(newValue, 34, 66))
1140
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Medium, this.fanDefault?.log);
1141
+ if (isValidNumber(newValue, 67, 100))
1142
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanDefault?.log);
1143
+ if (newValue === null)
1144
+ await this.fanDefault?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Auto, this.fanDefault?.log);
1135
1145
  })(), this.fanDefault.log);
1136
1146
  this.fanBase = new MatterbridgeEndpoint([fanDevice, bridgedNode, powerSource], { id: 'Fan off low medium high' }, this.config.debug)
1137
1147
  .createDefaultBridgedDeviceBasicInformationClusterServer('Fan base', 'FBA00031', 0xfff1, 'Matterbridge', 'Matterbridge Fan')
@@ -1139,42 +1149,50 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1139
1149
  .createBaseFanControlClusterServer()
1140
1150
  .addRequiredClusterServers();
1141
1151
  this.fanBase = await this.addDevice(this.fanBase);
1142
- await this.fanBase?.subscribeAttribute(FanControl.Cluster.id, 'fanMode', (newValue, oldValue, context) => void (async () => {
1143
- this.fanBase?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.offline === true ? 'offline' : 'online'}`);
1144
- if (context.offline === true)
1152
+ await this.fanBase?.subscribeAttribute(FanControl, 'fanMode', (newValue, oldValue, context) => void (async () => {
1153
+ this.fanBase?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1154
+ if (context.fabric === undefined)
1145
1155
  return;
1146
1156
  if (newValue === FanControl.FanMode.Off) {
1147
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 0, this.fanBase?.log);
1148
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 0, this.fanBase?.log);
1157
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', 0, this.fanBase?.log);
1158
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 0, this.fanBase?.log);
1149
1159
  }
1150
1160
  else if (newValue === FanControl.FanMode.Low) {
1151
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 33, this.fanBase?.log);
1152
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 33, this.fanBase?.log);
1161
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', 33, this.fanBase?.log);
1162
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 33, this.fanBase?.log);
1153
1163
  }
1154
1164
  else if (newValue === FanControl.FanMode.Medium) {
1155
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 66, this.fanBase?.log);
1156
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 66, this.fanBase?.log);
1165
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', 66, this.fanBase?.log);
1166
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 66, this.fanBase?.log);
1157
1167
  }
1158
1168
  else if (newValue === FanControl.FanMode.High) {
1159
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanBase?.log);
1160
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanBase?.log);
1169
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', 100, this.fanBase?.log);
1170
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 100, this.fanBase?.log);
1161
1171
  }
1162
1172
  else if (newValue === FanControl.FanMode.On) {
1163
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'fanMode', FanControl.FanMode.High, this.fanBase?.log);
1164
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanBase?.log);
1165
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanBase?.log);
1173
+ await this.fanBase?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanBase?.log);
1174
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', 100, this.fanBase?.log);
1175
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 100, this.fanBase?.log);
1166
1176
  }
1167
1177
  else if (newValue === FanControl.FanMode.Auto) {
1168
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', null, this.fanBase?.log);
1169
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 50, this.fanBase?.log);
1178
+ await this.fanBase?.setAttribute(FanControl, 'percentSetting', null, this.fanBase?.log);
1179
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', 50, this.fanBase?.log);
1170
1180
  }
1171
1181
  })(), this.fanBase.log);
1172
- await this.fanBase?.subscribeAttribute(FanControl.Cluster.id, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1173
- this.fanBase?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.offline === true ? 'offline' : 'online'}`);
1174
- if (context.offline === true)
1182
+ await this.fanBase?.subscribeAttribute(FanControl, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1183
+ this.fanBase?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1184
+ if (context.fabric === undefined)
1175
1185
  return;
1176
1186
  if (isValidNumber(newValue, 0, 100))
1177
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', newValue, this.fanBase?.log);
1187
+ await this.fanBase?.setAttribute(FanControl, 'percentCurrent', newValue, this.fanBase?.log);
1188
+ if (isValidNumber(newValue, 0, 0))
1189
+ await this.fanBase?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Off, this.fanBase?.log);
1190
+ if (isValidNumber(newValue, 1, 33))
1191
+ await this.fanBase?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Low, this.fanBase?.log);
1192
+ if (isValidNumber(newValue, 34, 66))
1193
+ await this.fanBase?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Medium, this.fanBase?.log);
1194
+ if (isValidNumber(newValue, 67, 100))
1195
+ await this.fanBase?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanBase?.log);
1178
1196
  })(), this.fanBase.log);
1179
1197
  this.fanOnHigh = new MatterbridgeEndpoint([fanDevice, bridgedNode, powerSource], { id: 'Fan off high' }, this.config.debug)
1180
1198
  .createDefaultBridgedDeviceBasicInformationClusterServer('Fan off high', 'FOH00032', 0xfff1, 'Matterbridge', 'Matterbridge Fan')
@@ -1182,33 +1200,34 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1182
1200
  .createOnOffFanControlClusterServer()
1183
1201
  .addRequiredClusterServers();
1184
1202
  this.fanOnHigh = await this.addDevice(this.fanOnHigh);
1185
- await this.fanOnHigh?.subscribeAttribute(FanControl.Cluster.id, 'fanMode', (newValue, oldValue, context) => void (async () => {
1186
- this.fanOnHigh?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.offline === true ? 'offline' : 'online'}`);
1187
- if (context.offline === true)
1203
+ await this.fanOnHigh?.subscribeAttribute(FanControl, 'fanMode', (newValue, oldValue, context) => void (async () => {
1204
+ this.fanOnHigh?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1205
+ if (context.fabric === undefined)
1188
1206
  return;
1189
1207
  if (newValue === FanControl.FanMode.Off) {
1190
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentSetting', 0, this.fanOnHigh?.log);
1191
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 0, this.fanOnHigh?.log);
1208
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentSetting', 0, this.fanOnHigh?.log);
1209
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentCurrent', 0, this.fanOnHigh?.log);
1192
1210
  }
1193
1211
  else if (newValue === FanControl.FanMode.High) {
1194
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanOnHigh?.log);
1195
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanOnHigh?.log);
1212
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentSetting', 100, this.fanOnHigh?.log);
1213
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentCurrent', 100, this.fanOnHigh?.log);
1196
1214
  }
1197
1215
  else if (newValue === FanControl.FanMode.On) {
1198
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'fanMode', FanControl.FanMode.High, this.fanBase?.log);
1199
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanBase?.log);
1200
- await this.fanBase?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanBase?.log);
1216
+ await this.fanOnHigh?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanOnHigh?.log);
1217
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentSetting', 100, this.fanOnHigh?.log);
1218
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentCurrent', 100, this.fanOnHigh?.log);
1201
1219
  }
1202
1220
  })(), this.fanOnHigh.log);
1203
- await this.fanOnHigh?.subscribeAttribute(FanControl.Cluster.id, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1204
- this.fanOnHigh?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.offline === true ? 'offline' : 'online'}`);
1205
- if (context.offline === true)
1221
+ await this.fanOnHigh?.subscribeAttribute(FanControl, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1222
+ this.fanOnHigh?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1223
+ if (context.fabric === undefined)
1206
1224
  return;
1207
1225
  if (isValidNumber(newValue, 0, 100)) {
1208
1226
  if (newValue > 0)
1209
1227
  newValue = 100;
1210
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentCurrent', newValue, this.fanOnHigh?.log);
1211
- await this.fanOnHigh?.setAttribute(FanControl.Cluster.id, 'percentSetting', newValue, this.fanOnHigh?.log);
1228
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentCurrent', newValue, this.fanOnHigh?.log);
1229
+ await this.fanOnHigh?.setAttribute(FanControl, 'percentSetting', newValue, this.fanOnHigh?.log);
1230
+ await this.fanOnHigh?.setAttribute(FanControl, 'fanMode', newValue === 0 ? FanControl.FanMode.Off : FanControl.FanMode.High, this.fanOnHigh?.log);
1212
1231
  }
1213
1232
  })(), this.fanOnHigh.log);
1214
1233
  this.fanComplete = new MatterbridgeEndpoint([fanDevice, bridgedNode, powerSource], { id: 'Fan complete' }, this.config.debug)
@@ -1217,51 +1236,61 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1217
1236
  .createCompleteFanControlClusterServer()
1218
1237
  .addRequiredClusterServers();
1219
1238
  this.fanComplete = await this.addDevice(this.fanComplete);
1220
- await this.fanComplete?.subscribeAttribute(FanControl.Cluster.id, 'fanMode', (newValue, oldValue, context) => void (async () => {
1221
- this.fanComplete?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.offline === true ? 'offline' : 'online'}`);
1222
- if (context.offline === true)
1239
+ await this.fanComplete?.subscribeAttribute(FanControl, 'fanMode', (newValue, oldValue, context) => void (async () => {
1240
+ this.fanComplete?.log.info(`Fan mode changed from ${this.fanModeLookup[oldValue]} to ${this.fanModeLookup[newValue]} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1241
+ if (context.fabric === undefined)
1223
1242
  return;
1224
1243
  if (newValue === FanControl.FanMode.Off) {
1225
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 0, this.fanComplete?.log);
1226
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 0, this.fanComplete?.log);
1244
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', 0, this.fanComplete?.log);
1245
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 0, this.fanComplete?.log);
1227
1246
  }
1228
1247
  else if (newValue === FanControl.FanMode.Low) {
1229
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 33, this.fanComplete?.log);
1230
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 33, this.fanComplete?.log);
1248
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', 33, this.fanComplete?.log);
1249
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 33, this.fanComplete?.log);
1231
1250
  }
1232
1251
  else if (newValue === FanControl.FanMode.Medium) {
1233
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 66, this.fanComplete?.log);
1234
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 66, this.fanComplete?.log);
1252
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', 66, this.fanComplete?.log);
1253
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 66, this.fanComplete?.log);
1235
1254
  }
1236
1255
  else if (newValue === FanControl.FanMode.High) {
1237
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanComplete?.log);
1238
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanComplete?.log);
1256
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', 100, this.fanComplete?.log);
1257
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 100, this.fanComplete?.log);
1239
1258
  }
1240
1259
  else if (newValue === FanControl.FanMode.On) {
1241
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'fanMode', FanControl.FanMode.High, this.fanComplete?.log);
1242
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', 100, this.fanComplete?.log);
1243
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 100, this.fanComplete?.log);
1260
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanComplete?.log);
1261
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', 100, this.fanComplete?.log);
1262
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 100, this.fanComplete?.log);
1244
1263
  }
1245
1264
  else if (newValue === FanControl.FanMode.Auto) {
1246
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentSetting', null, this.fanComplete?.log);
1247
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', 50, this.fanComplete?.log);
1265
+ await this.fanComplete?.setAttribute(FanControl, 'percentSetting', null, this.fanComplete?.log);
1266
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', 50, this.fanComplete?.log);
1248
1267
  }
1249
1268
  })(), this.fanComplete?.log);
1250
- await this.fanComplete?.subscribeAttribute(FanControl.Cluster.id, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1251
- this.fanComplete?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.offline === true ? 'offline' : 'online'}`);
1252
- if (context.offline === true)
1269
+ await this.fanComplete?.subscribeAttribute(FanControl, 'percentSetting', (newValue, oldValue, context) => void (async () => {
1270
+ this.fanComplete?.log.info(`Percent setting changed from ${oldValue} to ${newValue} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1271
+ if (context.fabric === undefined)
1253
1272
  return;
1254
1273
  if (isValidNumber(newValue, 0, 100))
1255
- await this.fanComplete?.setAttribute(FanControl.Cluster.id, 'percentCurrent', newValue, this.fanComplete?.log);
1274
+ await this.fanComplete?.setAttribute(FanControl, 'percentCurrent', newValue, this.fanComplete?.log);
1275
+ if (isValidNumber(newValue, 0, 0))
1276
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Off, this.fanComplete?.log);
1277
+ if (isValidNumber(newValue, 1, 33))
1278
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Low, this.fanComplete?.log);
1279
+ if (isValidNumber(newValue, 34, 66))
1280
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Medium, this.fanComplete?.log);
1281
+ if (isValidNumber(newValue, 67, 100))
1282
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.High, this.fanComplete?.log);
1283
+ if (newValue === null)
1284
+ await this.fanComplete?.setAttribute(FanControl, 'fanMode', FanControl.FanMode.Auto, this.fanComplete?.log);
1256
1285
  })(), this.fanComplete?.log);
1257
- await this.fanComplete?.subscribeAttribute(FanControl.Cluster.id, 'rockSetting', (newValue, oldValue, context) => {
1258
- this.fanComplete?.log.info(`Rock setting changed from ${debugStringify(oldValue)} to ${debugStringify(newValue)} context: ${context.offline === true ? 'offline' : 'online'}`);
1286
+ await this.fanComplete?.subscribeAttribute(FanControl, 'rockSetting', (newValue, oldValue, context) => {
1287
+ this.fanComplete?.log.info(`Rock setting changed from ${debugStringify(oldValue)} to ${debugStringify(newValue)} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1259
1288
  }, this.fanComplete?.log);
1260
- await this.fanComplete?.subscribeAttribute(FanControl.Cluster.id, 'windSetting', (newValue, oldValue, context) => {
1261
- this.fanComplete?.log.info(`Wind setting changed from ${debugStringify(oldValue)} to ${debugStringify(newValue)} context: ${context.offline === true ? 'offline' : 'online'}`);
1289
+ await this.fanComplete?.subscribeAttribute(FanControl, 'windSetting', (newValue, oldValue, context) => {
1290
+ this.fanComplete?.log.info(`Wind setting changed from ${debugStringify(oldValue)} to ${debugStringify(newValue)} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1262
1291
  }, this.fanComplete?.log);
1263
- await this.fanComplete?.subscribeAttribute(FanControl.Cluster.id, 'airflowDirection', (newValue, oldValue, context) => {
1264
- this.fanComplete?.log.info(`Airflow direction changed from ${this.fanDirectionLookup[oldValue]} to ${this.fanDirectionLookup[newValue]} context: ${context.offline === true ? 'offline' : 'online'}`);
1292
+ await this.fanComplete?.subscribeAttribute(FanControl, 'airflowDirection', (newValue, oldValue, context) => {
1293
+ this.fanComplete?.log.info(`Airflow direction changed from ${this.fanDirectionLookup[oldValue]} to ${this.fanDirectionLookup[newValue]} context: ${context.fabric === undefined ? 'offline' : 'online'}`);
1265
1294
  }, this.fanComplete?.log);
1266
1295
  this.waterLeak = new MatterbridgeEndpoint([waterLeakDetector, bridgedNode, powerSource], { id: 'Water leak detector' }, this.config.debug)
1267
1296
  .createDefaultBridgedDeviceBasicInformationClusterServer('Water leak detector', 'WLD00034', 0xfff1, 'Matterbridge', 'Matterbridge WaterLeakDetector')
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.18",
3
+ "version": "2.0.19-dev-20260606-273db3d",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-example-dynamic-platform",
9
- "version": "2.0.18",
9
+ "version": "2.0.19-dev-20260606-273db3d",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "node-ansi-logger": "3.2.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.18",
3
+ "version": "2.0.19-dev-20260606-273db3d",
4
4
  "description": "Matterbridge dynamic plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",