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

Update candeo.ts #8147

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
54 changes: 54 additions & 0 deletions src/devices/candeo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import {electricityMeter, identify, light, onOff} from '../lib/modernExtend';
import {DefinitionWithExtend} from '../lib/types';
import fz from '../converters/fromZigbee';
import tz from '../converters/toZigbee';
import * as exposes from '../lib/exposes';
import * as reporting from '../lib/reporting';

const e = exposes.presets;

const definitions: DefinitionWithExtend[] = [
{
Expand Down Expand Up @@ -150,6 +156,54 @@ const definitions: DefinitionWithExtend[] = [
identify(),
],
},
{
fingerprint: [{modelID: 'C-ZB-SM205-2G', manufacturerName: 'Candeo'}],
model: 'C-ZB-SM205-2G',
vendor: 'Candeo',
description: 'Smart 2 gang switch module',
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']).withEndpoint('l1'),
e.power_on_behavior(['off', 'on', 'previous']).withEndpoint('l2')
],
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']);
await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']);
await reporting.onOff(endpoint1);
await reporting.onOff(endpoint2);
await endpoint1.read('genOnOff', [0x0000]);
Copy link
Owner

Choose a reason for hiding this comment

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

Why are these reads needed?

await endpoint2.read('genOnOff', [0x0000]);
await endpoint1.write('genOnOff', {0x4003: {value: 0xFF, type: 0x30}});
await endpoint1.read('genOnOff', [0x4003]);
await endpoint2.write('genOnOff', {0x4003: {value: 0xFF, type: 0x30}});
await endpoint2.read('genOnOff', [0x4003]);
const endpoint11 = device.getEndpoint(11);
await reporting.bind(endpoint11, coordinatorEndpoint, ['haElectricalMeasurement', 'seMetering']);
await reporting.readEletricalMeasurementMultiplierDivisors(endpoint11);
await reporting.activePower(endpoint11, {min: 10, change: 50, max: 600});
await reporting.rmsCurrent(endpoint11, {min: 10, change: 100, max: 600});
await reporting.rmsVoltage(endpoint11, {min: 10, change: 10, max: 600});
await reporting.readMeteringMultiplierDivisor(endpoint11);
await reporting.currentSummDelivered(endpoint11, {min: 10, change: 360000, max: 600});
await endpoint11.read('haElectricalMeasurement', ['activePower']);
await endpoint11.read('haElectricalMeasurement', ['rmsCurrent']);
await endpoint11.read('haElectricalMeasurement', ['rmsVoltage']);
await endpoint11.read('seMetering', ['currentSummDelivered']);
},
}
];

export default definitions;
Expand Down
Loading