LTE - Project Fi - Data Only - Coverage Available - Unable To Connect
Sn3akyP3t3 last edited by
I live in a rural area where networking is utterly miserable. Fortunately there still is LTE coverage of 2x bars in my area. I've had a total of 3x phones on the Project Fi network without failure so I know it works in this area quite well. I've never tried the data only stuff though so I don't have much experience with that so far, but it should be the same provider connection stuffs. Unfortunately, I can't get this Gpy unit to connect when using the data only SIM.
What is weird is that I accidentally ordered a non-data only SIM from Google not knowing my mistake. Before activating the SIM card I plopped it in the Gpy and modeled some code from this forum post.
from network import LTE import time import pycom import urequests import time pycom.heartbeat(False) time.sleep(5) lte = LTE() def attachLte(): # https://forum.pycom.io/topic/3446/any-success-with-gpy-on-t-mobile-nb-iot-in-us-maybe-with-twilio/4 time.sleep(5) if not lte.isattached(): print("Attaching to h2g2") lte.attach(apn='h2g2') time.sleep(.2) def connectLte(): for idx in range(10): time.sleep(0.05) if not lte.isconnected() and idx != 9: print("lte.ue_coverage(): " + str(lte.ue_coverage())) blinkLedSingleColor() if(lte.ue_coverage()): print("LTE reconnection attempt") lte.connect() time.sleep(1) break else: break def blinkLedSingleColor(argLedColor=0x7f0000): pycom.rgbled(argLedColor) time.sleep(0.25) pycom.rgbled(0x000000) # off time.sleep(0.25) pycom.rgbled(argLedColor) time.sleep(0.25) pycom.rgbled(0x000000) # off time.sleep(0.25) pycom.rgbled(argLedColor) time.sleep(0.25) pycom.rgbled(0x000000) # off def main(): attachLte() while True: time.sleep(0.05) connectLte() if(lte.ue_coverage()): pycom.rgbled(0x007f00) #green break main() r = urequests.get('http://jsonplaceholder.typicode.com/albums/1') print(r) print(type(r)) print(r.content) print(r.text) print(r.content) print(r.json()) # It's mandatory to close response objects as soon as you finished # working with them. On MicroPython platforms without full-fledged # OS, not doing so may lead to resource leaks and malfunction. r.close()
When I had the non data only SIM in the Gpy I got lte.ue_coverage() to return True. Of course since I didn't activate the SIM card it failed to connect, but the point is that this card indicated it saw LTE coverage. I went ahead and got the correct data only SIM and activated it in my phone. However, when I put it in the Gpy and fired it up I'm getting nothing but False from lte.ue_coverage() indicating something is either wrong with the Gpy or Google's SIM cards are not equals in terms of what carrier they can attach to? I'm really not sure what to make of this.
I haven't tested this in my FiPy unit to see if the behavior is the same. I'll do so if there's a reason to believe it's a Gpy specific issue.