@@ -7,7 +7,7 @@ import * as legacy from '../lib/legacy';
7
7
import * as m from '../lib/modernExtend' ;
8
8
import * as reporting from '../lib/reporting' ;
9
9
import { DefinitionWithExtend , Expose , Fz , KeyValue , KeyValueAny , Tz , Zh } from '../lib/types' ;
10
- import { getFromLookup , getKey , isEndpoint , postfixWithEndpointName } from '../lib/utils' ;
10
+ import { calibrateAndPrecisionRoundOptions , getFromLookup , getKey , isEndpoint , postfixWithEndpointName } from '../lib/utils' ;
11
11
12
12
const e = exposes . presets ;
13
13
const ea = exposes . access ;
@@ -70,7 +70,8 @@ const fzLocal = {
70
70
type : [ 'attributeReport' , 'readResponse' ] ,
71
71
convert : ( model , msg , publish , options , meta ) => {
72
72
// multi-endpoint version based on the stastard onverter 'fz.humidity'
73
- const humidity = parseFloat ( msg . data [ 'measuredValue' ] ) / 100.0 ;
73
+ let humidity = parseFloat ( msg . data [ 'measuredValue' ] ) / 100.0 ;
74
+ humidity = calibrateAndPrecisionRoundOptions ( humidity , options , 'humidity' ) ;
74
75
75
76
// https://github.com/Koenkk/zigbee2mqtt/issues/798
76
77
// Sometimes the sensor publishes non-realistic vales, it should only publish message
@@ -88,7 +89,8 @@ const fzLocal = {
88
89
convert : ( model , msg , publish , options , meta ) => {
89
90
// multi-endpoint version based on the stastard onverter 'fz.illuminance'
90
91
const illuminance = msg . data [ 'measuredValue' ] ;
91
- const illuminanceLux = illuminance === 0 ? 0 : Math . pow ( 10 , ( illuminance - 1 ) / 10000 ) ;
92
+ let illuminanceLux = illuminance === 0 ? 0 : Math . pow ( 10 , ( illuminance - 1 ) / 10000 ) ;
93
+ illuminanceLux = calibrateAndPrecisionRoundOptions ( illuminanceLux , options , 'illuminance' ) ;
92
94
const multiEndpoint = model . meta && model . meta . multiEndpoint !== undefined && model . meta . multiEndpoint ;
93
95
const property1 = multiEndpoint ? postfixWithEndpointName ( 'illuminance' , msg , model , meta ) : 'illuminance' ;
94
96
return { [ property1 ] : illuminanceLux } ;
@@ -106,6 +108,7 @@ const fzLocal = {
106
108
} else {
107
109
pressure = parseFloat ( msg . data [ 'measuredValue' ] ) ;
108
110
}
111
+ pressure = calibrateAndPrecisionRoundOptions ( pressure , options , 'pressure' ) ;
109
112
const multiEndpoint = model . meta && model . meta . multiEndpoint !== undefined && model . meta . multiEndpoint ;
110
113
const property = multiEndpoint ? postfixWithEndpointName ( 'pressure' , msg , model , meta ) : 'pressure' ;
111
114
return { [ property ] : pressure } ;
0 commit comments