How to add the device token without the mos tool

#1

Hi!

My name is Arturo from Madrid, Spain :slight_smile:

I checked the documentation and GitHub to see if I could find any examples but I couldn’t find anything about adding the token to the ESP8266 device with Mongoose OS to link it to mDash.
I explain the steps:

  • The user plugs in the ESP8266 by usb
  • Select your wifi from your phone and open a landing. Connects it to the Internet.
  • At this point from a request from the app created by me the user can create the device in mDash and receives the token in the response. But now how can I send it to the real device?
    I see this point something is blocking or I don’t raise it well.
    Any advice?

Thank you very much!

Regards, Arturo.

#2

Run mos config-set dash.enable=true dash.token=DEVICE_TOKEN.

#3

Thanks nliviu!

But as I say I can’t use the mos tools because this is for a non-technical user.

regards, Arturo.

#4

AFAIK, that’s the only way.
Or you can configure it before sending the device to the user.

#5

Okay, I figured that when I didn’t find anything.

Thanks nliviu!

Regards, Arturo.

#6

Unconfigured device creates a WiFi access point.

Your phone app should join that AP and send a HTTP request to 192.168.4.1 to configure a device. See https://github.com/mongoose-os-libs/wifi-setup-web-ui/blob/master/fs/index.html for an example.

#7

Thanks Ism.

For wifi I have it covered but to create a device in mDash, receive a token in response and assign it automatically I have not seen how to do it.
I understand that I could modify wifi-setup-web-ui or create a similar one for this…

Thank you!

#8

Both wifi settings and dash token settings can be changed via the same API - see example.

#9

Thank you very much Ism :slight_smile: