Skip to content

Commit

Permalink
Modified LoRaWAN command interface documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Apr 19, 2024
1 parent a8730e0 commit 4d03541
Showing 1 changed file with 178 additions and 102 deletions.
280 changes: 178 additions & 102 deletions BresserWeatherSensorLWCfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,118 +57,193 @@
//#include <vector>
//#include <string>

// Downlink messages
// ------------------
//
// CMD_SET_SLEEP_INTERVAL
// (seconds)
// byte0: 0xA8
// byte1: sleep_interval[15:8]
// byte2: sleep_interval[ 7:0]
// ===========================
// LoRaWAN command interface
// ===========================

// CMD_SET_SLEEP_INTERVAL_LONG
// (seconds)
// byte0: 0xA9
// byte1: sleep_interval_long[15:8]
// byte2: sleep_interval_long[ 7:0]
//
// CMD_GET_CONFIG
// byte0: 0xB1
//
// CMD_GET_DATETIME
// byte0: 0x86
//
// CMD_SET_DATETIME
// byte0: 0x88
// byte1: unixtime[31:24]
// byte2: unixtime[23:16]
// byte3: unixtime[15: 8]
// byte4: unixtime[ 7: 0]
//
// CMD_GET_WS_TIMEOUT
// byte0: C0
//
// CMD_SET_WS_TIMEOUT
// (seconds)
// byte0: 0xC1
// byte1: ws_timeout[ 7: 0]
//
// CMD_RESET_RAINGAUGE
// byte0: 0xC3
// byte1: flags[7:0] (optional)
// ---------------------------
// -- LoRaWAN network layer --
// ---------------------------

// To Do:
// CMD_GET_SENSORS_INC
// byte0: 0xC4
// CMD_GET_DATETIME
// -----------------
#define CMD_GET_DATETIME 0x86

// CMD_SET_SENSORS_INC
// byte0: 0xC5
// byte1: sensors_inc0[31:24]
// byte2: sensors_inc0[23:16]
// byte3: sensors_inc0[15: 8]
// byte4: sensors_inc0[ 7: 0]
// ...
//
// CMD_GET_SENSORS_EXC
// byte0: C6
//
// CMD_SET_SENSORS_EXC
// byte0: 0xC7
// byte1: sensors_exc0[31:24]
// byte2: sensors_exc0[23:16]
// byte3: sensors_exc0[15: 8]
// byte4: sensors_exc0[ 7: 0]
// ...
//
// CMD_GET_BLE_ADDR
// byte0: 0xC8
//
// CMD_SET_BLE_ADDR
// byte0: 0xC9
// byte1: ble_addr0[47:24]
// byte2: ble_addr0[23:32]
// byte3: ble_addr0[31:24]
// byte4: ble_addr0[23:16]
// byte5: ble_addr0[15: 8]
// byte6: ble_addr0[ 7: 0]
// ...
// Downlink (command):
// byte0: 0x00

// Response uplink messages -> port = cmd
// --------------------------------------
//
// CMD_GET_DATETIME
// Uplink (response):
// byte0: unixtime[31:24]
// byte1: unixtime[23:16]
// byte2: unixtime[15: 8]
// byte3: unixtime[ 7: 0]
// byte4: rtc_source[ 7: 0]
//


// CMD_SET_DATETIME
// -----------------
// Port: CMD_SET_DATETIME
#define CMD_SET_DATETIME 0x88

// Downlink (command):
// byte0: unixtime[31:24]
// byte1: unixtime[23:16]
// byte2: unixtime[15: 8]
// byte3: unixtime[ 7: 0]

// Uplink: n.a.

// CMD_SET_SLEEP_INTERVAL
// -----------------------
// Note: Set normal sleep interval in seconds
// Port: CMD_SET_SLEEP_INTERVAL
#define CMD_SET_SLEEP_INTERVAL 0xA8

// Downlink (command):
// byte0: sleep_interval[15:8]
// byte1: sleep_interval[ 7:0]

// Response: n.a.

// CMD_SET_SLEEP_INTERVAL_LONG
// ----------------------------
// Note: Set long sleep interval in seconds (energy saving mode)
// Port: CMD_SET_SLEEP_INTERVAL_LONG
#define CMD_SET_SLEEP_INTERVAL_LONG 0xA9

// Downlink (command):
// byte1: sleep_interval_long[15:8]
// byte2: sleep_interval_long[ 7:0]

// Uplink: n.a.

// CMD_GET_LW_CONFIG
// byte1: sleep_interval[15: 8]
// byte2: sleep_interval[ 7:0]
// byte3: sleep_interval_long[15:8]
// byte4: sleep_interval_long[ 7:0]
//
// ------------------
// Port: CMD_GET_LW_CONFIG
#define CMD_GET_LW_CONFIG 0xB1

// Downlink (command):
// byte0: 0x00

// Uplink (response):
// byte0: sleep_interval[15: 8]
// byte1: sleep_interval[ 7:0]
// byte2: sleep_interval_long[15:8]
// byte3: sleep_interval_long[ 7:0]

// -----------------------
// -- Application layer --
// -----------------------

