Not able to connect to Lua process manager running in the raspberry pi to EMS running in laptop.
- December 17, 2018
- 1 reply
- 2941 views
Hi,
I have attached config.json and config.lua files for reference.
I am running EMS on my laptop and its is successfully connected to the thingworx server.Below are the logs:
C:\EMS\microserver>wsems
[FORCE] 2018-12-12 08:27:30,596 wsems: Initializing EMS ....
[FORCE] 2018-12-12 08:27:30,596 main: Using config file C:\EMS\microserver\etc\config.json
[INFO ] 2018-12-12 08:27:30,596 wsems: Creating the WsEms proxy.
[INFO ] 2018-12-12 08:27:30,596 wsems: Starting HTTP Server.
[INFO ] 2018-12-12 08:27:30,596 Main: Using custom certificate and private key for HTTP Server
[WARN ] 2018-12-12 08:27:30,596 Main: Encryption is disabled on HTTP Server.
[WARN ] 2018-12-12 08:27:30,596 Main: Authentication is disabled on the HTTP Server.
[INFO ] 2018-12-12 08:27:30,596 wsems: Initializing the ThingWorx REST interface.
[INFO ] 2018-12-12 08:27:30,596 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2018-12-12 08:27:30,596 wsEmsProxy::initialize: Encryption is enabled on Web Socket connection.
[FORCE] 2018-12-12 08:27:30,596 httpServer: starting http server port=8000
[WARN ] 2018-12-12 08:27:30,596 SDK: SDK Version: 2.1.5
[WARN ] 2018-12-12 08:27:30,596 SDK: TLS Library: OpenSSL
[WARN ] 2018-12-12 08:27:30,596 SDK: TLS Library Version: 1.0.2l-fips
[WARN ] 2018-12-12 08:27:30,596 SDK: FIPS Capable
[INFO ] 2018-12-12 08:27:30,975 WsProxy::initialize: EMS Version 5.4.4.434
[INFO ] 2018-12-12 08:27:30,975 WsProxy::initialize: twApi singleton initialized
[WARN ] 2018-12-12 08:27:30,975 WsProxy::initialize: Certificate validation is disabled.
[ERROR] 2018-12-12 08:27:30,979 SDK: twMap_Add: parse function returned null.
[INFO ] 2018-12-12 08:27:30,979 wsEmsProxy::initialize: Initialization complete!
PP-1812030854XQ.devportal.ptc.io:443-->[INFO ] 2018-12-12 08:27:30,979 wsems: Starting the connection.
[INFO ] 2018-12-12 08:27:32,819 SDK: Server supports websocket extensions: permessage-deflate
[INFO ] 2018-12-12 08:27:32,819 SDK: twWs_Connect: Websocket connected!
[INFO ] 2018-12-12 08:27:33,239 Main: Succesfully connected. Saving .booted config file
[INFO ] 2018-12-12 08:27:33,341 EMS: Duty Cycle is disabled.
Now i am trying to run the lua process manager in raspberry pi to bind a remote thing to the platform through local http connection and with help of EMS running in my laptop, but i think process manager is not getting connected to the EMS. Below are the logs:
pi@raspberrypi:~/connecting_raspberry_pi_to_thing_worx/microserver $ sudo ./luaScriptResource
[INFO ] 2018-11-14 12:22:07,185 ./luaScriptResource: Using config file: /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/config.lua
[FORCE] 2018-11-14 12:22:07,185 ./luaScriptResource: Starting up ....
[INFO ] 2018-11-14 12:22:07,191 luaScriptResource:main: Encryption is disabled on the RAP connection.
[INFO ] 2018-11-14 12:22:07,191 luaScriptResource:main: FIPS is disabled.
[DEBUG] 2018-11-14 12:22:07,195 ./luaScriptResource: Appending /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/clibs;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/clibs;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/clibs to current path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[INFO ] 2018-11-14 12:22:07,195 ./luaScriptResource: New path is /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/clibs:/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/clibs:/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/clibs:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[WARN ] 2018-11-14 12:22:07,198 ScriptResource::initialize: Encryption is disabled on HTTP Server.
[WARN ] 2018-11-14 12:22:07,198 ScriptResource::initialize: Authentication is disabled on the HTTP Server.
[DEBUG] 2018-11-14 12:22:07,200 luaScriptProxy: Constructor Called
[DEBUG] 2018-11-14 12:22:07,202 luaScriptProxy::initialize: Name = PiThing
File = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/scripts/thing.lua
LibraryPath = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
InitData Ptr = 0
Persisted Props:
file = thing.lua
scanRate = 10000
template = PiTemplate
GlobalProps:
config_file_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc
fips_enabled = false
log_level = DEBUG
rap_deny_selfsigned = true
rap_host = 192.168.1.100
rap_port = 8000
rap_server_authenticate = false
rap_ssl = false
rap_validate = false
script_clib_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/clibs/?.so
script_directory = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/scripts
script_library_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
script_resource_authenticate = false
script_resource_host = 192.168.1.101
script_resource_port = 8001
script_resource_ssl = false
[DEBUG] 2018-11-14 12:22:07,204 luaScriptProxy::runScript: Starting Script
[DEBUG] 2018-11-14 12:22:07,204 luaScriptProxy::execute: Script PiThing now executing
[DEBUG] 2018-11-14 12:22:07,205 luaScriptProxy::getStatus: Script PiThing status = Running
[DEBUG] 2018-11-14 12:22:07,219 ScriptResource::addScript: File /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/scripts/sample.lua does not exist. Using custom script directory
[DEBUG] 2018-11-14 12:22:07,219 luaScriptProxy: Constructor Called
[DEBUG] 2018-11-14 12:22:07,233 luaScriptProxy::initialize: Name = sample
File = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/scripts/sample.lua
LibraryPath = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
InitData Ptr = 0
Persisted Props:
file = sample.lua
GlobalProps:
config_file_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc
fips_enabled = false
log_level = DEBUG
rap_deny_selfsigned = true
rap_host = 192.168.1.100
rap_port = 8000
rap_server_authenticate = false
rap_ssl = false
rap_validate = false
script_clib_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/clibs/?.so
script_directory = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/scripts
script_library_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
script_resource_authenticate = false
script_resource_host = 192.168.1.101
script_resource_port = 8001
script_resource_ssl = false
[DEBUG] 2018-11-14 12:22:07,240 luaScriptProxy::runScript: Starting Script
[DEBUG] 2018-11-14 12:22:07,240 luaScriptProxy::execute: Script sample now executing
[DEBUG] 2018-11-14 12:22:07,241 luaScriptProxy::getStatus: Script sample status = Running
[DEBUG] 2018-11-14 12:22:07,247 luaScriptProxy: Constructor Called
[DEBUG] 2018-11-14 12:22:07,254 luaScriptProxy::initialize: Name = Thingworx
File = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/scripts/thingworx.lua
LibraryPath = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
InitData Ptr = 0
Persisted Props:
file = thingworx.lua
max_run_time = 20
GlobalProps:
config_file_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc
fips_enabled = false
log_level = DEBUG
rap_deny_selfsigned = true
rap_host = 192.168.1.100
rap_port = 8000
rap_server_authenticate = false
rap_ssl = false
rap_validate = false
script_clib_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/clibs/?.so;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/clibs/?.so
script_directory = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/scripts
script_library_path = /home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/thingworx/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/custom/lua/?.lua;/home/pi/connecting_raspberry_pi_to_thing_worx/microserver/etc/community/lua/?.lua
script_resource_authenticate = false
script_resource_host = 192.168.1.101
script_resource_port = 8001
script_resource_ssl = false
[DEBUG] 2018-11-14 12:22:07,264 utils: Adding utils functions to tw_utils
[DEBUG] 2018-11-14 12:22:07,281 luaScriptProxy::runScript: Starting Script
[DEBUG] 2018-11-14 12:22:07,282 luaScriptProxy::execute: Script Thingworx now executing
[DEBUG] 2018-11-14 12:22:07,283 luaScriptProxy::getStatus: Script Thingworx status = Running
[FORCE] 2018-11-14 12:22:07,284 httpServer: starting http server port=8001
[DEBUG] 2018-11-14 12:22:07,284 httpServer: http server bound to port=8001.
[INFO ] 2018-11-14 12:22:07,285 thingworx.shape: Creating a new shape.
[INFO ] 2018-11-14 12:22:07,291 PiThing: -- Configuration -------------------------------
[INFO ] 2018-11-14 12:22:07,291 PiThing: scanRate: 10000
[INFO ] 2018-11-14 12:22:07,291 PiThing: scanRateResolution: 500
[INFO ] 2018-11-14 12:22:07,292 PiThing: taskRate: 15000
[INFO ] 2018-11-14 12:22:07,292 PiThing: keepAliveRate: 60000
[INFO ] 2018-11-14 12:22:07,292 PiThing: requestTimeout: 15000
[INFO ] 2018-11-14 12:22:07,292 PiThing: registerRate: 43200000
[INFO ] 2018-11-14 12:22:07,293 PiThing: register: true
[INFO ] 2018-11-14 12:22:07,293 PiThing: getPropertySubscriptionOnReconnect: false
[INFO ] 2018-11-14 12:22:07,293 PiThing: maxConcurrentPropertyUpdates: 100
[INFO ] 2018-11-14 12:22:07,294 PiThing: defaultPushType: VALUE
[INFO ] 2018-11-14 12:22:07,294 PiThing: useShapes: true
[INFO ] 2018-11-14 12:22:07,294 PiThing: identifier: Not Specififed
[INFO ] 2018-11-14 12:22:07,294 PiThing: ------------------------------------------------
[INFO ] 2018-11-14 12:22:07,298 thingworx.template: Adding shape 'shapes.metadata' to template 'thingworx.template'
[INFO ] 2018-11-14 12:22:07,301 thingworx.template: Adding shape 'shapes.propsubscribe' to template 'thingworx.template'
[INFO ] 2018-11-14 12:22:07,302 thingworx.template: Creating new templates.PiTemplate named 'PiThing'
[INFO ] 2018-11-14 12:22:07,302 PiThing: -- Initializing properties ---------------------
[INFO ] 2018-11-14 12:22:07,310 PiThing: Initialized property upToDate [baseType: BOOLEAN, pushType: NEVER, handler: nil, value: true]
[DEBUG] 2018-11-14 12:22:07,314 utils: Adding utils functions to tw_utils
[INFO ] 2018-11-14 12:22:07,315 sample: Registering HTTP callbacks
[DEBUG] 2018-11-14 12:22:07,315 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/number/ with callback property_number
[DEBUG] 2018-11-14 12:22:07,315 luaHttpBinding::l_registerCallback: Registered path '/property/number' with callback 'property_number' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,315 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/string/ with callback property_string
[DEBUG] 2018-11-14 12:22:07,315 luaHttpBinding::l_registerCallback: Registered path '/property/string' with callback 'property_string' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,315 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/boolean/ with callback property_boolean
[DEBUG] 2018-11-14 12:22:07,315 luaHttpBinding::l_registerCallback: Registered path '/property/boolean' with callback 'property_boolean' for script 'sample'
[INFO ] 2018-11-14 12:22:07,315 PiThing: Initialized property cpu_volt [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[DEBUG] 2018-11-14 12:22:07,315 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/datetime/ with callback property_datetime
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/property/datetime' with callback 'property_datetime' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,316 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/location/ with callback property_location
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/property/location' with callback 'property_location' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,316 ScriptResource::registerScriptCallback: Registered path /scripts/sample/property/xml/ with callback property_xml
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/property/xml' with callback 'property_xml' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,316 ScriptResource::registerScriptCallback: Registered path /scripts/sample/generate/json/ with callback generate_json
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/generate/json' with callback 'generate_json' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,316 ScriptResource::registerScriptCallback: Registered path /scripts/sample/generate/xml/ with callback generate_xml
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/generate/xml' with callback 'generate_xml' for script 'sample'
[DEBUG] 2018-11-14 12:22:07,316 ScriptResource::registerScriptCallback: Registered path /scripts/sample/generate/text/ with callback generate_text
[DEBUG] 2018-11-14 12:22:07,316 luaHttpBinding::l_registerCallback: Registered path '/generate/text' with callback 'generate_text' for script 'sample'
[INFO ] 2018-11-14 12:22:07,316 sample: Beginning main loop
[INFO ] 2018-11-14 12:22:07,316 PiThing: Initialized property cpu_temperature [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[INFO ] 2018-11-14 12:22:07,318 PiThing: Initialized property cpu_freq [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0]
[INFO ] 2018-11-14 12:22:07,319 PiThing: ------------------------------------------------
[DEBUG] 2018-11-14 12:22:07,319 luaScriptProxy::getStatus: Script PiThing status = Running
[DEBUG] 2018-11-14 12:22:07,319 luaScriptProxy::getStatus: Script sample status = Running
[DEBUG] 2018-11-14 12:22:07,319 luaScriptProxy::getStatus: Script Thingworx status = Running
[DEBUG] 2018-11-14 12:22:07,319 luaScriptProxy::getStatus: Script Thingworx status = Running
[DEBUG] 2018-11-14 12:22:07,323 ScriptResource::registerScriptCallback: Registered path /scripts/Thingworx/ with callback handle_request
[DEBUG] 2018-11-14 12:22:07,323 luaHttpBinding::l_registerCallback: Registered path '/' with callback 'handle_request' for script 'Thingworx'
[DEBUG] 2018-11-14 12:22:07,323 ScriptResource::registerScriptCallback: Registered path /scripts/Thingworx/registerIdentifier/ with callback register_identifier
[DEBUG] 2018-11-14 12:22:07,323 luaHttpBinding::l_registerCallback: Registered path '/registerIdentifier' with callback 'register_identifier' for script 'Thingworx'
[INFO ] 2018-11-14 12:22:09,291 PiThing: -- Starting script --------------------------
[INFO ] 2018-11-14 12:22:09,291 PiThing: Registering core callback handler
[DEBUG] 2018-11-14 12:22:09,291 ScriptResource::registerScriptCallback: Registered path /scripts/PiThing/ with callback core_handler
[DEBUG] 2018-11-14 12:22:09,291 luaHttpBinding::l_registerCallback: Registered path '/' with callback 'core_handler' for script 'PiThing'
[INFO ] 2018-11-14 12:22:09,291 PiThing: Starting main loop
[INFO ] 2018-11-14 12:22:09,291 PiThing: Calling lifecycle start listeners.
[DEBUG] 2018-11-14 12:22:09,291 PiThing: Executing lifecycle start event: shapes.propsubscribe_start
[INFO ] 2018-11-14 12:22:09,291 shapes.propsubscribe: Initialized
[INFO ] 2018-11-14 12:22:09,292 thingworx.handler: Creating a new handler.
[DEBUG] 2018-11-14 12:22:09,296 thingworx.server: Invoking /Thingworx/Things/LocalEms/Services/AddEdgeThing on server. content: {"keepalive":60000,"port":"8001","timeout":15000,"host":"192.168.1.101","proto":"http","name":"PiThing","path":"/scripts/Thingworx"}
[DEBUG] 2018-11-14 12:22:09,297 SDK: twTlsClient_Create: Initializing TLS Client
[TRACE] 2018-11-14 11:41:21,503 luaConfigurator::doGetItem: Global property or script log_publish_directory not found
[
Please help me to resolve this issue...
Thanks
Saurabh kr singh

