Hi there - my project is an Arduino micro controller that senses water temperatures in a Solar Heating System to operate a valve that allows water to flow from solar pods to a swimming pool. It has been operating successfully for several years. Data is sent over the internet to the Xively service fro remote monitoring and analysis.
Recently, I have been looking for a better dashboard service and tried Ubidots. I am enjoying the experience and thinking of converting my devices from Xively. To that end I successfully added a simple function in my code to send data to the Ubidots service. It works just fine from an existing Arduino test device using 5 variables and the Ubidots library for Arduino.
Now I want to replicate the entire device to Ubidots for a second, production deployment version. Is there a quick way to create a second clone of the device in Ubidots … obviously with a unique ID but with exact same sensors?
I originally posted this question on the the interactive chatline and got the following response from David:
"That’s actually a great idea, we don’t have that feature to clone a Device but I’ll add that to the roadmap.
Now, a good way to do that meanwhile could be creating a script in Python (or the language you prefer) to extract information from your actual Device and then creating another Device with that extracted information. You could use our HTTP API for that."
I don’t fully understand this answer but this sounds like I might need to code a stand-alone tool of some kind to extract data and then replicate it. Or I might have to hack the UbidotsEthernet library and I would rather keep things standard and simple. So, I also read quite a lot of the online documentation and the following item seemed quite promising:
FAQs and Troubleshooting > Where can I find the Variable ID? - which says:
"… The benefits of using labels are:
If you have thousands of devices, you can flash the same firmware to all. Just make sure you use a unique ID for the device API label (for example the MAC address or Serial number of the device)."
Other entries in the various FAQs and API documentation also seem to imply that devices/variables will be created automatically if you supply Ubidots with a unique Token. For example, in the REST API Reference, under Send Values it states, “If the specified Device or variables do not exist, they will be automatically created.”
So, with these fragments of information I went ahead and created a new TOKEN for my second device but left all the variables defined the same as the original. The response from Ubidots is:
Posting your variables
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 17 May 2017 15:01:28 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Vary: Accept, Cookie
Allow: POST, OPTIONS
6e
[{“status_code”: 201}, {“status_code”: 201}, {“status_code”: 201}, {“status_code”: 201}, {“status_code”: 201}]
0
As you can see the 5 variables being sent do not seem to be authorised (201) - I guess since I hadn’t created them manually under the new Token/Device ID. So the variables were not ‘created automatically’.
In summary, I am pretty confident that if I manually created an entirely new device with unique variables then the data would flow. However, I am looking for a simpler solution particularly to support the cloning of existing devices to newly deployed sites where I can then monitor the sensors.
Many thanks for your interest and support.