[SOLVED] Cannot open variable

Hello there.

I did a small program just to test what Ubidots does.

When I run this program:

I get this error:

python activity.py my.key
Exception: Resource responseed not found:

And the error is in this line:

activity_variable = api.get_variable(‘5403aaa0762542222dd0d025’)

I wonder what I am doing wrong, the variable that I see in the Ubidots App has this ID.

Thanks,
Nelson.-

Hi Nelson,

Thank you for your interest in Ubidots. Please keep in mind the Ubidots has the following structure:

  • Data Source or Sources = It is a equipment to transmit, can be a raspberry pi, arduino or other source that groups variables
  • Variable = It is a group of values in time that describe the physical phenomena you are measuring; like a temperature, humidity, energy, etc.

It seems that you are trying to send time-series values to your data source ID, not a variable. Your should click on the data source and then create a variable, then retrieve the ID of this variable.

Best,

Ubidots Team

This solved the issue. Now I can see the activity of my computer here:

http://app.ubidots.com/ubi/datasources/#/detail/5403aaa0762542222dd0d025/variable/54226e8b76254257f037b39e

I assume I do not have to keep the variable ID secret, only the API key.

Thanks!

BTW, I could not save the timestamp.

I tried this, and I got a fixed timestamp set in 1970.

activity_variable.save_values([{‘timestamp’: int(time.time()), ‘value’: busy_percent}])

Hi @nelson

As discussed before, the timestamp should be in milliseconds.