Skip to content

Commit

Permalink
Fix illuminance_lux calculation. #1506
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed Oct 2, 2020
1 parent 5814aab commit f256522
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ const converters = {
convert: (model, msg, publish, options, meta) => {
// DEPRECATED: only return lux here (change illuminance_lux -> illuminance)
const illuminance = msg.data['measuredValue'];
const illuminanceLux = Math.pow(10, illuminance / 10000) - 1;
const illuminanceLux = illuminance === 0 ? 0 : Math.pow(10, (illuminance - 1) / 10000);
return {
illuminance: calibrateAndPrecisionRoundOptions(illuminance, options, 'illuminance'),
illuminance_lux: calibrateAndPrecisionRoundOptions(illuminanceLux, options, 'illuminance_lux'),
Expand Down

0 comments on commit f256522

Please sign in to comment.