Skip to content

Commit

Permalink
Filter non-realistic WSDCGQ11LM and WSDCGQ01LM temperature reports. K…
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Jan 8, 2019
1 parent 3042d82 commit 74e257f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,20 @@ const converters = {
return {temperature: precisionRoundOptions(temperature, options, 'temperature')};
},
},
xiaomi_temperature: {
cid: 'msTemperatureMeasurement',
type: 'attReport',
convert: (model, msg, publish, options) => {
const temperature = parseFloat(msg.data.data['measuredValue']) / 100.0;

// https://github.com/Koenkk/zigbee2mqtt/issues/798
// Sometimes the sensor publishes non-realistic vales, as the sensor only works from
// -20 till +60, don't produce messages beyond these values.
if (temperature > -25 && temperature < 65) {
return {temperature: precisionRoundOptions(temperature, options, 'temperature')};
}
},
},
MFKZQ01LM_action_multistate: {
cid: 'genMultistateInput',
type: 'attReport',
Expand Down
4 changes: 2 additions & 2 deletions devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const devices = [
description: 'MiJia temperature & humidity sensor ',
supports: 'temperature and humidity',
fromZigbee: [
fz.xiaomi_battery_3v, fz.WSDCGQ01LM_WSDCGQ11LM_interval, fz.generic_temperature, fz.xiaomi_humidity,
fz.xiaomi_battery_3v, fz.WSDCGQ01LM_WSDCGQ11LM_interval, fz.xiaomi_temperature, fz.xiaomi_humidity,
fz.ignore_basic_change,
],
toZigbee: [],
Expand All @@ -214,7 +214,7 @@ const devices = [
description: 'Aqara temperature, humidity and pressure sensor',
supports: 'temperature, humidity and pressure',
fromZigbee: [
fz.xiaomi_battery_3v, fz.generic_temperature, fz.xiaomi_humidity, fz.xiaomi_pressure,
fz.xiaomi_battery_3v, fz.xiaomi_temperature, fz.xiaomi_humidity, fz.xiaomi_pressure,
fz.ignore_basic_change, fz.ignore_temperature_change, fz.ignore_humidity_change,
fz.ignore_pressure_change, fz.WSDCGQ01LM_WSDCGQ11LM_interval,
],
Expand Down

0 comments on commit 74e257f

Please sign in to comment.