since a couple of hours I'm struggling on a very simple thing wich consist in updating a virtual powermeter device with a value in LUA so if someone would have a second pairs of eyes and spot what I'm missing it would be fantastic
here is the code :
Code: Select all
local linky = otherdevices[getdevicename(linky)]
print(linky)
local linky = string.match(linky, "^(%d+)")
print(linky)
commandArray['UpdateDevice'] = 1639 .. "|0|" .. linky
in a nutshell
1) I retrieve a value from another counter called LINKY so it gets a value like : 500;682591.8871 (first print linky)
2) as I just want the first value I do a string.match to get only the first part so the second print shows 510
3) I try to update the power meter just to get 500 KWH in it (the cumulative will be done using computed mode in the power meter) so I tried the command array update device but nothing comes up into the device
1639 is the correct number of the device and if I modify the the nvalue number in the formula it apparently changes in the devices values
but the concern is that I don't get a single proper KWH value in this device
thanks for your precious help !
cheers
seb