scaledPreviousMeterValue

Is cmd.scaledPreviousMeterValue implemented for Z-Wave? I keep getting null errors when porting over a device handler that uses it. cmd.scaledMeterValue works great.

Looks like I had to change the null handling. On "another platform" you can simply do cmd.scaledPreviousMeterValue ?: 0, but on this one I had to check the map attribute first with cmd.previousMeterValue != [] ? cmd.scaledPreviousMeterValue : 0

I will look into this...

I don't suppose you have an example payload I can test this with do you?

Here's a chunk of them from the debugging I did:

dev:2742018-05-09 12:33:20.317:debugParsed 'zw device: 21, command: 3202, payload: A1 6C 00 00 00 00 00 00 ' to ['name':'current', 'unit':'A', 'displayed':false, 'value':0.000]
dev:2742018-05-09 12:33:20.311:debugprevious value is 0
dev:2742018-05-09 12:33:20.310:debugreceived MeterReport(meterType: 1, precision: 3, scale: 5, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:20.160:debugParsed 'zw device: 21, command: 3202, payload: A1 6C 00 00 00 00 00 00 ' to ['name':'current', 'unit':'A', 'displayed':false, 'value':0.000]
dev:2742018-05-09 12:33:20.148:debugprevious value is 0
dev:2742018-05-09 12:33:20.146:debugreceived MeterReport(meterType: 1, precision: 3, scale: 5, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:17.124:debugParsed 'zw device: 21, command: 3202, payload: 21 64 00 00 00 09 00 08 00 00 00 09 ' to ['name':'energy', 'unit':'kWh', 'displayed':false, 'value':0.009]
dev:2742018-05-09 12:33:17.112:debugprevious value is 0.009
dev:2742018-05-09 12:33:17.110:debugreceived MeterReport(meterType: 1, precision: 3, scale: 0, size: 4, meterValue: [0, 0, 0, 9], rateType: 1, deltaTime: 8, previousMeterValue: [0, 0, 0, 9])
dev:2742018-05-09 12:33:15.132:debugParsed 'zw device: 21, command: 3202, payload: A1 64 00 01 DC 30 00 00 ' to ['name':'voltage', 'unit':'V', 'displayed':false, 'value':121.904]
dev:2742018-05-09 12:33:15.119:debugprevious value is 0
dev:2742018-05-09 12:33:15.117:debugreceived MeterReport(meterType: 1, precision: 3, scale: 4, size: 4, meterValue: [0, 1, 220, 48], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:15.100:debugParsed 'zw device: 21, command: 3202, payload: 21 74 00 00 00 00 00 00 ' to ['name':'power', 'unit':'W', 'displayed':false, 'value':0]
dev:2742018-05-09 12:33:15.092:debugprevious value is 0
dev:2742018-05-09 12:33:15.090:debugreceived MeterReport(meterType: 1, precision: 3, scale: 2, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:13.264:debugParsed 'zw device: 21, command: 3202, payload: 21 74 00 00 00 00 00 00 ' to ['name':'power', 'unit':'W', 'displayed':false, 'value':0]
dev:2742018-05-09 12:33:13.259:debugprevious value is 0
dev:2742018-05-09 12:33:13.258:debugreceived MeterReport(meterType: 1, precision: 3, scale: 2, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:13.167:debugParsed 'zw device: 21, command: 3202, payload: A1 6C 00 00 00 00 00 00 ' to ['name':'current', 'unit':'A', 'displayed':false, 'value':0.000]
dev:2742018-05-09 12:33:13.158:debugprevious value is 0
dev:2742018-05-09 12:33:13.157:debugreceived MeterReport(meterType: 1, precision: 3, scale: 5, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:13.117:debugParsed 'zw device: 21, command: 3202, payload: A1 64 00 01 DB D0 00 00 ' to ['name':'voltage', 'unit':'V', 'displayed':false, 'value':121.808]
dev:2742018-05-09 12:33:13.107:debugprevious value is 0
dev:2742018-05-09 12:33:13.105:debugreceived MeterReport(meterType: 1, precision: 3, scale: 4, size: 4, meterValue: [0, 1, 219, 208], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:09.553:debugParsed 'zw device: 21, command: 3202, payload: 21 64 00 00 00 09 00 34 00 00 00 09 ' to ['name':'energy', 'unit':'kWh', 'displayed':false, 'value':0.009]
dev:2742018-05-09 12:33:09.549:debugprevious value is 0.009
dev:2742018-05-09 12:33:09.547:debugreceived MeterReport(meterType: 1, precision: 3, scale: 0, size: 4, meterValue: [0, 0, 0, 9], rateType: 1, deltaTime: 52, previousMeterValue: [0, 0, 0, 9])
dev:2742018-05-09 12:33:09.247:debugParsed 'zw device: 21, command: 3202, payload: 21 74 00 00 00 00 00 00 ' to ['name':'power', 'unit':'W', 'displayed':false, 'value':0]
dev:2742018-05-09 12:33:09.240:debugprevious value is 0
dev:2742018-05-09 12:33:09.238:debugreceived MeterReport(meterType: 1, precision: 3, scale: 2, size: 4, meterValue: [0, 0, 0, 0], rateType: 1, deltaTime: 0, previousMeterValue: [])
dev:2742018-05-09 12:33:09.072:debugParsed 'zw device: 21, command: 2603, payload: 00 ' to ['name':'level', 'value':0, 'type':'digital', 'unit':'%', 'displayed':false, 'isStateChange':false]

1 Like