How and where do I need to put this code? I have 2 Aquara T1 switches with nog power usage.
I found something for an external converter.
But I have no Idea where to put this code and how to do it…
const {} = require('zigbee-herdsman-converters/lib/modernExtend');
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const ota = require('zigbee-herdsman-converters/lib/ota');
const utils = require('zigbee-herdsman-converters/lib/utils');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const lumi = require('zigbee-herdsman-converters/lib/lumi');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['lumi.switch.n0agl1'],
model: 'SSM-U01',
vendor: 'Aqara',
description: 'Single switch module T1 (with neutral)',
extend: [],
fromZigbee: [fz.on_off, fz.metering, fz.electrical_measurement, fz.device_temperature, lumi.fromZigbee.lumi_specific],
exposes: [e.switch(), e.energy(), e.power(), e.device_temperature(), e.power_outage_memory(), e.power_outage_count(), e.switch_type(), e.voltage(), e.current()],
toZigbee: [lumi.toZigbee.lumi_switch_type, tz.on_off, lumi.toZigbee.lumi_switch_power_outage_memory, lumi.toZigbee.lumi_led_disabled_night],
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering', 'genDeviceTempCfg']);
await reporting.onOff(endpoint);
await endpoint.read('haElectricalMeasurement', ['acPowerMultiplier', 'acPowerDivisor']);
await reporting.readMeteringMultiplierDivisor(endpoint);
await reporting.currentSummDelivered(endpoint);
await reporting.activePower(endpoint, {min: 5, max: 600, change: 10});
await reporting.deviceTemperature(endpoint);
device.powerSource = 'Mains (single phase)';
device.type = 'Router';
device.save();
}
};`