[SOLVED] Send data to my Device (without creating a new one) using GSM

Hello everyone.

I’m trying to send data to my Device variable. Problem is that while the data does go in, it goes to a newly created device called “GPRS”. I want the data to go to an already existing variable in my already existing device.

I’m using the ubidots-gprs-library ubidots-arduino-gprs

Is there a way to accomplish this using the library, if not, then how can I do it?

Hello @Haios,

The Ubidots library assign “GPRS” as device label by default, that’s means if you don’t have one created with the same device label it will created a new one.

If your desire to send data to an already existing device, you have to assign the device label manually into the code adding the line below in the setup of your code, you can reference to the README for more information:

client.setDeviceLabel("New_label");

All the best,
Maria C.

I’ve tried using client.setDeviceName() before, instead of client.setDeviceLabel().
What’s the difference?

I’ll try client.setDeviceLabel() later today

To understand the difference, please see the articles below:

Take in count that is the device is already created you will not able to set the device name using the method of the library. In this case, you have to modify the name manually as is shown in the article above.

All the best,
Maria C.

Thanks for the Help. It worked. I used setDeviceLabel(), and that solved it.

When I was still struggling with it, I actually went into the library itself and changed the_device_label = "GPRS" to _device_label = "myDeviceLabel", that had solved it, but it was not what I wanted. I wanted to change it in code.
I’m a little embarrassed :sweat_smile: that I didn’t notice the variable value I was changing belonged to _device_label and not _device_name. That would have given me a clue as to which function I should use in my code.
Anyway, the library has been returned to its normal state and setDeviceLabel() is the solution.
Thank you very much.

PS: How do I mark this problem as Solved?

We are glad to read that! To mark the topic as solved you have to modify the name of the topic, but don’t worry we already assigned it :wink:

All the best,
Maria C.