This one has me scratching my head. I have the following code in a script in a Raspberry Pi 4:
hologram = HologramCloud(credentials, network=‘cellular’)
result = hologram.network.connect(timeout=10)
if result == False:
print(‘Failed to connect to cell network’)
errlog=open("/home/pi/Prime/ErrLog.txt",“a+”)
errlog.write(‘Failed to connect to cell network: ’ + time.strftime("%c") +’||’)
errlog.close()
else:
print(‘Connected to Cell Network’)
If I run it from the command line no problem.
I also added it to the rc.local file to run on bootup.
When it runs that way it acts like it’s getting a “false” result but actually connects fine.
Same for this:
sent = hologram.sendMessage(messageD,topics=[“Digital”])
if sent == 48:
print(‘Digital sent to cloud’)
else:
errlog=open("/home/pi/Prime/ErrLog.txt",“a+”)
errlog.write("Error trying to send Digital. || ")
errlog.close()
The message gets sent fine, but logs as an error that it didn’t.
Any ideas on what might be happening?