Using MQTT send data to server
-
Hello,
How to connect node and gateway of Lora via mqtt(through mqtt we are connecting node and gateway) and how to send a collected data of node and gateway to server via/through mqtt. Please update as soon as possible.Thank you
-
@jmarcelino
We have already added the file mqtt.py, and main.py is blankThank you
-
@archana-kadam
I'm afraid I can't help further without knowing the specific Brand name and model of the hotspot you are using. Even if the hotspot has Vodafone branding it should be some sticker with this information along with FCC ID.Alternatively posting a picture of the hotspot could help.
As far as I know if the hotspot is set to WPA2 PSK it should connect with the instructions I posted so this would be a more specific issue with particular hotspots.
-
@jmarcelino
Yes we have connected to the hotspot with the other computer, laptop as well as with another mobile also. We are using our mobile data and mobile hotspot.Thank you
-
@archana-kadam said in Using MQTT send data to server:
I don't understand how that code matches the error you posted. Don't you have a file called mqtt.py too? What is your main.py?
-
@archana-kadam
Do you have a make/model of the hotspot?WPA2 PSK (pre-shared key) should be correct for the code I posted. Sometimes it's just called WPA2 for short.
Have you connected to the hotspot from another machine using the same name and password?
-
@jmarcelino
Hello,We have successfully connected the fipy to the mobile hotspot with keeping mobile hotspot security as 'None', and in all android mobiles we checked there are no option available as 'WPA2' under security. So how to solve this problem.
And another thing is we are using MQTT method to send data to server using mobile hotspot but getting below error. The code we used is attached please have a look.
Traceback (most recent call last):
File "<stdin>", line 21, in <module>
File "mqtt.py", line 56, in connect
OSError: -1And also let us know how to check/verify whether the mobile mqtt port is enabled?0_1526031623991_mqtt-server.py
Thank you
-
Hi @archana-kadam ,
I had the same problem with my LoPy. I had to encounter two problems. The first one was that because I used deepsleep the hot spot deactived because there was no active connection between the LoPy and the hotspot in de sleep time. When i made the deepsleep time shorter the LoPy connects again but the hotspot stopped with creating a network because the traffic of the messages was to small and the weigth of the messages was to small to set the hot spot in function to keep creating a acceseble network.
The other problem with the hotspot was that I have to agree with some privacy terms and that is something a LoPy or FiPy doesnt do. Maybe he can do it but i do not know how to do that.What is the reason that you doesnt use the Nb IoT or CAT M1 connection of the FiPy?
-
@jmarcelino
Our hotspot configuration is set to WPA2 PSK security we do not have option to set security to only to WPA2, with this arrangement we are not able to connect to the mobile hotspot.
Right now we are using our mobile sim card hotspot network (Vodafone). Let us know anything more information you need.Thank you
-
@archana-kadam
Connecting to the mobile hotspot should be the same as connecting to your home wifi.Make sure you are setting the correct hotspot name and password. Also check the hotspot configuration, is set to use WPA2?
If it still doesn't work we'll need to investigate but for that, at a minimum, I need to know which hotspot you are using.
-
@jmarcelino
More specific to our problem is, right now we have a router setup and have home
wifi network available, and we have configured fipy as station mode and connected to the home wifi network using as below
wlan.connect('wifi-ssid-name', auth=(WLAN.WPA2, 'wifi-password'), timeout=5000)
while not wlan.isconnected():
machine.idle()With the above configuration we have successfully sent the data from fipy to server.
But the problem we are facing is where we do not have router setup, meaning no wifi available, then in that case we have enabled our mobile data internet and switched on the hotspot to connect the fipy to the mobile hotspot and send data to the server. We used the code as below
wlan.connect('HOTSPOT_NAME', auth=(WLAN.WPA2, 'HOTSPOT_PASSWORD'), timeout=5000)
while not wlan.isconnected():
machine.idle()But we are not able to connect to mobile hotspot. We are using MQTT to send data to server.Please find our code in the attachment and suggest where we are going wrong and how to actually connect fipy to mobile hotspot.
Thank You0_1526022171378_gateway.py
-
Can you be more specific please, what is the mobile hotspot you’re using?
Usually you’d just call
wlan.connect('HOTSPOT_NAME', auth=(WLAN.WPA2, 'PASSWORD'), timeout=5000) while not wlan.isconnected(): machine.idle()
Replacing HOTSPOT_NAME by the name of the network (as seen on a WiFi network list) and PASSWORD with the appropriate one
-
Hello team,
We successfully connected the fipy board to the server using existing WiFi, but we are enable to connect using mobile hotspot when the device is not connected to the PC. Please reply as soon as possible Your help will appreciable.
Thank you
-
@han
How to connect the fipy to the mobile hotspot.
Thank you
-
@archana-kadam maybe you could try this
developer.ibm.com/recipes/tutorials/connecting-pycom-devices-to-watson-iot-platform/
-
To understand how to send MQTT data over WiFi please see our MQTT example:
-
Hello team,
Please reply soon as possible for above query.Thank you
-
Hello
We are connecting two nodes and one gateway we are successfully saved the data from gateway to server using our existing wifi(Home wifi) using mqtt.
Now how we need to use existing wifi of fipy board and store data to server using mqtt.
Please reply as soon as possible.
Thank you
-
@archana-kadam
The simplest solution is to have one LoPy as a node and another as a nano-gateway connected to a service such as The Things Network: https://www.thethingsnetwork.orgThen you can retrieve your data over MQTT from there.
The code for the LoPy node and nano-gateway is at:
https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway