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

feat: support Sunricher SR-ZG9030A-MW #8509

Merged
merged 10 commits into from
Dec 24, 2024
Merged

Conversation

niracler
Copy link
Contributor

@niracler niracler commented Dec 23, 2024

Notably

While developing support for Sunricher devices, I discovered a ModelId conflict between two devices in their product line. To resolve this, I implemented an expose that allows users to switch the ModelId. This implementation required skipping the set/get access check in the test cases.

I'm not entirely confident if bypassing the test case through this approach is the best solution. I would appreciate your feedback and suggestions for potential improvements.

Reference code showing the ModelId conflict handling:

const sunricherTz = {
    setModel: {
        key: ['model'],
        convertSet: async (entity, key, value, meta) => {
            await entity.write('genBasic', {modelId: value});
            return {state: {model: value}};
        },
    } satisfies Tz.Converter,
};

And the test case bypass:

if (device.toZigbee.includes(sunricher.tz.setModel)) return;

src/devices/sunricher.ts Outdated Show resolved Hide resolved
],
meta: {multiEndpoint: true},
toZigbee: [sunricher.tz.setModel],
exposes: [e.enum('model', ea.SET, ['HK-DIM', 'ZG9030A-MW']).withDescription('Model of the device')],
Copy link
Owner

Choose a reason for hiding this comment

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

Where is this used for? (what does changing the modelId do)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some ZG9030A-MW devices were mistakenly set with the modelId HK-DIM during manufacturing. Therefore, we need to provide a method that allows users to update the modelId of these HK-DIM devices to ZG9030A-MW.

@Koenkk Koenkk merged commit 0a714e0 into Koenkk:master Dec 24, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Dec 24, 2024

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