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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Raspberry Pi Tutorial - Failing to make connection to Thingworx

rsloma
10-Marble

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.

ACCEPTED SOLUTION

Accepted Solutions
sdidier
17-Peridot
(To:rsloma)

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/517312

 

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
sdidier
17-Peridot
(To:rsloma)

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

rsloma
10-Marble
(To:sdidier)

The logs in the Monitoring section are not visible to me.
rsloma
10-Marble
(To:sdidier)

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.

 

 

rsloma
10-Marble
(To:sdidier)

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.

sdidier
17-Peridot
(To:rsloma)

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/517312

 

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

rsloma
10-Marble
(To:sdidier)

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

Top Tags