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

Try to fix unrealistic pressure readings from WSDCGQ12LM. #7259

Merged

Conversation

rotdrop
Copy link
Contributor

@rotdrop rotdrop commented Mar 23, 2024

Similar to issue Koenkk/zigbee2mqtt#798 my instance of the WSDCGQ12LM sporadically returns unrealistic high pressure readings > 30000 hPa. This PR tries to fix this in the same manner as issue Koenkk/zigbee2mqtt#798 was fixed in commit 9bdebcd.

src/lib/lumi.ts Outdated
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
let pressure = 0;
if (msg.data.hasOwnProperty('scaledValue')) {
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 this part can to into the official fz.pressure

Then call it from here, example:

const result = await fz.humidity.convert(model, msg, publish, options, meta);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, true enough.

@rotdrop
Copy link
Contributor Author

rotdrop commented Mar 24, 2024

Oops. The last commit has a bug in it ...

@Koenkk Koenkk merged commit bca06e3 into Koenkk:master Mar 24, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Mar 24, 2024

Thanks!

@rotdrop
Copy link
Contributor Author

rotdrop commented Mar 24, 2024

Wait! The tab char was not the problem, the comparison is broken!

Koenkk added a commit that referenced this pull request Mar 24, 2024
@Koenkk
Copy link
Owner

Koenkk commented Mar 24, 2024

Whoops, reverted it, could you make a new pr?

@rotdrop
Copy link
Contributor Author

rotdrop commented Mar 24, 2024

Yes, of course.

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