In the assessment I came to a problem with the MeterLevel function.
Code: Select all
case "MeterLevel":
var S = params.shift();
zway.devices[N].instances[I].Meter.Get();
return zway.devices[N].instances[I].Meter.data[S].val.value;
I therefor had added some math to do away with the decimals in the original RaZ-OR. I tried to reinstate that in the new code:
Code: Select all
case "MeterLevel":
var S = params.shift();
zway.devices[N].instances[I].Meter.Get();
switch (S)
{
case 0:
return Math.round((zway.devices[N].instances[I].Meter.data[S].val.value)*1000);
break;
case 2:
return Math.round((zway.devices[N].instances[I].Meter.data[S].val.value)*10)/10;
break;
}
EDIT: As a matter of fact, after I called the function from Firefox, I noticed that the accumulated kWh was reset to zero
