Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Z-Wave-Me/home-automation
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
ronie-z-wave committed Apr 4, 2017
2 parents 4303a0d + 0e26608 commit d963200
Showing 1 changed file with 60 additions and 14 deletions.
74 changes: 60 additions & 14 deletions modules/ZWave/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4100,24 +4100,70 @@ ZWave.prototype.parseAddCommandClass = function (nodeId, instanceId, commandClas
defaults.metrics.scaleTitle = cc.data[scaleId].scaleString.value;
defaults.metrics.title = compileTitle('Meter', defaults.metrics.probeTitle, vDevIdNI);

switch (scaleId) {
case 0:
defaults.probeType = 'meterElectric_kilowatt_hour';
// Check sensor type, can be: Electric, Gas, Water
switch (cc.data[scaleId].sensorType.value) {
// Electric meter
case 1:
switch (scaleId) {
case 0:
defaults.probeType = 'meterElectric_kilowatt_hour';
break;
case 1:
defaults.probeType = 'meterElectric_kilovolt_ampere_hour';
break;
case 2:
defaults.probeType = 'meterElectric_watt';
break;
case 3:
defaults.probeType = 'meterElectric_pulse_count';
break;
case 4:
defaults.probeType = 'meterElectric_voltage';
break;
case 5:
defaults.probeType = 'meterElectric_ampere';
break;
case 6:
defaults.probeType = 'meterElectric_power_factor';
break;
default:
break;
}
break;
// Gas meter
case 2:
defaults.probeType = 'meterElectric_watt';
switch (scaleId) {
case 0:
defaults.probeType = 'meterGas_cubic_meters';
break;
case 1:
defaults.probeType = 'meterGas_cubic_feet';
break;
case 3:
defaults.probeType = 'meterGas_pulse_count';
break;
default:
break;
}
break;
// Water meter
case 3:
defaults.probeType = 'meterElectric_pulse_count';
break;
case 4:
defaults.probeType = 'meterElectric_voltage';
break;
case 5:
defaults.probeType = 'meterElectric_ampere';
break;
case 6:
defaults.probeType = 'meterElectric_power_factor';
switch (scaleId) {
case 0:
defaults.probeType = 'meterWater_cubic_meters';
break;
case 1:
defaults.probeType = 'meterWater_cubic_feet';
break;
case 2:
defaults.probeType = 'meterWater_us_gallons';
break;
case 3:
defaults.probeType = 'meterWater_pulse_count';
break;
default:
break;
}
break;
default:
break;
Expand Down

0 comments on commit d963200

Please sign in to comment.