Skip to main content
Sep 26, 2020 2:20 PM UTC
Solved

EMS on Raspberry Pi, error connecting

Hello, 

 

While trying to connect my Raspberry 3 B+ to Platform, i get this error when doing : sudo ./luaScriptResource  : 

 

 

[FORCE] 2020-09-26 14:10:45,205 ./luaScriptResource: Starting up ....

[INFO ] 2020-09-26 14:10:45,208 luaScriptResource:main: Encryption is disabled on the RAP connection.
[INFO ] 2020-09-26 14:10:45,208 luaScriptResource:main: FIPS is disabled.
[INFO ] 2020-09-26 14:10:45,209 ./luaScriptResource: New path is /home/pi/Desktop/microserver/etc/thingworx/clibs:/home/pi/Desktop/microserver/etc/custom/clibs:/home/pi/Desktop/microserver/etc/community/clibs:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[WARN ] 2020-09-26 14:10:45,210 ScriptResource::initialize: Encryption is disabled on HTTP Server.
[ERROR] 2020-09-26 14:10:45,210 ScriptResource::initialize: Failed to get HTTP Server authenticate configuration.
[ERROR] 2020-09-26 14:10:45,210 ./luaScriptResource: Error initiatizing script resource
[ERROR] 2020-09-26 14:10:45,210 luaScriptResource:main: Insecure configuration. Shutting down LSR.

[WARN ] 2020-09-26 14:10:46,211 luaConfigurator::~luaConfigurator: Closing Lua state

 

 

Myabe something wrong in my config ? 

 

config.lua

 

scripts.log_level = "INFO"
scripts.script_resource_ssl = false
scripts.script_resources_authenticate = false
scripts.PiThing = {
 file = "thing.lua",
 template = "PiTemplate",
 scanRate = 1000,
 taskRate = 30000
 }
scripts.rap_host = "127.0.0.1"
scripts.rap_port = 8080



scripts.data_security_key_hash="4vt6VnYj+93wOHypT0jFoIwvk93bsM3UA7n1WAS7FqQ"

 

 

config.json

 

{
 "ws_servers": [{
 "host": "pp-2009221255A9.devportal.ptc.io",
 "port": 443
 }],
 "appkey": "a814e827-9f06-41a3-bbeb-7b615abbe3df",
 "http_server": {
 "host": "127.0.0.1",
 "port": 8080,
 "use_default_certificate": true,
 "ssl": false,
 "authenticate": false
 },
 "logger": {
 "level": "INFO"
 },
 "certificates": {
 "validate": false,
 "disable_hostname_validation": true
 }
}

 

 

I'm using Thingworx platform 9.0 Trial 

 

Sep 30, 2020 8:48 PM UTC

What version of EMS are you using?

The latest version of EMS has changed to disallow default insecure behavior.

Try this config file that explicitly turns off security features:

 

scripts.log_level = "INFO"
scripts.script_resource_ssl = false
scripts.script_resource_authenticate = false
scripts.script_resource_host = "127.0.0.1"
scripts.script_resource_port = 8001
scripts.PiThing = {
file = "thing.lua",
template = "PiTemplate",
scanRate = 1000,
taskRate = 30000
}
scripts.rap_host = "127.0.0.1"
scripts.rap_port = 8080
scripts.rap_ssl = false
scripts.rap_server_authenticate = false 

 

7 replies

Sep 29, 2020 8:41 AM UTC

Does anyone have an idea ? 

Thank you 

Sep 30, 2020 8:48 PM UTC

What version of EMS are you using?

The latest version of EMS has changed to disallow default insecure behavior.

Try this config file that explicitly turns off security features:

 

scripts.log_level = "INFO"
scripts.script_resource_ssl = false
scripts.script_resource_authenticate = false
scripts.script_resource_host = "127.0.0.1"
scripts.script_resource_port = 8001
scripts.PiThing = {
file = "thing.lua",
template = "PiTemplate",
scanRate = 1000,
taskRate = 30000
}
scripts.rap_host = "127.0.0.1"
scripts.rap_port = 8080
scripts.rap_ssl = false
scripts.rap_server_authenticate = false 

 

Oct 1, 2020 12:44 PM UTC

Thank you for your answer. 

I used your file, i had this error : 

 

[ERROR] 2020-10-01 12:33:38,698 luaConfigurator::initialize: Error while loading file /home/pi/Desktop/microserver/etc/config.lua. msg: /home/pi/Desktop/microse rver/etc/config.lua:5: malformed number near '127.0.0.1'

 

So i added some " ", it's going better and now i have this one : 

 

pi@raspberrypi:~/Desktop/microserver $ sudo ./luaScriptResource
[FORCE] 2020-10-01 12:40:28,988 ./luaScriptResource: Starting up ....

