Hi all,
I'm trying to follow steps from https://developer.thingworx.com/en/resources/guides/thingworx-raspberry-pi-quickstart but my properties do not update (PiThing is connected).
I use Lua file taken from step 8 PiTemplate.lua
Running sudo ./luaScriptResource shows as bellow:
[ERROR] 2019-11-03 20:13:25,229 luaScriptProxy::execute: [-1242565552] Error executing script PiThing, Error = Error: ...worx/microserver/etc/custom/templates/PiTemplate.lua:63: attempt to perform arithmetic on local 's' (a nil value)
[ERROR] 2019-11-03 20:13:25,229 luaScriptProxy::app_unlock: [-1242565552] Attempt to unlock app_mutex while not holding it.L= 0x2068730
Any idea what is wrong
thx for all suggestions.
@Gucio Looks like this Lua file needs to be updated. I just reached out to the concerned team for the same and will provide you further updates as soon as I hear back from the team.
Thanks,
Vibhuti
Hi @vangne
I went one step further after setting:
s = string.match(s,"temp=(%d.%d)");
what is more I had to comment log line - there is also bug that I'll check later.
but unfortunately now I faced with other problem. After typing: sudo ./luaScriptResource - I get error code 500 as bellow:
[INFO ] 2019-11-06 10:56:14,382 PiThing: EMS is available: true, online: true
[WARN ] 2019-11-06 10:56:14,382 thingworx.server: Could not set properties on server. code: 500, resp:
Any Idea??
THX
PiThing.lua file read data as string. Service on PiThing wants to upload data as number.
So I thing that this case could be closed because the only thing I need is to find out how to convert string into number ( s = tonumber(s) dos not work
thx
@Gucio The PiTemplate.lua you used was missing the module statement, property definition, and GetSystemProperties definition. Please replace your old PiTemplate.lua with the attached file content and see if you are still receiving the error.
Thanks,
Vibhuti
I am having this same problem and downloaded the new PiTemplate file, but the issue wasn't fixed. Any ideas?
mine was solved, it seems the files are not compatible with Raspberry Pi 4, using it on Pi 3 seems to be fine.
Have someone solve this problem? I am getting same error even if I update PiTemplate with a file above.
[INFO ] 2020-07-23 08:19:12,567 PiThing: Attempting to GetPropertySubscriptions from server failed. code: 500, result:
[ERROR] 2020-07-23 08:19:12,591 luaScriptProxy::execute: [-1241516976] Error executing script PiThing, Error = Error: ...oads/microserver/etc/custom/templates/PiTemplate.lua:39: attempt to perform arithmetic on local 's' (a nil value)
[ERROR] 2020-07-23 08:19:12,591 luaScriptProxy::app_unlock: [-1241516976] Attempt to unlock app_mutex while not holding it.L= 0x20a808
[INFO ] 2020-07-23 08:19:13,26 PiThing: Received notification that property bindings have been updated on server.
Hi @MattPat, could you please tell us the version of rasperryPi you are using?
Since the guide (https://developer.thingworx.com/en/resources/guides/thingworx-raspberry-pi-quickstart) says:
this guide was created on a Pi 2 and cross-tested on a Pi 3. Other versions of the Raspberry Pi are not covered.
Hi, I am using Raspberry Pi 4 and the only thing that dosen't work is
-- set property frequency
s = freqCmd:read("*a")
log.debug("[PiTemplate]",string.format("raw freq %s",s))
s = string.match(s,"frequency%(45%)=(%d+)");
s = s/1000000
log.debug("[PiTemplate]",string.format("scaled freq %d",s))
properties.cpu_freq.value = s
Hi @MattPat , did you manage to solve this issue?
I have a problem with the expression string.match(s, "frequency%(45%)=(%d+)"); because it makes the variable "s" a nil value according to the error message in my Raspberry Pi's terminal. I assume this happens because no pattern is found, after reading this link.
I found a potential solution, which was to change the 45% to ..% according to this thread. It didn't work for me, however it could be worth a try for you.
Like you I'm also using Raspberry Pi 4. If you have been able to solve this issue then I would be thankful if you could share it with me.
Best regards,
Johannes
sorry but link doesn't work
We were in the middle of updating our server last week, this is the correct link:
https://developer.thingworx.com/en/resources/guides/thingworx-raspberry-pi-quickstart