Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
#Clone PCEI repo to a local directory:

git clone "https://gerrit.akraino.org/r/pcei"
cd pcei/iotclient/
ls -l
total 8
-rw-r--r--  1 oberzin  108493823  3230 Dec 26 16:15 STM32SimAzureEMCO.py

# Run the LPWA IoT Client. Specify the IP address of the edge_k8s-1 VM and the port number for the loraread service:

python2 STM32SimAzureEMCO.py
ENTER SERVER IPv4: "10.121.7.152"
ENTER SERVER PORT: 31230
31230
SENDING...
2020-12-26T16:20:47-99
d2
62
21
######## COUNT: 1
{u'txtime': u'2020-12-26T16:20:47-99', u'datarate': 3, u'ack': u'false', u'seqno': 60782, u'pdu': u'007321E7016700d2026862', u'devClass': u'A', u'snr': 10.75, u'devEui': u'0004A30B001BAAAA', u'rssi': -39, u'gwEui': u'00250C00010003A9', u'joinId': 90, u'freq': 903.5, u'port': 3, u'channel': 6}
CLOSED
SEND RESULT: None
NEXT INTERVAL
2020-12-26T16:20:58-25
dc
62
21
######## COUNT: 2
{u'txtime': u'2020-12-26T16:20:58-25', u'datarate': 3, u'ack': u'false', u'seqno': 60782, u'pdu': u'007321E7016700dc026862', u'devClass': u'A', u'snr': 10.75, u'devEui': u'0004A30B001BAAAA', u'rssi': -39, u'gwEui': u'00250C00010003A9', u'joinId': 90, u'freq': 903.5, u'port': 3, u'channel': 6}
CLOSED
SEND RESULT: None


Note that the LPWA IoT Client is generating Temperature, Humidity and Pressure readings  in the encoded format: u'pdu': u'007321E7016700d2026862'.


On the EGGE-K8S-1 cluster (edge_k8s-1 VM) veryfy that the Azure IoT Edge LoRaRead pod is receiving LPWA IoT messages and decoding their contents:

Code Block
languagebash
ssh onaplab@10.121.7.152

kubectl get pods
NAME                         READY   STATUS    RESTARTS   AGE
edgeagent-59cf45d8b9-tc5g9   2/2     Running   1          26m
edgehub-97dc4fdc8-t5qhf      2/2     Running   0          26m
iotedged-6d9dcf4757-h474r    1/1     Running   0          26m
loraread-d4d79b867-2ft2v     2/2     Running   0          26m

kubectl logs loraread-d4d79b867-2ft2v loraread
Listening
('Connection address:', ('10.244.64.1', 7117))
('received data:', '{\n   "ack": "false", \n   "channel": 6, \n   "datarate": 3, \n   "devClass": "A", \n   "devEui": "0004A30B001BAAAA", \n   "freq": 903.5, \n   "gwEui": "00250C00010003A9", \n   "joinId": 90, \n   "pdu": "007321E7016700d2026862", \n   "port": 3, \n   "rssi": -39, \n   "seqno": 60782, \n   "snr": 10.75, \n   "txtime": "2020-12-26T16:20:47-99"\n}')
{u'txtime': u'2020-12-26T16:20:47-99', u'datarate': 3, u'ack': u'false', u'seqno': 60782, u'pdu': u'007321E7016700d2026862', u'devClass': u'A', u'snr': 10.75, u'devEui': u'0004A30B001BAAAA', u'rssi': -39, u'gwEui': u'00250C00010003A9', u'joinId': 90, u'freq': 903.5, u'port': 3, u'channel': 6}
007321E7016700d2026862
00d2
62
21E7
{"Pressure": 867, "TIMESTAMP": "2020-12-26T16:20:47-99", "Humidity": 49, "Temperature": 69.80000000000001, "Device EUI": "0004A30B001BAAAA"}
sent!
Listening
Confirmation[0] received for message with result = OK
    Properties: {}
    Total calls confirmed: 1
('Connection address:', ('10.244.64.1', 24020))
('received data:', '{\n   "ack": "false", \n   "channel": 6, \n   "datarate": 3, \n   "devClass": "A", \n   "devEui": "0004A30B001BAAAA", \n   "freq": 903.5, \n   "gwEui": "00250C00010003A9", \n   "joinId": 90, \n   "pdu": "007321E7016700dc026862", \n   "port": 3, \n   "rssi": -39, \n   "seqno": 60782, \n   "snr": 10.75, \n   "txtime": "2020-12-26T16:20:58-25"\n}')
{u'txtime': u'2020-12-26T16:20:58-25', u'datarate': 3, u'ack': u'false', u'seqno': 60782, u'pdu': u'007321E7016700dc026862', u'devClass': u'A', u'snr': 10.75, u'devEui': u'0004A30B001BAAAA', u'rssi': -39, u'gwEui': u'00250C00010003A9', u'joinId': 90, u'freq': 903.5, u'port': 3, u'channel': 6}
007321E7016700dc026862
00dc
62
21E7
{"Pressure": 867, "TIMESTAMP": "2020-12-26T16:20:58-25", "Humidity": 49, "Temperature": 71.6, "Device EUI": "0004A30B001BAAAA"}
sent!
Listening
Confirmation[0] received for message with result = OK
    Properties: {}
    Total calls confirmed: 2

Note that the Azure IoT Edge PCE App is decoding the IoT Client readings from the Low Power encoding into clear text JSON format and forwarding the decoded readings to the Azure IoT Hub in the core cloud:

{"Pressure": 867, "TIMESTAMP": "2020-12-26T16:20:58-25", "Humidity": 49, "Temperature": 71.6, "Device EUI": "0004A30B001BAAAA"} sent!

Verify that the IoT message count is increasing in Azure Portal for the IoT Edge:

...