Can't connect to mdash

#1

Hi All…

I have gone through the demos and had no trouble connecting to mDash with my esp32 board. I have now written a simple C app but I have been unable to get mDash to see my device. However the logsseem to show success:

[Oct  3 11:18:05.232] mgos_deps_init.c:106    init dash...
[Oct  3 11:18:05.238] mg_rpc.c:539            0x3ffc1b34 'wss://mdash.net/api/v2/rpc' WSS_out
[Oct  3 11:18:05.244] mgos_dash.c:203         Dash init ok, server: wss://mdash.net/api/v2/rpc)

In the mos tool I entered:

mos config-set dash.enable=true device.id=device5 dash.token=redacted

The dashboard just reports “never connected” for the device. I am using a free account so only 3 devices, and I have created and deleted more than that. Currently I have only one device, but could the problem be that I created too many?

#2

After the lines

11:18:05.232] mgos_deps_init.c:106    init dash...
[Oct  3 11:18:05.238] mg_rpc.c:539            0x3ffc1b34 'wss://mdash.net/api/v2/rpc' WSS_out
[Oct  3 11:18:05.244] mgos_dash.c:203         Dash init ok, server: wss://mdash.net/api/v2/rpc)

you should see something like this

[Oct  3 20:19:29.546] mgos_net.c:89           WiFi STA: connected
...
[Oct  3 20:19:29.576] mgos_rpc_channel_ws:261 0x3ffc76bc Connecting to wss://mdash.net/api/v2/rpc, SSL? 1
[Oct  3 20:19:29.714] mg_ssl_if_mbedtls.c:35  0x3ffc80d8 ciphersuite: TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
[Oct  3 20:19:30.218] SW ECDH curve 3
...
[Oct  3 20:19:31.532] mg_rpc.c:293            Sys.GetInfo via WSS_out 148.251.54.236:443

The line numbers in my log are for mos latest. If you are using a different version, they might be different.

Tested with the empty application with the following libs:

libs:
  - origin: https://github.com/mongoose-os-libs/ca-bundle
  - origin: https://github.com/mongoose-os-libs/rpc-service-config
  - origin: https://github.com/mongoose-os-libs/rpc-service-fs
  - origin: https://github.com/mongoose-os-libs/rpc-service-ota
  - origin: https://github.com/mongoose-os-libs/rpc-uart
  - origin: https://github.com/mongoose-os-libs/rpc-ws
  - origin: https://github.com/mongoose-os-libs/wifi
  - origin: https://github.com/mongoose-os-libs/sntp
  - origin: https://github.com/mongoose-os-libs/ota-http-server

  - origin: https://github.com/mongoose-os-libs/dash
#3

Thanks very much…

I didn’t have all those libraries, but I added them, in the same order, still no joy. I don’t see those log entries, rather I see:

[Oct  3 14:46:40.890] mgos_deps_init.c:122    init i2c...
[Oct  3 14:46:40.890] mgos_deps_init.c:122    init atca...
[Oct  3 14:46:40.896] mgos_deps_init.c:122    init ota-http-client...
[Oct  3 14:46:40.902] mgos_deps_init.c:122    init shadow...
[Oct  3 14:46:40.902] mgos_deps_init.c:122    init ota-shadow...
[Oct  3 14:46:40.907] mgos_ota_shadow_lib:102 OTA over shadow initialised
[Oct  3 14:46:40.913] mgos_deps_init.c:122    init wifi...
[Oct  3 14:46:40.913] mgos_wifi.c:458         WiFi mode: AP
[Oct  3 14:46:40.919] esp32_wifi.c:231        cur mode: 0
[Oct  3 14:46:40.926] esp32_wifi.c:196        WiFi mode: AP

Which makes me thing my wifi config is setting the wifi up as an access point instead of a client, and therefore not talking to the cloud. On my phone, I see it listed as an AP. Can it be both an AP and client simultaneously?

From searching, I can’t figure out how to configure it as a station vs an AP.

UPDATE:

I think I figured that out:

mos config-set wifi.sta.enable=true wifi.sta.ssid='Jim LAN' wifi.sta.pass=password

Gives me:

[Oct  3 15:11:00.997] mgos_wifi.c:136         WiFi STA: Connected, BSSID 44:94:fc:61:24:f0 ch 1 RSSI -47
[Oct  3 15:11:01.004] mgos_event.c:135        ev WFI2 triggered 0 handlers
[Oct  3 15:11:01.009] mgos_net.c:89           WiFi STA: connected
[Oct  3 15:11:01.017] mgos_event.c:135        ev NET2 triggered 2 handlers
[Oct  3 15:11:02.233] e[0;32mI (3958) event: sta ip: 192.168.1.23, mask: 255.255.255.0, gw: 192.168.1.1e[0m
[Oct  3 15:11:02.240] mgos_event.c:135        ev WFI3 triggered 0 handlers
[Oct  3 15:11:02.248] mgos_net.c:101          WiFi STA: ready, IP 192.168.1.23, GW 192.168.1.1, DNS 192.168.1.1
[Oct  3 15:11:02.252] mgos_sntp.c:127         SNTP next query in 1017 ms
[Oct  3 15:11:02.258] mgos_event.c:135        ev NET3 triggered 2 handlers
[Oct  3 15:11:03.277] mg_net.c:928            0x3ffbae44 udp://time.google.com:123 -,-,-
[Oct  3 15:11:03.283] mg_net.c:928            0x3ffbaf80 udp://192.168.1.1:53 -,-,-
[Oct  3 15:11:03.289] mg_net.c:796            0x3ffbaf80 udp://192.168.1.1:53
[Oct  3 15:11:03.289] mgos_sntp.c:95          SNTP query to time.google.com
[Oct  3 15:11:03.295] mgos_sntp.c:127         SNTP next query in 2042 ms
[Oct  3 15:11:03.302] mg_net.c:811            0x3ffbaf80 udp://192.168.1.1:53 -> 0
[Oct  3 15:11:03.319] mg_net.c:796            0x3ffbae44 udp://216.239.35.0:123
[Oct  3 15:11:03.319] mg_net.c:811            0x3ffbae44 udp://216.239.35.0:123 -> 0
[Oct  3 15:11:03.325] mgos_sntp.c:48          SNTP sent query to 216.239.35.0
[Oct  3 15:11:03.383] mgos_sntp.c:59          SNTP reply from 216.239.35.0: time 1570129863.770411, local 54.407325, delta 1570129809.363086
[Oct  3 15:11:03.389] mgos_event.c:135        ev MOS3 triggered 2 handlers
[Oct  3 15:11:03.395] mgos_sntp.c:78          SNTP close

Still no connection to mDash though…

#4

Fixed it! Once I got wifi in station mode I was able to run the command to connect to mDash:

mos config-set dash.enable=true device.id=device5 dash.token=redacted

Thanks for your help!

#5

But… where are all these configuration settings saved? I looked around the folders for this test app and couldn’t find it.

#6

The configuration settings are saved in conf9.json on the device.
https://mongoose-os.com/docs/mongoose-os/userguide/configuration.md