BTW, when I click on All Activity and then on View Raw I do not see the data I just sent minutes ago, only the old one. However, my MicroPython script executes without errors on the client side…I am not sure what to think about it.
I see that Hologram correctly reports that I connected just a minutes ago but All Activity shows only data from days ago…
Is it a bug in Hologram?
My goal is to see the actual data from now in JSON and then being able to retrieve it with API or visualize it on Hologram - and I did not achieve it in the last few days…Can you please assist?
This is the code I use to send data. I do not see the data on Hologram. What am I doing wrong?
The DEVICE_KEY is the Device Key that I found in the Webhook by clicking Create Device Key
print(“Disable MicroPython control and heartbeat of LED”)
pycom.heartbeat(False)
blinkThread = _thread.start_new_thread(blinkForever, (BLUE,))
#Need to use global variables.
#If in each function you delare a new reference, functionality is broken
lte = LTE()
rtc = RTC()
message = “”
lte = getLTE()
HOST = “cloudsocket.hologram.io”
PORT = 9999
DEVICE_KEY = “XXXXXXXX”
TOPIC = “ENVTOPIC”
blinkLock.acquire(1)
colorToBlink = WHITE
blinkLock.release()
idx = 0
try:
#print(“Initially, the RTC is {}”.format(“set” if rtc.synced() else “unset”))
lteSocket = socket.socket()
lteSocket.setblocking(True)
print(lteSocket)
dns_records = socket.getaddrinfo(HOST, PORT)
print("got dns_records:")
print(dns_records)
dns_record = dns_records[0][-1]
print("DNS Record: {}".format(dns_record))
lteSocket.connect(dns_record)
print("==== LTE Socket connected")
while (idx < 1):
print("@@@@@@@@@@@@@@@@@@@@ Transmission #: {}".format(idx))
#print("Local Time: {}".format(utime.localtime())
message = CreatePayload()
#for record in dns_records:
try:
data = '{"k": "%s", "d": "%s", "t": "%s"}' % (DEVICE_KEY, message, TOPIC)
lteSocket.send(bytes(data, 'ascii'))
time.sleep(1)
print("==== LTE Socket data sent")
result = lteSocket.recv(8).decode()
print("LTE Socket result received: "+result)
except Exception as err1:
print("LTE Socket exception: {}".format(err1))
break
idx += 1
time.sleep(5)
lteSocket.close()
print("LTE Socket closed.")
except Exception:
print(“Exception displaying data…”)
finally:
endLTE()
blinkLock.acquire(1)
colorToBlink = None
blinkLock.release()
print("Enable MicroPython control and heartbeat of LED")
pycom.heartbeat(True)