Stuck on Connecting

A previously working Tidbyt has now become stuck on the Connecting message. We are connected to a Meraki network in the office with 2.4GHz capability enabled. I have tried connecting via the Android app, but it cannot be seen. The app had previously connected.

My phone is on the SBG_IoT wifi network and the device seems to be holding it’s previous SBG_Mobile network. Any thoughts on how I can get it to connect to the correct network (SBG_IoT) and to link to my phone app?

Diagnostics data:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7780
load:0x40078000,len:14292
load:0x40080400,len:3688
entry 0x40080678
I (27) boot: ESP-IDF 4.3.0 2nd stage bootloader
I (27) boot: compile time 19:44:18
I (27) boot: chip revision: 3
I (30) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (46) boot.esp32: SPI Flash Size : 8MB
I (51) boot: Enabling RNG early entropy source...
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00005000
I (75) boot:  1 otadata          OTA data         01 00 0000e000 00002000
I (82) boot:  2 app0             OTA app          00 10 00010000 003f0000
I (89) boot:  3 app1             OTA app          00 11 00400000 003f0000
I (97) boot: End of partition table
I (101) boot_comm: chip revision: 3, min. application chip revision: 0
I (108) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=50290h (328336) map
I (241) esp_image: segment 1: paddr=000602b8 vaddr=3ffbdb60 size=0509ch ( 20636) load
I (249) esp_image: segment 2: paddr=0006535c vaddr=40080000 size=0acbch ( 44220) load
I (268) esp_image: segment 3: paddr=00070020 vaddr=400d0020 size=ec668h (968296) map
I (634) esp_image: segment 4: paddr=0015c690 vaddr=4008acbc size=1525ch ( 86620) load
I (671) esp_image: segment 5: paddr=001718f4 vaddr=50000000 size=00010h (    16) load
I (688) boot: Loaded app from partition at offset 0x10000
I (689) boot: Disabling RNG early entropy source...
I (700) psram: This chip is ESP32-D0WD
I (701) spiram: Found 64MBit SPI RAM device
I (701) spiram: SPI RAM mode: flash 40m sram 40m
I (706) spiram: PSRAM initialized, cache is in low/high (2-core) mode.
I (713) cpu_start: Pro cpu up.
I (717) cpu_start: Starting app cpu, entry point is 0x40082b1c
I (0) cpu_start: App cpu up.
I (756) cpu_start: Pro cpu start user code
I (756) cpu_start: cpu freq: 160000000
I (756) cpu_start: Application information:
I (758) cpu_start: Project name:     tidbyt
I (763) cpu_start: App version:      23989
I (768) cpu_start: Compile time:     Feb  9 2023 18:29:04
I (774) cpu_start: ELF file SHA256:  0ee84cf21ffd90f2...
I (780) cpu_start: ESP-IDF:          4.4.1
I (785) heap_init: Initializing. RAM available for dynamic allocation:
I (792) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (798) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (804) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (810) heap_init: At 3FFC84D8 len 00017B28 (94 KiB): DRAM
I (817) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (823) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (829) heap_init: At 4009FF18 len 000000E8 (0 KiB): IRAM
I (836) spiram: Adding pool of 4095K of external SPI memory to heap allocator
I (844) spi_flash: detected chip: gd
I (848) spi_flash: flash io: dio
I (853) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (862) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (882) tidbyt: Entering state BOOT (1).
I (882) tidbyt/boot: Initializing high-resolution timers...
I (882) tidbyt/boot: Initialized high-resolution timers.
I (882) tidbyt: free memory - exec: 124608, internal: 207067, DMA: 207067, malloc: 4367799
I (892) gpio: GPIO[15]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 
I (902) tidbyt/boot: Initializing non-volatile storage...
I (892) tidbyt: memory low watermark - exec: 124608, internal: 203031, DMA: 203031, malloc: 4363443
I (952) tidbyt/boot: Initialized non-volatile storage.
I (952) tidbyt/boot: Initializing configuration system...
I (962) tidbyt/boot: Initialized configuration system.
I (962) tidbyt/boot: ESP chip model: 1
I (962) tidbyt/boot: ESP silicon revision: 3 
I (972) tidbyt/boot: ESP flash size: 8388608
I (972) tidbyt/boot: Build environment: tidbyt-v10
I (982) tidbyt/boot: Hardware rev 0x00
I (982) system_api: Base MAC address is not set
I (992) system_api: read default base MAC address from EFUSE
I (992) tidbyt/boot: Bluetooth MAC: 083AF204A9CE
I (1002) tidbyt/boot: Initializing display...
I (1012) gpio: GPIO[21]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1012) gpio: GPIO[23]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1022) gpio: GPIO[2]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1032) gpio: GPIO[4]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1042) gpio: GPIO[22]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1052) gpio: GPIO[27]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1062) gpio: GPIO[33]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1072) gpio: GPIO[19]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1082) gpio: GPIO[32]| InputEn: 1| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1102) tidbyt/display_queue: Display for rev 0, RGB=2,0,1
I (1102) tidbyt/boot: Initialized display.
I (1102) tidbyt/sprites: Loading sprite 0 from asset (2806 bytes)
I (1112) tidbyt/boot: Initializing wifi...
I (1112) tidbyt/display_queue: Updating screen duration to 15000ms
I (1132) wifi:wifi driver task: 3ffdf448, prio:23, stack:6656, core=0
I (1172) wifi:wifi firmware version: 63017e0
I (1172) wifi:wifi certification version: v7.0
I (1182) wifi:config NVS flash: enabled
I (1182) wifi:config nano formating: disabled
I (1182) wifi:Init data frame dynamic rx buffer num: 32
I (1182) wifi:Init management frame dynamic rx buffer num: 32
I (1192) wifi:Init management short buffer num: 32
I (1202) wifi:Init static tx buffer num: 16
I (1202) wifi:Init tx cache buffer num: 32
I (1202) wifi:Init static rx buffer size: 1600
I (1212) wifi:Init static rx buffer num: 8
I (1212) wifi:Init dynamic rx buffer num: 32
I (1242) wifi_init: tcpip mbox: 32
I (1242) wifi_init: udp mbox: 6
I (1242) wifi_init: tcp mbox: 6
I (1242) wifi_init: tcp tx win: 5744
I (1242) wifi_init: tcp rx win: 5744
I (1252) wifi_init: tcp mss: 1440
I (1252) wifi_init: WiFi/LWIP prefer SPIRAM
I (1252) wifi_init: WiFi IRAM OP enabled
I (1262) wifi_init: WiFi RX IRAM OP enabled
I (1262) tidbyt/boot: Initialized wifi.
I (1272) tidbyt/boot: Wifi MAC: 083af204a9cc
I (1272) tidbyt/boot: Initializing Bluetooth...
I (1312) BTDM_INIT: BT controller compile version [5688ed5]
I (1322) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (1802) tidbyt/boot: Initialized UART.
I (1802) tidbyt/boot: Initializing I2C...
I (1802) tidbyt/boot: Initialized I2C...
I (1832) tidbyt/boot: ATCA serial: 012322fc01dcb784ee
I (1912) tidbyt: Entering state CONNECT (3).
I (1912) tidbyt/ble: Not sending event (2) since no peer connected
I (1912) tidbyt: free memory - exec: 56976, internal: 58399, DMA: 58399, malloc: 4153443
I (1922) tidbyt: memory low watermark - exec: 56976, internal: 58095, DMA: 58095, malloc: 4140235
I (1912) tidbyt/connect: Configuring wifi network: SBG_Mobile
I (1942) tidbyt/cloud: using device status topic: /devices/obscenely-sincere-staunch-cormorant-c2a/state
I (1942) tidbyt/cloud: using heartbeat topic: /devices/obscenely-sincere-staunch-cormorant-c2a/events/heartbeat
I (1952) tidbyt/crypto: Parsed private key with bit length 256.
I (1962) tidbyt/crypto: Using ECDSA with public key:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERqxEvR8RidD5jJSoA3Ru82uEeh/P
2FzF9SuJUKgsqze+NxcSIgLRzla6Lu2y6x5pGPTq38pIt3ls3le7/deE5A==
-----END PUBLIC KEY-----

