Multi-Customer Access to Devices

Greetings all,

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:

  1. 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?
  2. Are there any pitfalls one should be aware of when assigning a device to multiple customers?

Thanks!
-AD

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.

$ curl -H 'Content-Type: application/json' \
  -d '{"pubkeys": {"KEY1":{}, "KEY2":{}}}' \
   https://mdash.net/api/v2/customers/CUSTOMER_ID?access_token=API_KEY

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.

lsm: thanks for these details, this is helpful

Can you elaborate on this point? I may be seeing this very situation and am trying to diagnose it with a customer.

  1. By factory reset, are you referring to mDashConfigReset()?
  2. Can you explain what a “ghost device” is, i.e. what are the symptoms?
  3. If a customer does initiate mDashConfigReset(), what is the proper way to recover this device so it will connect to WiFi + mDash?

Thank you!
-AD

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.

  1. Yes.
  2. See above.
  3. 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.

OK - makes sense. Thanks!