From 3a7ecd341f53f21b318bbcddd221465ac0d91e36 Mon Sep 17 00:00:00 2001 From: guotianx Date: Fri, 23 Jun 2023 17:41:35 +0800 Subject: [PATCH 1/2] Add Honyar U86Z13A16-ZJH(HA) --- src/devices/honyar.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/devices/honyar.ts b/src/devices/honyar.ts index 51573d80bf704..2268f0092eb64 100644 --- a/src/devices/honyar.ts +++ b/src/devices/honyar.ts @@ -2,6 +2,8 @@ import {Definition} from '../lib/types'; import * as exposes from '../lib/exposes'; import * as reporting from '../lib/reporting'; import extend from '../lib/extend'; +import fz from '../converters/fromZigbee'; +import tz from '../converters/toZigbee'; const e = exposes.presets; const definitions: Definition[] = [ @@ -27,6 +29,26 @@ const definitions: Definition[] = [ await reporting.onOff(endpoint3); }, }, + { + zigbeeModel: ['HY0043'], + model: 'U86Z13A16-ZJH(HA)', + vendor: 'Honyar', + description: 'Smart Power Socket 16A (with power monitoring)', + fromZigbee: [fz.on_off, 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) => { + const endpoint = device.getEndpoint(2); + 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); + }, + }, ]; module.exports = definitions; From 67becd9423fe65a68286a4cb635efb9735aa95d3 Mon Sep 17 00:00:00 2001 From: guotianx Date: Fri, 23 Jun 2023 19:43:08 +0800 Subject: [PATCH 2/2] Fix endpoint --- src/devices/honyar.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/honyar.ts b/src/devices/honyar.ts index 2268f0092eb64..582e3d36812a6 100644 --- a/src/devices/honyar.ts +++ b/src/devices/honyar.ts @@ -38,7 +38,7 @@ const definitions: Definition[] = [ toZigbee: [tz.on_off], exposes: [e.switch(), e.power(), e.current(), e.voltage(), e.energy()], configure: async (device, coordinatorEndpoint, logger) => { - const endpoint = device.getEndpoint(2); + const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']); await reporting.onOff(endpoint); await reporting.readEletricalMeasurementMultiplierDivisors(endpoint);