Skip to content

Commit 9c49105

Browse files
[autofix.ci] apply automated fixes
1 parent 0d46118 commit 9c49105

1 file changed

Lines changed: 30 additions & 28 deletions

File tree

src/devices/nodon.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ export const definitions: DefinitionWithExtend[] = [
299299
ota: true,
300300
},
301301
{
302-
zigbeeModel: ['SEM-4-1-00'],
303-
model: 'SEM-4-1-00',
304-
vendor: 'NodOn',
305-
description: 'Energy monitoring sensor',
302+
zigbeeModel: ["SEM-4-1-00"],
303+
model: "SEM-4-1-00",
304+
vendor: "NodOn",
305+
description: "Energy monitoring sensor",
306306
extend: [
307307
m.identify(),
308308
m.electricityMeter({
@@ -314,64 +314,66 @@ export const definitions: DefinitionWithExtend[] = [
314314
],
315315
toZigbee: [
316316
{
317-
key: ['energy_reset'],
317+
key: ["energy_reset"],
318318
convertSet: async (entity, _key, _value, _meta) => {
319319
// genBasic/resetFactDefault resets all cluster attributes to factory defaults.
320320
// Network membership, bindings and configureReporting are not affected (ZCL spec).
321-
await entity.command('genBasic', 'resetFactDefault', {});
321+
await entity.command("genBasic", "resetFactDefault", {});
322322
return {state: {}};
323323
},
324324
},
325325
],
326326
exposes: [
327-
e.enum('energy_reset', ea.SET, ['reset'])
328-
.withDescription('Reset all energy counters to 0')
329-
.withCategory('config'),
327+
e.enum("energy_reset", ea.SET, ["reset"]).withDescription("Reset all energy counters to 0").withCategory("config"),
330328
e.power_apparent(),
331329
],
332330
configure: async (device, coordinatorEndpoint, logger) => {
333331
const endpoint = device.getEndpoint(1);
334332

335333
// Explicit bind — not done by m.electricityMeter because configureReporting: false
336-
await endpoint.bind('haElectricalMeasurement', coordinatorEndpoint);
337-
await endpoint.bind('seMetering', coordinatorEndpoint);
334+
await endpoint.bind("haElectricalMeasurement", coordinatorEndpoint);
335+
await endpoint.bind("seMetering", coordinatorEndpoint);
338336

339-
await endpoint.read('haElectricalMeasurement', [
340-
'acVoltageMultiplier', 'acVoltageDivisor',
341-
'acCurrentMultiplier', 'acCurrentDivisor',
342-
'acPowerMultiplier', 'acPowerDivisor',
343-
'acFrequencyMultiplier', 'acFrequencyDivisor',
337+
await endpoint.read("haElectricalMeasurement", [
338+
"acVoltageMultiplier",
339+
"acVoltageDivisor",
340+
"acCurrentMultiplier",
341+
"acCurrentDivisor",
342+
"acPowerMultiplier",
343+
"acPowerDivisor",
344+
"acFrequencyMultiplier",
345+
"acFrequencyDivisor",
344346
]);
345-
await endpoint.read('seMetering', ['multiplier', 'divisor']);
347+
await endpoint.read("seMetering", ["multiplier", "divisor"]);
346348

347349
// Split into batches of ≤5 to stay within the ~85-byte ZCL frame limit
348350
try {
349-
await endpoint.configureReporting('haElectricalMeasurement', [
350-
{attribute: 'acFrequency', minimumReportInterval: 30, maximumReportInterval: 3600, reportableChange: 500}, // 5 Hz
351-
{attribute: 'rmsVoltage', minimumReportInterval: 30, maximumReportInterval: 3600, reportableChange: 2300}, // 23 V
352-
{attribute: 'rmsCurrent', minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 100}, // 1 A
353-
{attribute: 'activePower', minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 250}, // 250 W
354-
{attribute: 'apparentPower', minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 250}, // 250 VA
351+
await endpoint.configureReporting("haElectricalMeasurement", [
352+
{attribute: "acFrequency", minimumReportInterval: 30, maximumReportInterval: 3600, reportableChange: 500}, // 5 Hz
353+
{attribute: "rmsVoltage", minimumReportInterval: 30, maximumReportInterval: 3600, reportableChange: 2300}, // 23 V
354+
{attribute: "rmsCurrent", minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 100}, // 1 A
355+
{attribute: "activePower", minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 250}, // 250 W
356+
{attribute: "apparentPower", minimumReportInterval: 10, maximumReportInterval: 3600, reportableChange: 250}, // 250 VA
355357
]);
356358
} catch (error) {
357359
logger.debug(`SEM-4-1-00: haElectricalMeasurement batch 1 configureReporting failed: ${(error as Error).message}`);
358360
}
359361
try {
360-
await endpoint.configureReporting('haElectricalMeasurement', [
361-
{attribute: 'powerFactor', minimumReportInterval: 60, maximumReportInterval: 3600, reportableChange: 20}, // 0.20
362+
await endpoint.configureReporting("haElectricalMeasurement", [
363+
{attribute: "powerFactor", minimumReportInterval: 60, maximumReportInterval: 3600, reportableChange: 20}, // 0.20
362364
]);
363365
} catch (error) {
364366
logger.debug(`SEM-4-1-00: haElectricalMeasurement batch 2 configureReporting failed: ${(error as Error).message}`);
365367
}
366368

367369
const seAttrs = [
368-
{attribute: 'currentSummDelivered', minimumReportInterval: 300, maximumReportInterval: 3600, reportableChange: 100}, // 0.1 kWh
369-
{attribute: 'currentSummReceived', minimumReportInterval: 300, maximumReportInterval: 3600, reportableChange: 100}, // 0.1 kWh
370+
{attribute: "currentSummDelivered", minimumReportInterval: 300, maximumReportInterval: 3600, reportableChange: 100}, // 0.1 kWh
371+
{attribute: "currentSummReceived", minimumReportInterval: 300, maximumReportInterval: 3600, reportableChange: 100}, // 0.1 kWh
370372
];
371373

372374
for (const attr of seAttrs) {
373375
try {
374-
await endpoint.configureReporting('seMetering', [attr]);
376+
await endpoint.configureReporting("seMetering", [attr]);
375377
} catch (error) {
376378
logger.debug(`SEM-4-1-00: seMetering/${attr.attribute} configureReporting failed: ${(error as Error).message}`);
377379
}

0 commit comments

Comments
 (0)