// CMD_GET_WS_TIMEOUT
// -------------------
// Note: Get weather sensor RX timeout in seconds
// Port: CMD_GET_WS_TIMEOUT
#define CMD_GET_WS_TIMEOUT 0xC0

// Downlink (command)
// byte0:

// Uplink (response):
// byte0: ws_timeout[ 7: 0]
//

// To Do:
// CMD_SET_WS_TIMEOUT
// -------------------
// Note: Set weather sensor RX timeout in seconds
// Port: CMD_SET_WS_TIMEOUT
#define CMD_SET_WS_TIMEOUT 0xC1

// Downlink (command):
// byte0: ws_timeout[ 7: 0]

// Uplink: n.a.

// CMD_RESET_RAINGAUGE
// --------------------
// Port: CMD_RESET_RAINGAUGE
#define CMD_RESET_RAINGAUGE 0xC3

// Downlink (command):
// byte0: flags[7:0] (optional)

// Uplink: n.a.

// Reset Lightning???
// -------------------


// CMD_GET_SENSORS_INC
// --------------------
// Note: Get sensors include list (0...12 IDs)
// Port: CMD_GET_SENSORS_INC
#define CMD_GET_SENSORS_INC 0xC4

// Downlink (command):
// byte0: 0x00

// Uplink (response):
// byte0: sensors_inc0[31:24]
// byte1: sensors_inc0[23:16]
// byte2: sensors_inc0[15: 8]
// byte3: sensors_inc0[ 7: 0]
// ...
//

// CMD_SET_SENSORS_INC
// --------------------
// Note: Set sensors include list (0...12 IDs)
// Port: CMD_SET_SENSORS_INC
#define CMD_SET_SENSORS_INC 0xC5

// Downlink (command):
// byte0: sensors_inc0[31:24]
// byte1: sensors_inc0[23:16]
// byte2: sensors_inc0[15: 8]
// byte3: sensors_inc0[ 7: 0]
// ...

// Uplink: n.a.

// CMD_GET_SENSORS_EXC
// --------------------
// Note: Get sensors exclude list (0...12 * 4 bytes)
// Port: CMD_GET_SENSORS_EXC
#define CMD_GET_SENSORS_EXC 0xC6

// Downlink (command):
// byte0: 0x00

// Uplink (response):
// byte0: sensors_exc0[31:24]
// byte1: sensors_exc0[23:16]
// byte2: sensors_exc0[15: 8]
// byte3: sensors_exc0[ 7: 0]
// ...
//

// CMD_SET_SENSORS_EXC
// --------------------
// Note: Set sensors exclude list (0...12 * 4 bytes)
// Port: CMD_SET_SENSORS_EXC
#define CMD_SET_SENSORS_EXC 0xC7

// Downlink (command):
// byte0: sensors_exc0[31:24]
// byte1: sensors_exc0[23:16]
// byte2: sensors_exc0[15: 8]
// byte3: sensors_exc0[ 7: 0]
// ...

// Uplink: n.a.

// CMD_GET_BLE_ADDR
// -----------------
// Note: Get BLE sensors MAC addresses (0..8 * 6 bytes)
// Port: CMD_GET_BLE_ADDR
#define CMD_GET_BLE_ADDR 0xC8

// Downlink (command):
// byte0: 0x00

// Uplink (response):
// byte0: ble_addr0[47:24]
// byte1: ble_addr0[23:32]
// byte2: ble_addr0[31:24]
Expand All @@ -177,24 +252,25 @@
// byte5: ble_addr0[ 7: 0]
// ...

// LoRaWAN network layer
#define CMD_SET_SLEEP_INTERVAL 0xA8
#define CMD_SET_SLEEP_INTERVAL_LONG 0xA9
// CMD_SET_BLE_ADDR
// -----------------
// Note: Set BLE sensors MAC addresses (0..8 * 6 bytes)
// Port: CMD_SET_BLE_ADDR
#define CMD_SET_BLE_ADDR 0xC9

// Uplink (command):
// byte1: ble_addr0[47:24]
// byte2: ble_addr0[23:32]
// byte3: ble_addr0[31:24]
// byte4: ble_addr0[23:16]
// byte5: ble_addr0[15: 8]
// byte6: ble_addr0[ 7: 0]
// ...

// Response: n.a.

#define CMD_GET_LW_CONFIG 0xB1
#define CMD_GET_DATETIME 0x86
#define CMD_SET_DATETIME 0x88
// ===========================

// Application layer
#define CMD_GET_WS_TIMEOUT 0xC0
#define CMD_SET_WS_TIMEOUT 0xC1
#define CMD_RESET_RAINGAUGE 0xC3
#define CMD_GET_SENSORS_INC 0xC4
#define CMD_SET_SENSORS_INC 0xC5
#define CMD_GET_SENSORS_EXC 0xC6
#define CMD_SET_SENSORS_EXC 0xC7
#define CMD_GET_BLE_ADDR 0xC8
#define CMD_SET_BLE_ADDR 0xC9

// Enable debug mode (debug messages via serial port)
// Arduino IDE: Tools->Core Debug Level: "Debug|Verbose"
Expand Down

0 comments on commit 4d03541

Please sign in to comment.