Forum

Browse topics, discover Works With Legrand community!

X8000 python

Hi, i want read temperature from x8000.

I use this script:

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
# Request headers
‘Ocp-Apim-Subscription-Key’: ‘{subscription key}’,
‘Authorization’: ‘{id token}’,
}

params = urllib.parse.urlencode({
})

try:
conn = http.client.HTTPSConnection(‘api.developer.legrand.com’)
conn.request(“GET”, “/smarther/v2.0/chronothermostat/thermoregulation/addressLocation/plants/{plantId}/modules/parameter/id/value/{moduleId}/measures?%s” % params, “{body}”, headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print(“[Errno {0}] {1}”.format(e.errno, e.strerror))

####################################

i have replaced subscription key and id token with the my.

i have replaced plantId and moduleId with my but end with error 404 resource not found.

Hello Federico,

I don’t know enough about Python to help you with your code. However, we could find this in the documentation for a 404 error on this request : Resource not found/Gateway offline: something is probably wrong in your request URL or your thermostat is temporary disconnected from the network.

So : make sure that your thermostat is correctly connected. If it’s OK, it’s an issue with the way you call the request URL

Have a good day,
Leslie – Community Manager

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Information

message1 reply
people2 participants