This is my first post on here, so I apologize if I don’t include all of the required information. I am currently putting a Pycom FiPy on to the network. I have succeeded in connecting thanks to the help of this wonderful thread: GPy with Hologram.io SIM | Pycom user forum
I am currently stuck trying to figure out the required code to go from the working example code:
s = socket.socket()
s = ssl.wrap_socket(s)
s.connect(socket.getaddrinfo('www.google.com', 443)[0][-1])
s.send(b"GET / HTTP/1.0\r\n\r\n")
print(s.recv(4096))
s.close()
To actually sending sensor data I am producing to the data engine/dashboard. This is my current code and it is throwing and error on the s.connect
s = socket.socket()
s = ssl.wrap_socket(s)
s.connect(socket.getaddrinfo('cloudsocket.hologram.io', 9999)[0][-1])
s.send(sensortemp2)
This is probably a fairly simple problem, so hopefully this should be resolved quickly. Thank you.
I am not super familiar with the pycom coding, but it looks like you are trying to use ssl to connect to the cloudsocket (line s = ssl.wrap_socket(s)). The hologram cloud socket does not use any encryption so don’t use that line. That is probably the reason you are failing to connect.
What is the value of sensortemp2? Hologram’s cloud socket expects a json string with required fields “k” or “devicekey” and “d” or “data”. For example:
If “sensortemp” is not a json string like above, then you will get an error. Note you will need the device key specific to your simcard in place of “ABCDWXYZ”. You can find this by going to the hologram dashboard, opening the page for the specific simcard and in the upper right click on the blue “DEVICE KEY”