https://developer.smartthings.com/capabilities/powerMeter
https://developer.smartthings.com/capabilities/voltageMeasurement
Both have almost the exact same specs, except for the property “value”:
| Capability | Value |
|---|---|
| voltageMeasurement | {"$ref": "Number"} |
| powerMeter | {"type": "number"} |

Both have a single unit
Both have default unit
Both have required attribute called “value”
In both cases, I was only emitting the event with the numeric value only, without unit.
It is working fine for “voltageMeasurement” and throwing the following error for “powerMeter”:
[string “st/dispatcher.lua”]:233: Error encountered while processing event
…
[string “st/utils.lua”]:112: bad argument #1 to ‘for iterator’ (table expected, got number)
Then I thought: For some unknown reason, “powerMeter” is not handling single value without informing unit as I was expecting, just like it does with voltageMeasurement
So I changed the code to inform the unit and the error disappeared.
Maybe changing {"type": "number"} to {"$ref": "Number"} would fix that behavior.
