Can someone explain how this all works?

Home Forums General Can someone explain how this all works?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #25891
    ConduitHelp
    Participant

    I have a parking sensor: PNI PlacePod, it’s turned on. I also have a Multitech Conduit gateway.

    I’ve setup my MultiTech Gateway and I can SSH into it, great. It also has the antenna connected so it can receive LoraWAN signals.

    I’m assuming the parking sensor just randomly sends out signals and this MultiTech gateway receives any LoraWAN signals it can find.

    I basically want it so in a Python script I will run: any time the gateway receives a signal from the parking sensor, send out an HTTP request to a web server containing things like:

    – The value of the parking sensor
    – The physical ID of the parking sensor

    I’m very in the dark on how to do this or if this is even how everything works. Am I correct or no? And also if I am correct, how do I even begin to accomplish this?

    • This topic was modified 5 years, 8 months ago by ConduitHelp.
    #25893
    Jason Reiss
    Keymaster

    Start here
    http://www.multitech.net/developer/software/lora/introduction-to-lora/

    And here
    http://www.multitech.net/developer/software/lora/getting-started-with-lora-conduit-aep/

    Data is encrypted so keys need to be exchanged between end device and network server on Conduit.

    #25894
    ConduitHelp
    Participant

    I’ve read these pages and it’s just making things 10x more confusing. I have the packet forwarder setup (still not even sure what this is) using the configuration settings and now I’m looking into how to receive signals with Python.

    http://www.multitech.net/developer/software/mlinux/mlinux-software-development/python/

    This seems to be the only link I could find for Python development. It doesn’t really say anything else or even has any code samples.

    I’m still just confused altogether on how to get this working with my parking sensor. This is way more complicated than it should be it seems.

    I simply just want to be able to receive LoraWAN signals from my parking sensor (no idea how to even decrypt the information it sends or even receive it) in a Python script that automatically waits for signals. I’ve got a strong feeling this might not even be possible or could take many weeks of work for what should be a day or two.

    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    #25898
    Jason Reiss
    Keymaster

    Python is already installed with the packages needed for UDP communication and JSON parsing.
    https://wiki.python.org/moin/UdpCommunication

    A network server will be needed to authenticate and decrypt the packets. Are you planning on using a LoRaWAN service provider or the embedded network server on Conduit?

    The packet forwarder sends received packets to a network server via UDP.
    https://github.com/Lora-net/packet_forwarder/blob/master/PROTOCOL.TXT

    To receive packets locally open a listening socket in python on the configured upstream port.

    By default the pod my be transmitting on 64 channels where the gateway can only listen on 8. The correct channel mask will need to be configured in the sensor.

    Has the place pod been activated?

    Is it an ABP or OTA device?

    An OTA device will join the network by sending a Join Packet containing an Device EUI. The network server will respond to the device with a Join Accept packet and both sides will create session keys using a pre-shared AppKey.

    An ABP device will already have session keys which will need to be provided to the network server out-of-band.

    #25905
    ConduitHelp
    Participant

    EDIT:

    Oh okay so hold on. I just have to listen for packets (UDP I’m guessing?) in Python? I’m still not sure where to find out what port I need to have open. Where do I go to find out for sure? And now that the Place Pod is activated with the magnet, it should just automatically send out signals and I should be able to receive them on the conduit?

    I’m fine getting the needed packages for Python. The Conduit is already configured and connected to the internet through my router and I can SSH into it no problem and create a Python script and run it in the background on a while loop and theoretically in that while loop is where I’d wait for LoRa signals in some kind of a queue or asynchronously and then decrypt them somehow and send out an HTTP POST request to my web server with the data. Are TCP HTTP requests not possible?

    Are you planning on using a LoRaWAN service provider or the embedded network server on Conduit?

    I’m not sure what the difference is between the network server and LoRaWAN service provider though? Is the LoRaWAN service provider The Things Network? And is the network server just a process on the conduit that intercepts the LoRa signals?

    Is it an ABP or OTA device?

    I don’t know how to figure that out.

    I’m not sure why I’d need to use The Things Network or what it’s for really when I’m just trying to get a signal intercepted from the parking sensor (PlacePod) on the conduit through Python and every time I intercept a signal, decrypt the data (still not sure how to do this or let alone intercept a signal) and send a custom HTTP POST request (have this down, I know how to do this part).

    Has the place pod been activated?

    The Place Pod is activated with the magnet.

    I’m starting to think what I’m trying to do isn’t possible? Does it make sense what I’m trying to do?

    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    #25920
    Jason Reiss
    Keymaster

    What leads you to believe it isn’t possible?
    Is the place pod a LoRaWAN module?
    The Conduit can communicate with any LoRaWAN device.

    The device will need to be registered to authenticate and decrypt the packets from the device.

    Do you have any documentation regarding the activation procedure for the PNI device?
    There may be provisioning information available via bluetooth when the sensor is activated using the magnet.

    If it is an ABP device look for DevAddr, Network Session Key and Application Session Key.

    If it is an OTA device look for DevEUI and AppKey.

    Use the info from the sensor to register it with the Conduit.

    To start use the embedded network server.

    mLinux instructions for provisioning devices.
    http://www.multitech.net/developer/software/lora/lora-network-server/

    The lora-query utility can be used to get info from the network server.
    $ lora-query -x help
    $ lora-query -x packets recent
    $ lora-query -x packets join

    For AEP use the LoRaWAN UI pages.

    To receive messages from network server MQTT can be used on command line.
    $ mosquitto_sub -v -t lora/+/+

    http://www.multitech.net/developer/software/lora/lora-network-server/mqtt-messages/

    Troubleshooting help and PDF guide
    http://www.multitech.net/developer/software/lora/troubleshooting-lora-communication/

    #25921
    Steve Kovarik
    Moderator

    Hello ConduitHelp

    Could you please email your contact information to salesfae@multitech.com
    with the intent in having a brief conversation.

    -Best Regards

    #25928
    ConduitHelp
    Participant

    This is the placepod we’re using. Still not sure how to determine if it’s a OTA or ABP device. I’m not sure how to find out this provisioning information via bluetooth.

    I’m guessing once I get this info (still not sure how), I register it to the conduit via this link?

    So from what I understand, every time the conduit receives signals from a registered sensor, it pushes it to an MQTT channel (and also listen for datagrams on a specific UDP port?) and I can basically subscribe to it via Python or nodeJS and tell when I get data? And then I could basically send out an HTTP POST request afterwards?

    Once the device is registered, will any messages I receive from MQTT/UDP port be decrypted? (now that I think about it the UDP data should still be encrypted and I’d have to decrypt it manually, not sure how to do that so I’m guessing MQTT will be decrypted after I subscribe to the MQTT lora channel?)

    Also, will the parking sensor send out signals at a certain interval or will it most likely send out signals when a state changes? Or does this depend solely on the parking sensor? (specifically this PNI PlacePod I linked above)

    Thank you!

    • This reply was modified 5 years, 8 months ago by ConduitHelp.
    #25934
    Jason Reiss
    Keymaster

    Sorry I do not have more information regarding from the PNI device or how it is intended to operate, I have not found docs available publicly.

    Please refer to PNI documentation or contact their support for information regarding provisioning and activation.

    #25955
    Jason Reiss
    Keymaster

    This is the best info I could find. No mention of how to get keys from the device.

    https://www.youtube.com/channel/UCPWCmIdERHRi8Undw3gn51g

    https://www.thethingsnetwork.org/forum/t/pni-placepod/14297

    #25969
    andrew@bitfinder.co
    Participant

    I am doing a similar-ish thing now-ish. But not with parking sensors.

    If you are running your python script on the gateway, then you need to get python pip installed, then paho_mqtt and requests python modules.

    paho_mqtt will connect to the local mqtt broker, get the “data” key from the message, do a base64 decode on it to get bytes, then (the hardest part) will be using struct unpack on the byte data to recover the values you are looking for.
    Then formulate your HTTP request and send via requests module.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.