Web query for channel with 0 watts has a space in it

Hi, great product that I’m currently integrating into my Node Red / Grafana page but came across what may be a bug, as I’m new to NR haven’t been able to work around this issue yet.

I’m running the following query http://10.11.0.3/status?inputs=yes and then parsing the result.
If the channel is reporting something all is fine eg
{“channel”:5,“Watts”:“713”,“Pf”:0.83518,“phase”:1.3,“lastphase”:0.38}
but for a channel where the power usage is zero I get a space before the number that is throwing errors on my NR
{“channel”:6,“Watts”:" 0",“Pf”:0,“phase”:1.4,“lastphase”:0.48}

running IoTaWatt 5.0, Firmware version 02_06_05

The zero value is not a special case, it’s formatted by the same code that does the non-zero value. I agree that the space is superfluous, but it is a string and therefore valid json. The IoTaWatt code that uses it is JavaScript and has no problem with it.

It should be noted that the status API is undocumented and is considered to be a non-public feature. It can change from release to release. The query API is published and is a better choice, although it only provides 5 second averages.