Skip to content

Commit

Permalink
fix: Fix unrealistic pressure readings from Lumi WSDCGQ12LM (#7259)
Browse files Browse the repository at this point in the history
* Try to fix unrealistic pressure readings from WSDCGQ12LM.

* Removed tabs introduced by previous commit

* Avoid duplicating code

* Update lumi.ts

---------

Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
  • Loading branch information
rotdrop and Koenkk authored Mar 24, 2024
1 parent 31d0880 commit bca06e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/devices/lumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ const definitions: Definition[] = [
vendor: 'Aqara',
description: 'Temperature and humidity sensor T1',
whiteLabel: [{vendor: 'Aqara', model: 'TH-S02D'}],
fromZigbee: [lumi.fromZigbee.lumi_specific, fz.temperature, fz.humidity, fz.pressure, fz.battery],
fromZigbee: [lumi.fromZigbee.lumi_specific, fz.temperature, fz.humidity, lumi.fromZigbee.lumi_pressure, fz.battery],
toZigbee: [],
exposes: [e.temperature(), e.humidity(), e.pressure(), e.device_temperature(), e.battery(), e.battery_voltage(),
e.power_outage_count(false)],
Expand Down
10 changes: 10 additions & 0 deletions src/lib/lumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,16 @@ export const fromZigbee = {
}
},
} satisfies Fz.Converter,
lumi_pressure: {
cluster: 'msPressureMeasurement',
type: ['attributeReport', 'readResponse'],
convert: async (model, msg, publish, options, meta) => {
const result = await fz.pressure.convert(model, msg, publish, options, meta);
if (result && result.pressure < 500 && result.pressure < 2000) {
return result;
}
},
} satisfies Fz.Converter,

// lumi class specific
lumi_feeder: {
Expand Down

0 comments on commit bca06e3

Please sign in to comment.