Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I have a localhost Thingworx on my laptop;
http://localhost:8080/Thingworx
I setup a local EMS\LSR and successfully binded to my TestRemoteThing1 and updated the property.
Following the guide for "Connect Raspberry Pi to ThingWorx" in setup my Raspberry, installed and configured EMS\LSR and ran into the following issue:
Running the EMS with Auto Bind:
The Remote Monitor shows that my TestRemoteThing1 I green and ok.
"Error opening non-TLS socket [127.0.0.1:8001]"
"Error executing request on Things/TestRemoteThing1/Services/NotifyPropertyUpdate"
pi@raspberrypi:~/microserver $ sudo ./wsems
[FORCE] 2018-06-24 15:12:42,229 ./wsems: Initializing EMS ....
[FORCE] 2018-06-24 15:12:42,229 main: Using config file /home/pi/microserver/etc/config.json
[INFO ] 2018-06-24 15:12:42,229 ./wsems: Creating the WsEms proxy.
[INFO ] 2018-06-24 15:12:42,229 ./wsems: Starting HTTP Server.
[INFO ] 2018-06-24 15:12:42,229 Main: Using built-in certificate for HTTP Server
[WARN ] 2018-06-24 15:12:42,229 Main: Encryption is disabled on HTTP Server.
[WARN ] 2018-06-24 15:12:42,229 Main: Authentication is disabled on the HTTP Server.
[FORCE] 2018-06-24 15:12:42,229 httpServer: starting http server port=8000
[INFO ] 2018-06-24 15:12:42,229 ./wsems:
[INFO ] 2018-06-24 15:12:42,229 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2018-06-24 15:12:42,229 wsEmsProxy::initialize: Encryption is disabled on Web Socket connection.
[WARN ] 2018-06-24 15:12:42,230 SDK: SDK Version: 2.0.4
[WARN ] 2018-06-24 15:12:42,230 SDK: TLS Library: OpenSSL
[WARN ] 2018-06-24 15:12:42,230 SDK: TLS Library Version: 1.0.2l
[WARN ] 2018-06-24 15:12:42,230 SDK: FIPS Capable
[INFO ] 2018-06-24 15:12:42,278 WsProxy::initialize: EMS Version 5.4.0.114
[INFO ] 2018-06-24 15:12:42,278 WsProxy::initialize: twApi singleton initialized
[WARN ] 2018-06-24 15:12:42,278 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-06-24 15:12:42,278 WsProxy::initialize: Self signed certificates are enabled.
[ERROR] 2018-06-24 15:12:42,280 SDK: twMap_Add: parse function returned null.
[WARN ] 2018-06-24 15:12:42,281 WsEmsProxy::bindThing: Exception connecting to localhost:8001. Err: Connection refused [localhost:8001]
[WARN ] 2018-06-24 15:12:42,281 WsEmsProxy::bindThing: Changing host from 'localhost' to '127.0.0.1'
[INFO ] 2018-06-24 15:12:42,281 WsEmsProxy::registerVirtualDirs: Adding virtual dir logs: /home/pi/microserver/logs
[INFO ] 2018-06-24 15:12:42,282 WsEmsProxy::registerVirtualDirs: Adding virtual dir instruction: /home/pi/microserver/instruction
[INFO ] 2018-06-24 15:12:42,282 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2018-06-24 15:12:42,282 ./wsems: Starting the connection.
192.168.0.49:8080-->[INFO ] 2018-06-24 15:12:42,319 SDK: twWs_Connect: Websocket connected!
[WARN ] 2018-06-24 15:12:42,384 SDK: twBindBody_Delete: NULL body or stream pointer
[INFO ] 2018-06-24 15:12:42,433 Main: Succesfully connected. Saving .booted config file
[ERROR] 2018-06-24 15:12:43,457 UnencryptedClientStream::doopen: Error opening socket. Error: 111
[ERROR] 2018-06-24 15:12:43,457 HttpClient::initialize: Exception while opening connection request to 127.0.0.1. Error: Error opening non-TLS socket [127.0.0.1:8001]
[ERROR] 2018-06-24 15:12:43,458 emsRequestHandler: Error executing request on Things/TestRemoteThing1/Services/NotifyPropertyUpdate
[ERROR] 2018-06-24 15:12:53,93 UnencryptedClientStream::doopen: Error opening socket. Error: 111
[ERROR] 2018-06-24 15:12:53,93 HttpClient::initialize: Exception while opening connection request to 127.0.0.1. Error: Error opening non-TLS socket [127.0.0.1:8001]
[ERROR] 2018-06-24 15:12:53,93 emsRequestHandler: Error executing request on Things/TestRemoteThing1/Properties/TestProperty
My config.lua;
I am stuck on this and really could use some help and ideas
Thanks
Dave
The error message:
HttpClient::initialize: Exception while opening connection request to 127.0.0.1. Error: Error opening non-TLS socket [127.0.0.1:8001]
means the EMS is not able to connect to the LSR. Either LSR is not running, or it is listening on a different port. The config file you included looks like config.json which is used to configure the EMS. Please share your config.lua file.
Moving forward I made some changes to the ports
I am no longer getting errors in EMS or LSR, but I am getting Application errors in Thingworx
Error reading property [thing: TestRemoteThing1, property: TestProperty] Timed out APIRequestMessage [requestId: 340, endpointId: -1, sessionId: -1, method: GET, entityName: TestRemoteThing1, characteristic: Properties, target: TestProperty]
config.json:
{
"ws_servers": [{
"host": "192.168.0.49",
"port": 8080
}
],
"resource": "/Thingworx/WS",
"appKey": "c768f8f9-5501-4680-bebf-ed1bc86131ca",
"logger": {
"level": "INFO",
"publish_level": "INFO",
"max_file_storage": 2000000,
"publish_directory": "logs",
"auto_flush": true,
"flush_chunk_size": 16384,
"buffer_size": 4096
},
"http_server": {
"host": "localhost",
"port": 8000,
"ssl": false,
"authenticate": false,
"content_read_timeout": 20000,
"ports_to_try": 10,
"max_clients": 15,
"use_default_certificate" : true
},
"fips": {
"enabled": false
},
"ws_connection": {
"encryption": "none",
"verbose": false,
"binary_mode": false,
"msg_timeout": 5000,
"ping_rate": 55000,
"pingpong_timeout": 10000,
"connect_period": 60000,
"duty_cycle": 100,
"message_idle_time": 50,
"max_msg_size": 1048576,
"message_chunk_size": 8192,
"max_frame_size": 8192,
"max_messages": 500,
"connect_on_demand": false,
"connect_timeout": 10000,
"connect_retry_interval": 10000,
"max_threads": 4,
"max_connect_delay": 0,
"socket_read_timeout": 100,
"frame_read_timeout": 10000,
"ssl_read_timeout": 500,
"connect_retries": -1
},
"certificates": {
"validate": false,
"allow_self_signed": true
},
"file": {
"virtual_dirs": [
{"logs": "logs"},
{"instruction":"instruction"}
],
"staging_dir": "/home/pi/microserver/staging/staging"
}
}
config.lua
Do you have a file \etc\custom\templates\TestRemoteThing1.lua that is referenced in config.lua
That all looks good to me.
Is the first line of your TestRemoteThing1.lua?
module ("templates.TestRemoteThing1", thingworx.template.extend)
You might try lowering the scanrate from 10 seconds (10000) to 1 second (1000) I am not sure if having the scan rate set to the same value as the timeouts in config.json might be causing a problem.
Thanks
I change the scan rate with no change.
EMS and LSR all look to be running ok now (no errors)
But when I use the "l" in the ems it does not return anything
EMS Log:
pi@raspberrypi:~/microserver $ sudo ./wsems
[FORCE] 2018-06-25 17:24:46,145 ./wsems: Initializing EMS ....
[FORCE] 2018-06-25 17:24:46,145 main: Using config file /home/pi/microserver/etc/config.json
[INFO ] 2018-06-25 17:24:46,145 ./wsems: Creating the WsEms proxy.
[INFO ] 2018-06-25 17:24:46,145 ./wsems: Starting HTTP Server.
[INFO ] 2018-06-25 17:24:46,146 Main: Using built-in certificate for HTTP Server
[WARN ] 2018-06-25 17:24:46,146 Main: Encryption is disabled on HTTP Server.
[WARN ] 2018-06-25 17:24:46,146 Main: Authentication is disabled on the HTTP Server.
[INFO ] 2018-06-25 17:24:46,147 ./wsems: Initializing the ThingWorx REST interface.
[FORCE] 2018-06-25 17:24:46,147 httpServer: starting http server port=8000
[INFO ] 2018-06-25 17:24:46,147 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2018-06-25 17:24:46,147 wsEmsProxy::initialize: Encryption is disabled on Web Socket connection.
[WARN ] 2018-06-25 17:24:46,148 SDK: SDK Version: 2.0.4
[WARN ] 2018-06-25 17:24:46,149 SDK: TLS Library: OpenSSL
[WARN ] 2018-06-25 17:24:46,149 SDK: TLS Library Version: 1.0.2l
[WARN ] 2018-06-25 17:24:46,149 SDK: FIPS Capable
[INFO ] 2018-06-25 17:24:46,165 WsProxy::initialize: EMS Version 5.4.0.114
[INFO ] 2018-06-25 17:24:46,165 WsProxy::initialize: twApi singleton initialized
[WARN ] 2018-06-25 17:24:46,166 WsProxy::initialize: Certificate validation is disabled.
[WARN ] 2018-06-25 17:24:46,166 WsProxy::initialize: Self signed certificates are enabled.
[ERROR] 2018-06-25 17:24:46,167 SDK: twMap_Add: parse function returned null.
[INFO ] 2018-06-25 17:24:46,167 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2018-06-25 17:24:46,169 ./wsems: Starting the connection.
192.168.0.49:8080-->[INFO ] 2018-06-25 17:24:46,196 SDK: twWs_Connect: Websocket connected!
[INFO ] 2018-06-25 17:24:46,279 Main: Succesfully connected. Saving .booted config file
LSR Log:
[INFO ] 2018-06-25 18:03:07,38 ./luaScriptResource: Using config file: /home/pi/microserver/etc/config.lua
[FORCE] 2018-06-25 18:03:07,39 ./luaScriptResource: Starting up ....
[INFO ] 2018-06-25 18:03:07,45 luaScriptResource:main: Encryption is disabled on the RAP connection.
[INFO ] 2018-06-25 18:03:07,45 luaScriptResource:main: FIPS is disabled.
[INFO ] 2018-06-25 18:03:07,48 ./luaScriptResource: New path is /home/pi/microserver/etc/thingworx/clibs:/home/pi/microserver/etc/custom/clibs:/home/pi/microserver/etc/community/clibs:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[WARN ] 2018-06-25 18:03:07,50 ScriptResource::initialize: Encryption is disabled on HTTP Server.
[WARN ] 2018-06-25 18:03:07,51 ScriptResource::initialize: Authentication is disabled on the HTTP Server.
[INFO ] 2018-06-25 18:03:07,85 sample: Registering HTTP callbacks
[INFO ] 2018-06-25 18:03:07,100 sample: Beginning main loop
[FORCE] 2018-06-25 18:03:07,100 httpServer: starting http server port=8001
[INFO ] 2018-06-25 18:03:07,125 thingworx.shape: Creating a new shape.
[INFO ] 2018-06-25 18:03:07,126 TestRemoteThing1: -- Configuration -------------------------------
[INFO ] 2018-06-25 18:03:07,126 TestRemoteThing1: scanRate: 1000
[INFO ] 2018-06-25 18:03:07,126 TestRemoteThing1: scanRateResolution: 500
[INFO ] 2018-06-25 18:03:07,126 TestRemoteThing1: taskRate: 15000
[INFO ] 2018-06-25 18:03:07,126 TestRemoteThing1: keepAliveRate: 60000
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: requestTimeout: 15000
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: registerRate: 43200000
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: register: true
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: getPropertySubscriptionOnReconnect: false
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: maxConcurrentPropertyUpdates: 100
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: defaultPushType: VALUE
[INFO ] 2018-06-25 18:03:07,130 TestRemoteThing1: useShapes: true
[INFO ] 2018-06-25 18:03:07,131 TestRemoteThing1: identifier: Not Specififed
[INFO ] 2018-06-25 18:03:07,131 TestRemoteThing1: ------------------------------------------------
[INFO ] 2018-06-25 18:03:07,133 thingworx.template: Adding shape 'shapes.metadata' to template 'thingworx.template'
[INFO ] 2018-06-25 18:03:07,134 thingworx.template: Adding shape 'shapes.propsubscribe' to template 'thingworx.template'
[INFO ] 2018-06-25 18:03:07,134 TestRemoteThing1: Calling TestProperty Handler Property Functions
[INFO ] 2018-06-25 18:03:07,134 thingworx.template: Creating new templates.TestRemoteThing1 named 'TestRemoteThing1'
[INFO ] 2018-06-25 18:03:07,134 TestRemoteThing1: -- Initializing properties ---------------------
[INFO ] 2018-06-25 18:03:07,143 TestRemoteThing1: Initialized property upToDate [baseType: BOOLEAN, pushType: NEVER, handler: nil, value: true]
[INFO ] 2018-06-25 18:03:07,143 TestRemoteThing1: Initialized property TestProperty [baseType: NUMBER, pushType: NEVER, handler: nil, value: 888]
[INFO ] 2018-06-25 18:03:07,143 TestRemoteThing1: ------------------------------------------------
[INFO ] 2018-06-25 18:03:09,113 TestRemoteThing1: -- Starting script --------------------------
[INFO ] 2018-06-25 18:03:09,113 TestRemoteThing1: Registering core callback handler
[INFO ] 2018-06-25 18:03:09,113 TestRemoteThing1: Starting main loop
[INFO ] 2018-06-25 18:03:09,113 TestRemoteThing1: Calling lifecycle start listeners.
[INFO ] 2018-06-25 18:03:09,113 shapes.propsubscribe: Initialized
But when I look for remote properties in Thingworx I get the:
Error browsing properties. Be sure the remote device/server is connected and configured properly
If I create the property as a remote thing, I am getting error in Application log:
Error reading property [thing: TestRemoteThing1, property: TestProperty] Timed out APIRequestMessage [requestId: 371, endpointId: -1, sessionId: -1, method: GET, entityName: TestRemoteThing1, characteristic: Properties, target: TestProperty]
Not sure where to go with this ….
I am not seeing the problem, can you open a support case to receive more help?
I did open up a case on the issue.
I downgraded to EMS 5.3 as it appears there are bugs in 5.4
The EMS now gets further as it list the remote thing and connects to Thingworx.
But Manage Remote Property Bindings fails.
Error browsing properties. Be sure the remote device/server is connected and configured properly
DEBUG] 2018-06-26 20:16:25,93 SDK: twMessage_Delete: Deleting BIND Message: 2
[ERROR] 2018-06-26 20:16:25,93 SDK: twApi_BindThing: Error sending Bind message
[ERROR] 2018-06-26 20:16:25,92 WsEmsProxy::bindThing: Error binding thing to twApi.
I just tried the latest EMS 5.4.1 release and it is doing the same thing as 5.3
Thanks
Dave