Skip to content

Conversation

kirovilya
Copy link
Contributor

No description provided.

},
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

endpointNames?: string[];
ota?: ModernExtend["ota"];
levelConfig?: {disabledFeatures?: LevelConfigFeatures};
levelConfigureReporting?: ReportingConfigWithoutAttribute;
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
levelConfigureReporting?: ReportingConfigWithoutAttribute;
levelReportingConfig?: ReportingConfigWithoutAttribute;

await setupAttributes(device, coordinatorEndpoint, "genOnOff", [{attribute: "onOff", min: "MIN", max: "MAX", change: 1}]);
await setupAttributes(device, coordinatorEndpoint, "genLevelCtrl", [
{attribute: "currentLevel", min: "10_SECONDS", max: "MAX", change: 1},
{attribute: "currentLevel", min: "10_SECONDS", max: "MAX", change: 1, ...args.levelConfigureReporting},
Copy link
Owner

@Koenkk Koenkk Mar 20, 2025

Choose a reason for hiding this comment

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

...args.levelConfigureReporting fails if args.levelConfigureReporting if null

Suggested change
{attribute: "currentLevel", min: "10_SECONDS", max: "MAX", change: 1, ...args.levelConfigureReporting},
{attribute: "currentLevel", min: "10_SECONDS", max: "MAX", change: 1, ...(args.levelConfigureReporting ?? {})},

@Koenkk Koenkk merged commit 0c7f856 into Koenkk:master Mar 21, 2025
3 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Mar 21, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants