Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello,
My problem is when i try to connect my Pi_Thing on the platform i got a message :
Unable to execute service GetRemoteMetadata on piThing !
Config.Json: { "ws_servers": [{ "host": "ptcu-thingworx83-fundamentals.portal.ptc.io", "port": 443 }], "appKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "certificates": { "validate": false }, "http_server" : { "host": "127.0.0.1", "port": 8001, "use_default_certificate" : true, "ssl" : false, "authenticate" : false }, "logger": { "level":"INFO", "publish_directory":"logs", "publish_level":"INFO", "auto_flush":true, "flush_chunk_size": 16384, "buffer_size" : 4096 }, "file": { "virtual_dirs": [ {"logs": "logs"}, {"instruction":"instruction"} ] } }
config.lua:
scripts.log_level = "INFO" scripts.script_resource_ssl = false scripts.script_resource_authenticate = false scripts["PiThing_Ali"] = { file = "thing.lua", template = "PiTemplate", scanRate = 10000 } scripts.rap_host = "127.0.0.1" scripts.rap_port = 8001
Log wmes:
pi@raspberrypi:~/Desktop/microserver $ sudo ./wsems [FORCE] 2019-06-20 21:05:46,583 ./wsems: Initializing EMS .... [FORCE] 2019-06-20 21:05:46,583 main: Using config file /home/pi/Desktop/microserver/etc/config.json [INFO ] 2019-06-20 21:05:46,583 ./wsems: Creating the WsEms proxy. [INFO ] 2019-06-20 21:05:46,583 ./wsems: Starting HTTP Server. [WARN ] 2019-06-20 21:05:46,584 Main: Encryption is disabled on HTTP Server. [WARN ] 2019-06-20 21:05:46,584 Main: Authentication is disabled on the HTTP Server. [INFO ] 2019-06-20 21:05:46,584 ./wsems: Initializing the ThingWorx REST interface. [FORCE] 2019-06-20 21:05:46,584 httpServer: [INFO ] 2019-06-20 21:05:46,584 wsEmsProxy::initialize: FIPS is disabled. [INFO ] 2019-06-20 21:05:46,585 wsEmsProxy::initialize: Encryption is enabled on Web Socket connection. [WARN ] 2019-06-20 23:05:46,586 SDK: SDK Version: 2.2.0 [WARN ] 2019-06-20 23:05:46,587 SDK: TLS Library: OpenSSL [WARN ] 2019-06-20 23:05:46,587 SDK: TLS Library Version: 1.0.2l-fips [WARN ] 2019-06-20 23:05:46,587 SDK: FIPS Capable [INFO ] 2019-06-20 21:05:46,645 WsProxy::initialize: EMS Version 5.4.5.512 [INFO ] 2019-06-20 21:05:46,645 WsProxy::initialize: twApi singleton initialized [WARN ] 2019-06-20 21:05:46,646 WsProxy::initialize: Certificate validation is disabled. [INFO ] 2019-06-20 21:05:46,647 wsEmsProxy::initialize: Initialization complete! [INFO ] 2019-06-20 21:05:46,648 ./wsems: Starting the connection. ptcu-thingworx83-fundamentals.portal.ptc.io:443-->[INFO ] 2019-06-20 23:05:47,148 SDK: Server supports websocket extensions: permessage-deflate [INFO ] 2019-06-20 23:05:47,148 SDK: twWs_Connect: Websocket connected! [INFO ] 2019-06-20 21:05:47,456 Main: Succesfully connected. Saving .booted config file [INFO ] 2019-06-20 21:05:47,459 EMS: Duty Cycle is disabled. [WARN ] 2019-06-20 21:05:52,570 WsEmsProxy::bindThing: Exception connecting to localhost:8001. Err: Connection refused [localhost:8001] [WARN ] 2019-06-20 21:05:52,571 WsEmsProxy::bindThing: Changing host from 'localhost' to '127.0.0.1' [INFO ] 2019-06-20 21:05:52,845 WsEmsProxy::registerVirtualDirs: Adding virtual dir logs: /home/pi/Desktop/microserver/logs [INFO ] 2019-06-20 21:05:52,846 WsEmsProxy::registerVirtualDirs: Adding virtual dir instruction: /home/pi/Desktop/microserver/instruction [WARN ] 2019-06-20 23:05:53,966 SDK: InfoTable precheck: Name "reason" not found in datashape "(null)" [WARN ] 2019-06-20 23:06:02,606 SDK: InfoTable precheck: Name "reason" not found in datashape "(null)"
log lua:
pi@raspberrypi:~/Desktop/microserver $ sudo ./luaScriptResource [INFO ] 2019-06-20 21:05:50,511 ./luaScriptResource: Using config file: /home/pi/Desktop/microserver/etc/config.lua [FORCE] 2019-06-20 21:05:50,512 ./luaScriptResource: Starting up .... [INFO ] 2019-06-20 21:05:50,517 luaScriptResource:main: Encryption is disabled on the RAP connection. [INFO ] 2019-06-20 21:05:50,517 luaScriptResource:main: FIPS is disabled. [INFO ] 2019-06-20 21:05:50,520 ./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 ] 2019-06-20 21:05:50,524 ScriptResource::initialize: Encryption is disabled on HTTP Server. [WARN ] 2019-06-20 21:05:50,525 ScriptResource::initialize: Authentication is disabled on the HTTP Server. [FORCE] 2019-06-20 21:05:50,548 httpServer: starting http server port=8001 [ERROR] 2019-06-20 21:05:50,550 httpserver: Server socket error: Address already in use [127.0.0.1:8001] [ERROR] 2019-06-20 21:05:50,550 httpServer: unable to bind http server to port=8001, trying next port. [ERROR] 2019-06-20 21:05:50,550 httpServer: unable to bind http server to any port from 8001 to 8001. [INFO ] 2019-06-20 21:05:50,565 thingworx.shape: Creating a new shape. [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: -- Configuration ------------------------------- [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: scanRate: 10000 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: scanRateResolution: 500 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: taskRate: 15000 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: keepAliveRate: 60000 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: requestTimeout: 15000 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: registerRate: 43200000 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: register: true [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: getPropertySubscriptionOnReconnect: false [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: maxConcurrentPropertyUpdates: 100 [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: defaultPushType: VALUE [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: useShapes: true [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: identifier: Not Specififed [INFO ] 2019-06-20 21:05:50,566 PiThing_Ali: ------------------------------------------------ [INFO ] 2019-06-20 21:05:50,568 thingworx.template: Adding shape 'shapes.metadata' to template 'thingworx.template' [INFO ] 2019-06-20 21:05:50,568 thingworx.template: Adding shape 'shapes.propsubscribe' to template 'thingworx.template' [INFO ] 2019-06-20 21:05:50,569 thingworx.template: Creating new templates.PiTemplate named 'PiThing_Ali' [INFO ] 2019-06-20 21:05:50,569 PiThing_Ali: -- Initializing properties --------------------- [INFO ] 2019-06-20 21:05:50,569 PiThing_Ali: Initialized property upToDate [baseType: BOOLEAN, pushType: NEVER, handler: nil, value: true] [INFO ] 2019-06-20 21:05:50,570 PiThing_Ali: Initialized property cpu_volt [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0] [INFO ] 2019-06-20 21:05:50,574 PiThing_Ali: Initialized property cpu_temperature [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0] [INFO ] 2019-06-20 21:05:50,574 PiThing_Ali: Initialized property cpu_freq [baseType: NUMBER, pushType: ALWAYS, handler: nil, value: 0] [INFO ] 2019-06-20 21:05:50,574 PiThing_Ali: ------------------------------------------------ [INFO ] 2019-06-20 21:05:52,543 PiThing_Ali: -- Starting script -------------------------- [INFO ] 2019-06-20 21:05:52,543 PiThing_Ali: Registering core callback handler [INFO ] 2019-06-20 21:05:52,544 PiThing_Ali: Starting main loop [INFO ] 2019-06-20 21:05:52,544 PiThing_Ali: Calling lifecycle start listeners. [INFO ] 2019-06-20 21:05:52,544 shapes.propsubscribe: Initialized [INFO ] 2019-06-20 21:05:52,545 thingworx.handler: Creating a new handler. [INFO ] 2019-06-20 21:05:52,846 PiThing_Ali: MicroServer is now available. [INFO ] 2019-06-20 21:05:52,846 PiThing_Ali: MicroServer is online. [INFO ] 2019-06-20 21:05:52,846 PiThing_Ali: Successfully registered PiThing_Ali with MicroServer. [INFO ] 2019-06-20 21:05:53,116 PiThing_Ali: GetPropertySubscriptions called. 3 properties updated. [INFO ] 2019-06-20 21:05:53,116 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:05:53,125 [PiTemplate]: temp 44.0 [INFO ] 2019-06-20 21:05:53,126 [PiTemplate]: raw freq frequency(45)=1200000000 [INFO ] 2019-06-20 21:05:53,126 [PiTemplate]: scaled freq 1200 [INFO ] 2019-06-20 21:05:53,127 [PiTemplate]: raw volts volt=1.2375V [INFO ] 2019-06-20 21:05:53,127 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:06:09,272 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:06:09,293 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:06:09,293 [PiTemplate]: raw freq frequency(45)=600000000 [INFO ] 2019-06-20 21:06:09,293 [PiTemplate]: scaled freq 600 [INFO ] 2019-06-20 21:06:09,294 [PiTemplate]: raw volts volt=1.2000V [INFO ] 2019-06-20 21:06:09,294 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:06:25,173 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:06:25,190 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:06:25,191 [PiTemplate]: raw freq frequency(45)=600000000 [INFO ] 2019-06-20 21:06:25,191 [PiTemplate]: scaled freq 600 [INFO ] 2019-06-20 21:06:25,194 [PiTemplate]: raw volts volt=1.2000V [INFO ] 2019-06-20 21:06:25,194 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:06:41,40 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:06:41,56 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:06:41,60 [PiTemplate]: raw freq frequency(45)=600000000 [INFO ] 2019-06-20 21:06:41,60 [PiTemplate]: scaled freq 600 [INFO ] 2019-06-20 21:06:41,63 [PiTemplate]: raw volts volt=1.2000V [INFO ] 2019-06-20 21:06:41,63 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:06:57,397 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:06:57,406 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:06:57,408 [PiTemplate]: raw freq frequency(45)=1200000000 [INFO ] 2019-06-20 21:06:57,408 [PiTemplate]: scaled freq 1200 [INFO ] 2019-06-20 21:06:57,411 [PiTemplate]: raw volts volt=1.2375V [INFO ] 2019-06-20 21:06:57,411 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:07:13,1 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:07:13,21 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:07:13,21 [PiTemplate]: raw freq frequency(45)=600000000 [INFO ] 2019-06-20 21:07:13,22 [PiTemplate]: scaled freq 600 [INFO ] 2019-06-20 21:07:13,22 [PiTemplate]: raw volts volt=1.2000V [INFO ] 2019-06-20 21:07:13,23 [PiTemplate]: scaled volts 1.2 [INFO ] 2019-06-20 21:07:29,397 [PiTemplate]: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In tasks.refreshProperties~~~~~~~~~~~~~ [INFO ] 2019-06-20 21:07:29,420 [PiTemplate]: temp 42.9 [INFO ] 2019-06-20 21:07:29,420 [PiTemplate]: raw freq frequency(45)=600000000 [INFO ] 2019-06-20 21:07:29,420 [PiTemplate]: scaled freq 600 [INFO ] 2019-06-20 21:07:29,420 [PiTemplate]: raw volts volt=1.2000V [INFO ] 2019-06-20 21:07:29,421 [PiTemplate]: scaled volts 1.2
Ari,
First thing I would check is permissions. Does the user who is assigned to that application key have permissions to execute GetRemoteMetadata on PiThing?
Next, validate that the EMS itself is working. From your log, it appears to have connected successfully. You have virtual directories - are you able to browse them using the RemoteThingWithFileTransfer services?
This issue may be with the server at ptcu-thingworx83-fundamentals.portal.ptc.io. As a Thingworx Academic user, you don't have full administrative privileges like you would if you had your own system. That system was designed so you could complete the labs in the Thingworx Fundamentals online course, which doesn't include connecting to an AlwaysOn(tm) agent in this manner.
-->Adam
I just wanted to follow up to see if previous response was helpful for your question?
If so, please indicate the appropriate response as the Accepted Solution for the benefit of other Community members who have the same question. If you are still experiencing issues, please do let us know your questions or concerns.
Thanks,
Vibhuti