Hello Everyone,
Firstly Happy New Year, and excuse my explanation as I am not a pro at coding etc…
So I have been trying to extract a JSON string from my LoRaWAN gateway into HA
This is the JSON:
{
"applicationID": "1",
"applicationName": "HomeAssistant",
"deviceName": "MNL1 Tracker",
"devEUI": "****************=",
"rxInfo": [
{
"gatewayID": "LPfxEURAABE=",
"time": "2024-01-10T02:27:05.205689230Z",
"timeSinceGPSEpoch": null,
"rssi": -86,
"loRaSNR": 12.5,
"channel": 0,
"rfChain": 0,
"board": 0,
"antenna": 0,
"location": {
"latitude": -40.33129247197204,
"longitude": 175.88169336318973,
"altitude": 50,
"source": "UNKNOWN",
"accuracy": 0
},
"fineTimestampType": "NONE",
"context": "hB4IrA==",
"uplinkID": "C0TPvG6uQl6biBm4h1HU9A==",
"crcStatus": "CRC_OK"
}
],
"txInfo": {
"frequency": 903900000,
"modulation": "LORA",
"loRaModulationInfo": {
"bandwidth": 125,
"spreadingFactor": 9,
"codeRate": "4/5",
"polarizationInversion": false
}
},
"adr": true,
"dr": 1,
"fCnt": 1077,
"fPort": 5,
"data": "BwAAAABlngBseEVYSw6J2H5Nj0DXL9GRVPdh2fHIekVYOw6J2wD0ADg+",
"objectJSON": "{\"err\":-1,\"messages\":[],\"payload\":\"0700000000659E006C7845584B0E89D87E4D8F40D72FD19154F761D9F1C87A45583B0E89DB00F400383E\",\"valid\":false}",
"tags": {},
"confirmedUplink": true,
"devAddr": "AAC9mw=="
}
To start I am trying to extract Latitude with this in my config
- device_tracker:
name: "MNL1 Tracker"
state_topic: "application/1/device/2cf7f1c053000409/event/up"
value_template: "{{ value_json.rxInfo[0].location.latitude }}"
In the states part of developer tab I get unknown.
I have put the JSON into JSONPath online checker as suggested in similar posts and it returns the Latitude correctly.
Could anyone please point me to where I may be going wrong or missing something?
Cheers