My current understanding of the mDash infra is that devices are associated with one, and only one, customer by default. That being the case, there are several scenarios where it would be extremely desirable to have a device visible to more than one customer:
Some of my customers own the devices and deploy them at their client’s site. They want to monitor their entire fleet and let individual clients monitor the device(s) installed locally
As the overall fleet admin, I would like to view most/all of the devices in the field from my WebApp at the same time as my customers
It seems that one can manually assign devices to more than one customer in the mDash “Customers” tab. That in mind:
While this works, doing this manually every time seems a bit tedious. Is there a programmatic way by which one could assign a device to multiple customers?
Are there any pitfalls one should be aware of when assigning a device to multiple customers?
Device can be controlled by anyone who has device’s public_key.
You can share that public key to many customers - they all would have access.
mDash UI adds keys to customers using mDash API - so you can do that too.
Per https://mdash.net/docs/api/rest.md, use POST request to the https://mdash.net/api/v2/customers/:id endpoint, e.g.
Once multiple customers possess device’s key, they have the same level of control.
An attention should be paid to handle situations when a device does factory reset and changes its key - all customers would have a ghost device.
Each customer has a collection of keys - which could be empty. A device can change its key, but the old key in a customer’s collection stays. That is what I call a “ghost device”.
A “Customers” tab clearly indicates those ghost keys - it is safe to remove them.
Yes.
See above.
After mDashConfigReset, a device appears like it is unconfigured (shipped to a customer). It keeps its device password, but deletes WIFI credentials and old public key. Just follow usual procedure to set up WiFi name/pass, that’s it.