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

Raspberry Pi Tutorial - Failing to make connection to Thingworx

SOLVED
Highlighted
Regular Member

Raspberry Pi Tutorial - Failing to make connection to Thingworx

When attempting to update the Thing humidity and temperature properties in Thingworx the python program is failing to make a new connection. The following error occurs.

 

HTTPSConnectionPool(host='thing-server-qa.rd1.thingworx.io', port=8443): Max retries exceeded with url: /Thingworx/Things/RaspberryPi1(5305843aa530edef)/Properties/*?verify=False (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75f5e830>: Failed to establish a new connection: [Errno 110] Connection timed out',))

 

I have used Postman to test the HTTP put command for the REST API and obtain a status of 200 OK so I know the information being sent to Thingworx server is correct. However, even then the property values are not being updated. For the python program I have verified that the Thing name and app key are correct.

 

So I believe this may point to two issues:

  • Issue with python program establishing connection to Thingworx server
    • Doesn't appear to be an authentication issue.
    • Content type in header is correctly set to application/json.
  • Updating property values even though response is OK.

 

Any guidance would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Hello rsloma,

 

I suppose that it is due to this settings to enable :

https://community.ptc.com/t5/PTC-Academic-Program-Discussions/Thingworx-Trial-REST-API-failed/td-p/5...

 

I think that's in Trial instance, this setting is switch off and it cannot be switch on for some security reasons.

 

Best regards,

Samuel

View solution in original post

6 REPLIES 6
Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Hello rsloma,

 

When running the Python program, do you have a look to log files in Thingworx  ?

 

If a problem occured in Thingworx, it will be quick and accurate to identify it with a verbose in log files, specialy in SecurityLog.log and in ApplicationLog.log files.

 

Best regards,

Samuel

Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

The logs in the Monitoring section are not visible to me.
Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Code snippets follow.

 

thing = 'RaspberryPi1(5305843aa530edef)'
url = 'https://thing-server-qa.rd1.thingworx.io:8443/Thingworx/Things/' + thing + '/Properties/*?verify=False'
headers = {'Content-Type': 'application/json', 'appKey': 'xxx'}

...

payload = '{\"Prop_Humidity\":' + '{0:.1f}'.format(humidity) + ', \"Prop_Temperature\":' + '{0:.1f}'.format(temperature) + '}'

response = requests.put(url, headers=headers, json=payload)
print(response.text.encode('utf8'))

-------------------------------

HTTPS response is the timeout shown in the original message.

 

 

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Attached is a screen capture of attempting to connect via Postman.

Receive back a status of 200 OK.

However, the Thing property values do not update.

Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Hello rsloma,

 

I suppose that it is due to this settings to enable :

https://community.ptc.com/t5/PTC-Academic-Program-Discussions/Thingworx-Trial-REST-API-failed/td-p/5...

 

I think that's in Trial instance, this setting is switch off and it cannot be switch on for some security reasons.

 

Best regards,

Samuel

View solution in original post

Highlighted

Re: Raspberry Pi Tutorial - Failing to make connection to Thingworx

Thanks for the answer. I don't have access to be able to change the Platform Subsystem settings, so I cannot complete this project. That's too bad since I was looking forward to it.

Announcements
Join an
AR Working Group!

Topics available:
AR/VR for Data Optimization AR/VR for Security and Control AR/VR for Inspection