things4u / ESP-1ch-Gateway

Version 6 of the single channel gateway
MIT License
358 stars 143 forks source link

Real Sensor Data Decoding Problem #121

Open RehmanZeeshan opened 8 months ago

RehmanZeeshan commented 8 months ago

Hello, I'm using gateway as a node and got the data from tge internal battery sensor in the local server, by registering the gateway in the TTN and add the DevADDr o my harwdare in this.

if _GATEWAYNODE==1

define _LCODE 1

//# define _RAW 1

define _CHECK_MIC 1

define _SENSOR_INTERVAL 100

// Sensor and app address information

define _DEVADDR { 0x26, 0x0D, 0xCF, 0x3E}

define _APPSKEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

define _NWKSKEY { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Now, I want to decode a real sensor node. where to add the sensor node Devaddr, nskey and appkey now to decode the the node data ? in tha above mentioned code line or in the following code lines ?

if _LOCALSERVER>=1

struct codex { uint32_t id; // This is the device ID (coded in 4 bytes uint32_t unsigned char nm[32]; // A name string which is free to choose uint8_t nwkKey[16]; // The Network Session Key of 16 bytes uint8_t appKey[16]; // The Application Session Key of 16 bytes };

// Sometimes we want to decode the sensor completely as we do in the TTN server // This means that for all nodes we want to view the data of, we need to provide // the AppsSKey and the NwkSKey

// Definition of all nodes that we want to decode locally on the gateway. // codex decodes[] = { { 0x260DCF3E , "lora-01", // F=0 { 0x70, 0xC9, 0xD7, 0xAA, 0xE3, 0x3C, 0xCE, 0x35, 0x1E, 0x10, 0x69, 0xA3, 0xB2, 0x34, 0xBB, 0x95}, { 0x39, 0xA7, 0x66, 0x14, 0x84, 0x22, 0xB3, 0x0D, 0x45, 0x65, 0xDD, 0x34, 0xEA, 0xAA, 0x03, 0x32} }
};

endif //_LOCALSERVER