cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Thingworx, EMS, SDK and LUA

trungkien2104
7-Bedrock

Thingworx, EMS, SDK and LUA

Hello everyone,

I'm a newbie working with Thingworx platform. Currently, I have some concerns about the EMS and Lua script. I already knew about the benefit when we use the EMS to connect the remote thing. But the REST API, SDK and LUA script make my confusion:

 - When I use EMS standalone, I can Read/Write data from Thingworx Platform through the REST API of EMS. So, the workflow I prefer is read data from sensor -> Use PUT request to send data to Thingworx via EMS. It is practice for me because I can use only one script (in any languages programming) to read data and send it to Thingworx. I saw some examples concern about Andruino and other microprocessors, so I think that is is a good choice to send data via REST API because they can access to Wifi but they can't program with LUA or SDK. That is why I concern about the LUA script. The LUA script is just an optional in Thingworx or it required to connect all the remote things ?

 - By the way, it is similar with the REST API, I don't know exactly the benefit of SDK in this case. Could you please give me some examples to choose which method should be used to send data to Thingworx ? I have no ideal to choose which one should to be learned deeper because I come from IT and the REST API is very familiar for me. If three method are the same, I always want to use REST API.

1 ACCEPTED SOLUTION

Accepted Solutions

4 REPLIES 4

The point of the EMS or the Agent SDK is so you can get a safe and secure bidirectional connection from your devices/systems to Thingworx over websockets.

If you are just doing REST PUT to Thingworx you don't need an agent at all.

 

the compiled EMS agent doesn't need LUA but LUA is included so that you can use LUA to retrieve information from your device or system to then transmit that through the EMS back to Thingworx.

Agent SDKs exist to create more integrated solutions.

 

What you can do is just leverage the EMS and PUT/POST information to the EMS locally on the device/system and have that be communicated securely to the Thingworx platform.

Hi PaiChung,

I saw this post "https://community.ptc.com/t5/ThingWorx-Developers/Thingworx-and-EMS/td-p/517380" and also see some lua script example in the micro service zip file . And what I found is that the lua script also use REST API call to EMS server (setProperties function in server.lua). So, that is why I think Lua scrip is just an optional at this point. I can use any languages programming I want to read data from sensor (if this language had the library to do that, as the link above, Python) and send this data to Thingworx via a REST API call (POST/PUT) to EMS. EMS shall send the data to ThingWorx Platform through Always On (Websocket). Please help me to correct it if I misunderstand.

Correct.

Thank you @PaiChung

Top Tags