Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
49 changes: 49 additions & 0 deletions src/devices/yandex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function YandexCluster(): ModernExtend {
powerType: {ID: 0x0003, type: Zcl.DataType.ENUM8},
ledIndicator: {ID: 0x0005, type: Zcl.DataType.BOOLEAN},
interlock: {ID: 0x0007, type: Zcl.DataType.BOOLEAN},
buttonMode: {ID: 0x0008, type: Zcl.DataType.ENUM8},
},
commands: {
switchMode: {
Expand All @@ -113,6 +114,10 @@ function YandexCluster(): ModernExtend {
ID: 0x07,
parameters: [{name: "value", type: Zcl.DataType.UINT8}],
},
buttonMode: {
ID: 0x08,
parameters: [{name: "value", type: Zcl.DataType.UINT8}],
},
},
commandsResponse: {},
});
Expand Down Expand Up @@ -431,4 +436,48 @@ export const definitions: DefinitionWithExtend[] = [
}),
],
},
{
zigbeeModel: ["YNDX-00530"],
model: "YNDX_00530",
vendor: "Yandex",
description: "Dimmer",
extend: [
YandexCluster(),
m.light({
effect: true,
powerOnBehavior: true,
configureReporting: true,
}),
m.lightingBallast(),
binaryWithSetCommand({
name: "led_indicator",
cluster: "manuSpecificYandex",
attribute: "ledIndicator",
valueOn: ["ON", 1],
valueOff: ["OFF", 0],
setCommand: "ledIndicator",
zigbeeCommandOptions: {manufacturerCode},
description: "Led indicator",
entityCategory: "config",
}),
enumLookupWithSetCommand({
name: "button_mode",
cluster: "manuSpecificYandex",
attribute: "buttonMode",
setCommand: "buttonMode",
zigbeeCommandOptions: {manufacturerCode},
description: "Dimmer button mode",
lookup: {
general: 0x00,
alternative: 0x01,
},
entityCategory: "config",
}),
m.reportAttribute({
Copy link
Owner

Choose a reason for hiding this comment

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

Is this not already done with:

m.light({
                effect: true,
                powerOnBehavior: true,
                configureReporting: true,
            }),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. The default minimum period in the report is 10 seconds, and here I change it to the minimum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I add reporting parameters for each attribute to m.light, the code will grow. Therefore, I decided to make a universal reporting that can be used in various cases.

Copy link
Owner

Choose a reason for hiding this comment

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

I think it is nicer to put it in m.light, in this was you don't need to look in multiple places for the config (and also the execution order is not guaranteed)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

cluster: "genLevelCtrl",
attribute: "currentLevel",
config: {min: "MIN", max: "MAX", change: 1},
}),
],
},
];
13 changes: 13 additions & 0 deletions src/lib/modernExtend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,4 +2692,17 @@ export function bindCluster(args: {cluster: string | number; clusterType: "input
return {configure, isModernExtend: true};
}

export function reportAttribute(args: {
cluster: string | number;
attribute: ReportingConfigAttribute;
config: ReportingConfigWithoutAttribute;
access?: Access;
endpointNames?: string[];
}): ModernExtend {
const configure: Configure[] = [
setupConfigureForReporting(args.cluster, args.attribute, args.config, args.access || ea.STATE_GET, args.endpointNames),
];
return {configure, isModernExtend: true};
}

// #endregion