I (2012) wifi:mode : sta (08:3a:f2:04:a9:cc)
I (2012) wifi:enable tsf
I (2012) tidbyt/wifi: SYSTEM_EVENT_STA_START wifi connecting...
I (2012) tidbyt/sprites: Loading sprite 3 from asset (29868 bytes)
I (2042) tidbyt/ble: Not sending event (3) since no peer connected
I (2052) wifi:new:<11,0>, old:<1,0>, ap:<255,255>, sta:<11,0>, prof:1
I (2052) wifi:state: init -> auth (b0)
I (2062) wifi:state: auth -> assoc (0)
I (2072) wifi:state: assoc -> run (10)
I (2102) wifi:connected with SBG_Mobile, aid = 1, channel 11, BW20, bssid = 02:8d:db:7b:3a:ae
I (2102) wifi:security: WPA2-PSK, phy: bgn, rssi: -51
I (2152) wifi:pm start, type: 1

I (2152) tidbyt/wifi: SYSTEM_EVENT_STA_CONNECTED connected...
I (2162) tidbyt/wifi: SYSTEM_EVENT_STA_GOT_IP IP assigned...
I (2162) tidbyt/ble: Not sending event (5) since no peer connected
I (2162) esp_netif_handlers: sta ip: 10.200.84.10, mask: 255.255.255.0, gw: 10.200.84.1
I (2172) tidbyt/ble: Not sending event (6) since no peer connected
I (2222) tidbyt/connect: Downloading connection profile from: https://connect.tidbyt.com?deviceID=obscenely-sincere-staunch-cormorant-c2a
I (2862) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (4762) tidbyt/connect: Received connection profile:
{"mqtt":{"uri":"mqtts://mqtt.tidbyt.com:443"}, "certs":{"version":"0bbf9718baf0a12592ea8a6e5175b4c2451134793fdfc95108de66eceab0bf09", "path":"/certs/0bbf9718baf0a12592ea8a6e5175b4c2451134793fdfc95108de66eceab0bf09"}, "timestamp":"2023-03-02T09:08:33Z"}

