Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve TS0601_din_1 and add Sunricher SR-ZG9101SAC-HP-SWITCH-B fingerprint #6623

Merged
merged 7 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/devices/sunricher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,34 @@ const definitions: Definition[] = [
await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
},
},
{
fingerprint: [{modelID: 'ON/OFF(2CH)', softwareBuildID: '2.9.2_r54'}],
model: 'SR-ZG9101SAC-HP-SWITCH-2CH',
vendor: 'Sunricher',
description: 'Zigbee 2 channel switch',
fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.power_on_behavior, fz.ignore_genOta],
toZigbee: [tz.on_off, tz.power_on_behavior],
exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.power(), e.current(),
e.voltage(), e.energy(), e.power_on_behavior(['off', 'on', 'previous'])],
endpoint: (device) => {
return {'l1': 1, 'l2': 2};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint1 = device.getEndpoint(1);
const endpoint2 = device.getEndpoint(2);
await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
await reporting.onOff(endpoint1);
await reporting.onOff(endpoint2);
await reporting.readEletricalMeasurementMultiplierDivisors(endpoint1);
await reporting.activePower(endpoint1);
await reporting.rmsCurrent(endpoint1, {min: 10, change: 10});
await reporting.rmsVoltage(endpoint1, {min: 10});
await reporting.readMeteringMultiplierDivisor(endpoint1);
await reporting.currentSummDelivered(endpoint1);
},
},
{
zigbeeModel: ['HK-ZD-CCT-A'],
model: 'HK-ZD-CCT-A',
Expand Down
12 changes: 7 additions & 5 deletions src/devices/tuya.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3551,21 +3551,23 @@ const definitions: Definition[] = [
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
exposes: [tuya.exposes.switch(), e.ac_frequency(), e.energy(), e.power(), e.power_factor(), e.voltage(), e.current(),
e.produced_energy()],
e.produced_energy(), e.power_reactive(),
e.numeric('energy_reactive', ea.STATE).withUnit('kVArh').withDescription('Sum of reactive energy'),
e.numeric('total_energy', ea.STATE).withUnit('kWh').withDescription('Total consumed and produced energy')],
meta: {
tuyaDatapoints: [
[1, 'energy', tuya.valueConverter.divideBy100],
[6, null, tuya.valueConverter.phaseVariant1], // voltage and current
[16, 'state', tuya.valueConverter.onOff],
[101, 'total_energy', tuya.valueConverter.divideBy100], // total energy produced + consumed
[102, 'produced_energy', tuya.valueConverter.divideBy100],
[103, 'power', tuya.valueConverter.raw],
[105, 'ac_frequency', tuya.valueConverter.divideBy100],
[109, 'energy_reactive', tuya.valueConverter.divideBy100], // reactive energy in VArh
[110, 'power_reactive', tuya.valueConverter.raw], // reactive power
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the exposes accordingly.

[111, 'power_factor', tuya.valueConverter.divideBy10],
// Ignored for now; we don't know what the values mean
[109, null, null], // reactive_power in VArh, ignored for now
[101, null, null], // total active power (translated from chinese) - same as energy dp 1??
[9, null, null], // Fault - we don't know the possible values here
[110, null, null], // total reactive power (translated from chinese) - value is 0.03kvar, we already have kvarh on dp 109
[17, null, null], // Alarm set1 - value seems garbage "AAAAAAAAAAAAAABkAAEOAACqAAAAAAAKAAAAAAAA"
[18, null, null], // 18 - Alarm set2 - value seems garbage "AAUAZAAFAB4APAAAAAAAAAA="
],
Expand Down Expand Up @@ -5730,7 +5732,7 @@ const definitions: Definition[] = [
{
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_bcusnqt8'}],
model: 'SPM01-D2TZ',
vendor: 'Yagusmart',
vendor: 'Zemismart',
description: 'Smart energy monitor for 1P+N system',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
Expand Down