I bought a cheap smart plug with energy monitoring (Amazon.com). After lots of searcing, it appears to be using a SoC in the bl702 series. Using Zigbee2Mqtt I have it added and configured. It supports on/off (reporting and commands), but I can’t figure out how to get power monitoring working. I’ve cobbled something together from a number of examples to try to make it work. It exposes the energy sensors, but it doesn’t report any data. Is there any other thing I can try?
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 extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
// https://github.com/Koenkk/zigbee-herdsman-converters/issues/1681
const definition = {
zigbeeModel: ['Bouffalolab'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
model: 'CL-001', // Vendor model number, look on the device for a model number
vendor: 'Bouffalolab', // Vendor of the device (only used for documentation and startup logging)
description: 'Smart plug', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
fromZigbee: [
fz.on_off,
fz.ignore_basic_report,
fz.power_on_behavior,
fz.electrical_measurement,
fz.metering
],
toZigbee: [tz.on_off],
exposes: [
e.switch(),
e.power(),
e.current(),
e.voltage(),
e.energy()
],
configure: async (device, coordinatorEndpoint, logger) => {
let endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, [
'genOnOff',
//'haElectricalMeasurement',
'seMetering'
]);
await reporting.onOff(endpoint);
//await reporting.readEletricalMeasurementMultiplierDivisors(endpoint);
await reporting.activePower(endpoint);
await reporting.rmsCurrent(endpoint);
await reporting.rmsVoltage(endpoint);
await reporting.readMeteringMultiplierDivisor(endpoint);
await reporting.currentSummDelivered(endpoint);
await reporting.instantaneousDemand(endpoint);
},
endpoint: (device) => {
return {default: 1};
},
};
module.exports = definition;
// MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x7cb94c6187a30000","ieee_address":"0x7cb94c6187a30000"},"type":"device_announce"}'
// Zigbee2MQTT:info 2022-05-26 20:43:51: Successfully interviewed '0x7cb94c6187a30000', device has successfully been paired
// Zigbee2MQTT:warn 2022-05-26 20:43:51: Device '0x7cb94c6187a30000' with Zigbee model 'Bouffalolab' and manufacturer name 'Bouffalolab'
// Zigbee2MQTT:info 2022-05-26 20:43:51: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":null,"friendly_name":"0x7cb94c6187a30000","ieee_address":"0x7cb94c6187a30000","status":"successful","supported":false},"type":"device_interview"}'