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

Add two private attributes for SR-ZG9040A/ZG9041A-D. #8210

Merged
merged 3 commits into from
Oct 29, 2024

Conversation

maginawin
Copy link
Contributor

  1. External Switch Type
  2. Minimum PWM

1. External Switch Type
2. Minimum PWM
];

const onEvent: OnEvent = async (type, data, device) => {
await readAttributeIfOnline(type, data, device, attribute);
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 these only need to be read one time after the device has joined? If yes, put them in a configure.


const toZigbee: Tz.Converter[] = [
{
key: ['minimumPWM'],
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
key: ['minimumPWM'],
key: ['minimum_pwm'],


const exposes: Expose[] = [
e
.numeric('minimumPWM', ea.ALL)
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
.numeric('minimumPWM', ea.ALL)
.numeric('minimum_pwm', ea.ALL)

const attribute = 0x8803;
const dataType = 0x20;
const valueMap: {[key: number]: string} = {
0: 'Push button',
Copy link
Owner

Choose a reason for hiding this comment

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

Please make all snake_case, also valueLookup below

} satisfies Tz.Converter,
];

const exposes: Expose[] = [e.enum('externalSwitchType', ea.ALL, ['Push button', 'Normal on/off', 'Three way']).withLabel('External Switch Type')];
Copy link
Owner

@Koenkk Koenkk Oct 28, 2024

Choose a reason for hiding this comment

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

Suggested change
const exposes: Expose[] = [e.enum('externalSwitchType', ea.ALL, ['Push button', 'Normal on/off', 'Three way']).withLabel('External Switch Type')];
const exposes: Expose[] = [e.enum('external_switch_type', ea.ALL, ['push_button', 'normal_on_off', 'three_way']).withLabel('External switch type')];

@maginawin
Copy link
Contributor Author

Hi @Koenkk , thank you for your detailed suggestions, I've modified them.

@Koenkk Koenkk merged commit 7310253 into Koenkk:master Oct 29, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Oct 29, 2024

Thanks!

@Gnarfoz
Copy link

Gnarfoz commented Nov 10, 2024

@maginawin Hi, this change seems aimed at SR-ZG9040A/ZG9041A-D but it also affects https://www.zigbee2mqtt.io/devices/ZG9101SAC-HP-Switch.html.
The external switch attribute shows up, but I don't think that's configurable on these devices?
The PWM thing doesn't show up. The switch is not a dimmer, anyway.

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.

3 participants