-
-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eac3095
commit 8a621bd
Showing
2 changed files
with
9 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const { lookupMeterScale } = require('@zwave-js/config') | ||
|
||
module.exports = { | ||
// https://github.com/OpenZWave/open-zwave/blob/0d94c9427bbd19e47457578bccc60b16c6679b49/config/Localization.xml#L606 | ||
_productionMap: { | ||
|
@@ -17,40 +19,22 @@ module.exports = { | |
}, | ||
// https://github.com/OpenZWave/open-zwave/blob/0d94c9427bbd19e47457578bccc60b16c6679b49/config/Localization.xml#L679 | ||
// https://github.com/OpenZWave/open-zwave/blob/0d94c9427bbd19e47457578bccc60b16c6679b49/cpp/src/command_classes/Meter.cpp#L74 | ||
_metersMap: { | ||
0: 'kwh', // electricity | ||
1: 'kvah', | ||
2: 'w', | ||
3: 'pulses', | ||
4: 'v', | ||
5: 'a', | ||
6: 'pf', | ||
8: 'kvar', | ||
9: 'kvarh', | ||
16: 'm3', // gas | ||
17: 'ft3', | ||
19: 'pulses', | ||
32: 'm3', // water | ||
33: 'ft3', | ||
34: 'gal', | ||
35: 'pulses', | ||
48: 'kwh', // heating (electricity) | ||
64: 'kwh' // cooling (electricity) | ||
}, | ||
meterType (index) { | ||
meterType (ccSpecific) { | ||
let cfg = null | ||
if (index >= 16 && index < 32) { | ||
if (ccSpecific.meterType >= 16 && ccSpecific.meterType < 32) { | ||
// gas | ||
cfg = this.sensorType(55) | ||
} else if (index >= 32 && index < 48) { | ||
} else if (ccSpecific.meterType >= 32 && ccSpecific.meterType < 48) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
robertsLando
Author
Member
|
||
// water | ||
cfg = this.sensorType(12) | ||
} else { | ||
// electricity | ||
cfg = this.sensorType(4) | ||
} | ||
|
||
cfg.objectId = (this._metersMap[index] || 'unknown') + '_meter' | ||
const scale = lookupMeterScale(ccSpecific.meterType, ccSpecific.scale) | ||
|
||
cfg.objectId = (scale ? scale.label : 'unknown') + '_meter' | ||
return cfg | ||
}, | ||
// https://github.com/OpenZWave/open-zwave/blob/4478eea26b0e1a29184df0515a8034757258ff88/cpp/src/ValueIDIndexesDefines.def#L1068 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Where are you getting these values from?
https://github.com/zwave-js/node-zwave-js/blob/master/packages/config/config/meters.json
meterType goes from 1 to 5.