mDash smart light example - questions

I’ve been doing some experiments with remote device viewing/management taking inspiration from the mDash smart light example here: GitHub - cesanta/mongoose-os-smart-light: An example of full IOT product based on Mongoose OS

Understand it hasn’t had any changes in a few years, so very likely it’s not a working example anymore - I’ve also seen a few people on the forum not been able to get it to work so if it’s deprecated it would be great to know. If there was a better/newer example that would also be great.

On to my questions:

Firmware endpoints - SOLVED

The code example app seems to reference a couple of device endpoints:

- http://192.168.4.1/GetKey
- http://192.168.4.1/Setup

But the firmware source code seems to have no references to this. I thought maybe it was somehow a built-in endpoint or something but none of my devices are responding by default on either /GetKey or /Setup.

I could probably write it, but I’m unsure what the /GetKey endpoint is returning, since when I’ve tried to add a device to a customer in mDash UI the public key doesn’t seem to work.

Looks like the mDash Arduino library has these two endpoints built in

Device ID - SOLVED

There seem to be a couple of device_id that I think is getting me turned around.

1. first is the mDash has a device ID it creates when a new device is added to mDash, and they follow a sequential number as devices are provisioned in mDash

2. the device configuration has a device_id that seems to have no association with the mDash device id, I’ve been setting these to something unique

From what I can tell by manually adding devices to a customer, mDash is expecting the device ID as per the mDash provisioning process (2), but I don’t understand how that would ever end up on the device. Having been through the device config and built in RPC commands I don’t see it anywhere.

This question seems to be irrelevant - it appears that when using the mDash UI the device_ID required is the one that is auto-generated when enrolling a device. This is not the same process followed by the app.

The app directly updates a customers metadata to include the device public key, which is captured from the physical device using the endpoints described above.

The endpoint used to update the customer metadata described in the mDash doco:

POST	https://mdash.net/customer	{"cconfig": ...}	Update customer's metadata

Customer registration / password management - SOLVED

Looking at the mDash UI I see no way to delete a customer, or change their password. I’m guessing that is part of the POST request made to https://mdash.net/customer but details are light in the doco

Hopefully someone has messed around with this with some success, looks like a nice and easy way for remote device management.

Delete can be done via the Management REST API

Password change flow is same as registration - customer needs to click link in email to activate the new password

I think I’ve found an answer to my firmware endpoints question. Looks like the mDash Arduino library has a couple of endpoints built in that do exactly what is required for the App demo to work:

You can delete a customer, but not through the mDash console. You have to use the Management REST API to do so.

  • You first need to get a list of all customers. Use the GET /customers endpoint to return a list of all customer objects. Then find the “id” of the customer object of interest.
  • To delete a customer, use the DELETE /customers/:id endpoint

A password change needs to be initiated by the customer. I’m not aware of a way to do this from the Management API. You need to provide a means for the customer to call the GET /newcustomer endpoint. This is the same process as registering a new customer.

Hope this helps,
-AD

Thanks for the reply @Autodog, I didn’t know there was an option to reset the password via the same /newcustomer endpoint.

I just tried it for myself:

  1. I followed the register flow and entered the same email address as the one I signed up with
  2. When I got the “sign up” email, the password was still the old one
  3. When I clicked the “activate your account” link, it was at this moment that the new password took effect