I (4802) tidbyt/cloud: Setting time to: 1677748113
I (4832) tidbyt/connect: Downloading certificate bundle from: https://connect.tidbyt.com/certs/0bbf9718baf0a12592ea8a6e5175b4c2451134793fdfc95108de66eceab0bf09?format=ESP_CRT
I (7572) tidbyt/connect: Downloaded 8120-byte certificate bundle
I (8002) tidbyt/cloud: Connecting to MQTT at mqtts://mqtt.tidbyt.com:443 with client ID: projects/tidbyt/locations/us-central1/registries/prod/devices/obscenely-sincere-staunch-cormorant-c2a
W (9422) MQTT_CLIENT: Connection refused, not authorized
E (9422) tidbyt/cloud: MQTT_EVENT_ERROR
E (9422) MQTT_CLIENT: MQTT connect failed
E (9432) tidbyt/cloud: MQTT_EVENT_DISCONNECTED
I (31932) tidbyt: free memory - exec: 35072, internal: 36387, DMA: 36387, malloc: 2491863
I (31932) tidbyt: memory low watermark - exec: 28164, internal: 29271, DMA: 29271, malloc: 2420319

I do not understand why, but this is now resolved. After many attempts over a couple of days the device connected and then the app connected.

The only change between attempts today and yesterday is that I disconnected and reconnected Bluetooth on my phone several times.

That said, if anyone wants to know why it worked, all I can say is “a wizard did it”. I have no better explanation.