Open pherris opened 7 years ago
Few updates from the gitter forum...
1) if mgos_sntp_query fails to fetch the time - we would never be able to authenticate against AWS - from my console above it's not clear if the first attempt failed or not. It almost reads as if the NTP failure was reported after the AWS connection was attempted:
[Sep 26 21:36:19.742] mgos_sntp_query SNTP query to pool.ntp.org
[Sep 26 21:36:19.742] mongoose_poll New heap free LWM: 21016
[Sep 26 21:36:23.196] mongoose_poll New heap free LWM: 20840
[Sep 26 21:36:28.297] mg_resolve_async_eh Failed to resolve 'XXXXXXXXX.iot.us-east-1.amazonaws.com', server 192.168.188.5
[Sep 26 21:36:28.309] mgos_mqtt_ev MQTT Connect (0)
[Sep 26 21:36:28.310] mgos_mqtt_ev MQTT Disconnect
[Sep 26 21:36:28.315] mqtt_global_reconnec MQTT connecting after 2047 ms
[Sep 26 21:36:29.275] mg_resolve_async_eh Failed to resolve 'pool.ntp.org', server 192.168.188.5
[Sep 26 21:36:30.367] mgos_mqtt_global_con MQTT connecting to XXXXXXXXX.iot.us-east-1.amazonaws.com:8883
[Sep 26 21:36:32.659] mgos_sntp_query SNTP query to pool.ntp.org
[Sep 26 21:36:38.112] station: d0:c5:f3:2b:b8:0e leave, AID = 1
2) it was suggested to force use of Google's name servers with mos config-set wifi.sta.nameserver=8.8.8.8
but I'm not sure that the wifi network is the problem because the device does occasionally report data to AWS. For example, after leaving the device last night at 9:45 pm it eventually connected for approximately eight minutes around 5:30 am. NOTE: when it did connect, it sent the same data three times. It also looks like the device had crashed and rebooted about 1.5 hours before sending the data.
I added a range extender to solve my immediate issues but I think there is an underlying problem here with the poor network performance I described above.
I don't think you should make the call to AWS if the call to pool.ntp.org
hasn't returned or fails. I'm not sure why UART would die in this case -but something you guys can look into. I cannot reproduce any longer due to the improved network signal strength so please feel free to close when you deem appropriate.
My device receives data via serial once every second. One of my devices has very poor wifi. Occasionally the device will connect to this weak wifi, receive an IP address, attempt to connect to AWS but hangs with a "failed to connect" error.
The device is receiving the data via serial correctly until this happens, after that, nothing happens over serial until the device is reset.
There seems to be something triggered by the failed AWS connection that kills the UART listener. The only odd thing I'm doing is to only start listening for the serial data after a few seconds so I have a few seconds where I can program the device. My UART code is: