Also keep in mind that in order to use a device such as an XBee3 Cellular as a web server, you would need to be able to reach the device over the cellular network from the client device. This would require either an expensive SIM card plan with a static IP (which would also mean everybody in the world could access your web server), or some other coordination within the cellular network between the XBee and another client device (such as a phone or computer) so that the client knows what IP address to access.
If using an XBee3 Cellular device to serve up HTML pages like this is still the usecase you want, and you are able to resolve the IP addressing issues that come with it, instead of using MicroPython I would recommend API mode, especially since you will be using an external host processor. You can configure a listening TCP port using the ATIP and ATC0 commands.
It looks like the real roadblock might be reaching the Xbee3 from the Internet. Even knowing the IP address of the XBee3, the cellular network might prevent “Mobile Terminated” (Internet initiated) IP connections to the XBee3. I read “…with a regular mobile plan you are unlikely to get a fixed IP. It’s also possible that the ports you require may not be accessible and you may not get a routable IP at all - quite a few providers have now gone to carrier grade NAT or a walled garden approach.” Google shows many sellers of fixed IP SIM cards with public IPs, but they are all overseas, lucky them!
Is anyone able to get Internet initiated “Mobile Terminated” IP data to the XBee3 (without an expensive corporate fixed IP plan)? Which carrier/plan?
Or does this mean I need to go the Cloud/subscription route? Was really hoping to avoid that extra complexity.
Head is spining with all the cloud options and methods out there! I’m thinking of pushing the temperature data to the cloud using MQTT (XBee3 in Transparent Mode, MQTT will generated by my CPU and sent to the XBee over UART, barest minimum of Python coding). I’m hoping the cloud-vendor (Digi!) has visualization tools to publish the data to a simple bar-graph graphic that is viewable on a cell phone and/or web browser. or am I dreamin?
while True:
cl, addr = s.accept()
print(‘client connected from’, addr)
cl_file = cl.makefile(‘rwb’, 0)
while True:
line = cl_file.readline()
if not line or line == b’
‘:
break
rows = [’%s%d’ % (str(p), p.value()) for p in pins]
response = html % ’
'.join(rows)
cl.send(response)
cl.close()
EDIT: The Dweet/Freeboard solution looks interesting but to get full functionality you have to do a lot of hacking/programming. It doesn’t look like new development is happening, and the user community has died down. Plonk
I have a question about dweeting:
I’m guessing that the XBee3 has to be in Transparent mode, and is “Connecting to a TCP/IP address” as on page 46 of the LTE-M/NB-IOT User Guide?
Do you have an example of the string I have to send from my processor to do a simple “for” dweet: https://dweet.io/dweet/for/my-thing-name?hello=world
Or do I have to do a “GET HTTP Request” or “CoAP”?