Brewskey / spark-server

An API compatible open source server for interacting with devices speaking the spark-protocol
https://www.particle.io/
GNU Affero General Public License v3.0
54 stars 27 forks source link

Claiming / provisioning a devices without an deviceID #296

Open ojna opened 4 years ago

ojna commented 4 years ago

Looking at the official particle api docs you can see that the endpoint POST /v1/devices should be able to both claim a device with id or provision a new device if it's left out and supplied with a product id.

This applies to eg Raspberry Pi. I've been messing around with the code in the dev branch and everything works fine with the Particle Agent for RPI if the endpoints creates an ID and then responds with:

{ "ok": true, "device_id": "new-device-id" }

Once its stored in the database if works fine with the rest of the cli and so on. But i guess we need to make sure the generated id don't collide with other ids later on.

Are there any roadmap to adressing this, or is anyone working on it? Either case i will fix this and with some coordination with this project i can send a pull request with it later on.

jlkalberer commented 4 years ago

Please send a pull request.

ojna commented 4 years ago

I will, but are there any information on my question?

Are there any roadmap to adressing this, or is anyone working on it?

jlkalberer commented 4 years ago

No, I don't have plans on fixing this as it isn't a critical bug

jlkalberer commented 4 years ago

Hey @ojna

I started looking into implementing this but the API is behind the enterprise plan (as far as I can tell). I don't want to pay for it or start a trial.

ojna commented 4 years ago

Hi,

I've done some work on this and will continue this week. Will post a pull request when its ready for some feedback.