[INFO ] 2020-10-01 12:40:28,992 luaScriptResource:main: Encryption is disabled on the RAP connection.
[INFO ] 2020-10-01 12:40:28,992 luaScriptResource:main: FIPS is disabled.
[INFO ] 2020-10-01 12:40:28,995 ./luaScriptResource: New path is /home/pi/Desktop/microserver/etc/thingworx/clibs:/home/pi/Desktop/microserver/etc/custom/clibs:/home/pi/Desktop/microserver/etc/community/clibs:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[WARN ] 2020-10-01 12:40:28,996 ScriptResource::initialize: Encryption is disabled on HTTP Server.
[WARN ] 2020-10-01 12:40:28,997 ScriptResource::initialize: Authentication is disabled on the HTTP Server.
[FORCE] 2020-10-01 12:40:29,25 httpServer: starting http server port=8001
[INFO ] 2020-10-01 12:40:29,41 thingworx.shape: Creating a new shape.
[INFO ] 2020-10-01 12:40:29,42 PiThing: -- Configuration -------------------------------
[INFO ] 2020-10-01 12:40:29,42 PiThing: scanRate: 1000
[INFO ] 2020-10-01 12:40:29,42 PiThing: scanRateResolution: 500
[INFO ] 2020-10-01 12:40:29,42 PiThing: taskRate: 30000
[INFO ] 2020-10-01 12:40:29,42 PiThing: keepAliveRate: 60000
[INFO ] 2020-10-01 12:40:29,42 PiThing: requestTimeout: 15000
[INFO ] 2020-10-01 12:40:29,42 PiThing: registerRate: 43200000
[INFO ] 2020-10-01 12:40:29,43 PiThing: register: true
[INFO ] 2020-10-01 12:40:29,43 PiThing: getPropertySubscriptionOnReconnect: false
[INFO ] 2020-10-01 12:40:29,43 PiThing: maxConcurrentPropertyUpdates: 100
[INFO ] 2020-10-01 12:40:29,43 PiThing: defaultPushType: VALUE
[INFO ] 2020-10-01 12:40:29,43 PiThing: useShapes: true
[INFO ] 2020-10-01 12:40:29,43 PiThing: identifier: Not Specififed
[INFO ] 2020-10-01 12:40:29,43 PiThing: ------------------------------------------------
[INFO ] 2020-10-01 12:40:29,44 thingworx.template: Adding shape 'shapes.metadata' to template 'thingworx.template'
[INFO ] 2020-10-01 12:40:29,45 thingworx.template: Adding shape 'shapes.propsubscribe' to template 'thingworx.template'
[INFO ] 2020-10-01 12:40:29,45 thingworx.template: Creating new templates.PiTemplate named 'PiThing'
[INFO ] 2020-10-01 12:40:29,45 PiThing: -- Initializing properties ---------------------
[INFO ] 2020-10-01 12:40:29,45 PiThing: Initialized property upToDate [baseType: BOOLEAN, pushType: NEVER, handler: nil, value: true]
[INFO ] 2020-10-01 12:40:29,46 PiThing: Initialized property cpu_volt [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[INFO ] 2020-10-01 12:40:29,46 PiThing: Initialized property cpu_temperature [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[INFO ] 2020-10-01 12:40:29,46 PiThing: Initialized property cpu_freq [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[INFO ] 2020-10-01 12:40:29,46 PiThing: ------------------------------------------------
[INFO ] 2020-10-01 12:40:31,15 PiThing: -- Starting script --------------------------
[INFO ] 2020-10-01 12:40:31,15 PiThing: Registering core callback handler
[INFO ] 2020-10-01 12:40:31,16 PiThing: Starting main loop
[INFO ] 2020-10-01 12:40:31,16 PiThing: Calling lifecycle start listeners.
[INFO ] 2020-10-01 12:40:31,16 shapes.propsubscribe: Initialized
[INFO ] 2020-10-01 12:40:31,17 thingworx.handler: Creating a new handler.
[INFO ] 2020-10-01 12:40:31,36 PiThing: MicroServer is now available.
[INFO ] 2020-10-01 12:40:31,36 PiThing: MicroServer is online.
[INFO ] 2020-10-01 12:40:31,36 PiThing: Successfully registered PiThing with MicroServer.
[INFO ] 2020-10-01 12:40:31,671 PiThing: Error occured while accessing EMS. Checking isConnected.
[INFO ] 2020-10-01 12:40:31,678 PiThing: EMS is available: true, online: true
[INFO ] 2020-10-01 12:40:31,678 PiThing: Attempting to GetPropertySubscriptions from server failed. code: 202, result:
[ERROR] 2020-10-01 12:40:31,695 luaScriptProxy::execute: [1979708496] Error executing script PiThing, Error = Error: ...ktop/microserver/etc/custom/templates/PiTemplate.lua:32: attempt to perform arithmetic on local 's' (a nil value)
[ERROR] 2020-10-01 12:40:31,695 luaScriptProxy::app_unlock: [1979708496] Attempt to unlock app_mutex while not holding it.L= 0x1bd6420

 

 

Looks like there is still 2 errors, one in PiTemplate and the other one... i have no clue. 

I don't know which version of EMS i'm using, and don't know where to find this info (i did search)