Lua 3D array

Moderator: leecollings

JustMitchie
Posts: 15
Joined: Saturday 17 March 2018 23:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Lua 3D array

Post by JustMitchie »

Code: Select all

Error: EventSystem: in Gas_Update: [string "print('setting Gas')..."]:8: attempt to concatenate field 'gas' (a nil value)
That is with the value 7.418 m3 so, maybe it needs just the 7.418?
JustMitchie
Posts: 15
Joined: Saturday 17 March 2018 23:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Lua 3D array

Post by JustMitchie »

forgot the capital letter G. But now the problem is that it writes 7.418 m3 as 0.007 m3
and i doublechecked the data, the data is 7 m3 per day

i got the clever idea to multiply the value by 1000 by doing

Code: Select all

commandArray['UpdateDevice']=otherdevices_idx['Gas']..'|0|'..(jsonData.result[1].CounterToday * 1000)
but offcourse this now throws the error that "attempt to perform arithmetic on field 'CounterToday' (a string value) "so thats not going to happen. I'm asking this because the kwh meter got the same sort of things, so i'll only need to edit the stuff

kind regards!

Code: Select all

   local value = string.sub(jsonData.result[1].CounterToday, 1, 5) * 1000
   commandArray['UpdateDevice']=otherdevices_idx['Gas']..'|0|'..value 
NAILED IT! THANKS <3
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest