[SOLVED] I get Wrong Data from Getvalue Function?


#1

i want to keep getting value from On off button in the website to Switch LED status but when i print value to check. it send me wrong value

for example if i click On to Off it will show me 1 1 1 0 1 1 1 1 1 1 …

which is wrong t should be all 0 after switching

Anyone have idea why ? Thank you!

from ubidots import ApiClient
import time

api = ApiClient(token=“Test”)
variable = api.get_variable(“MyID…”)

while True:
last_value = variable.get_values(1)
print last_value[0][“value”]
time.sleep(5)


#2

Dear user @NiceGuy,

By the moment we recommend to our users, used the Request Python Library to send/retrieve data to/from the platform instead of the Ubidots Library; the Ubidots Libraries needs some improvements in order to ensure the right functionality of it.

Please, reference to the article below to learn how to build the request to Ubidots using Requests:

Also, you can reference to the Ubidots REST API for any doubt about the structures of the requests.

I hope this would help you, let us know if you have any question.

All the best,
Maria C.