Commands

Commands are generated by ChirpStack or external applications integrating with the ChirpStack Gateway Bridge. Depending the marshaler configuration, these must be sent as:

  • JSON: JSON based on the Protobuf Buffers JSON mapping (for debugging)
  • Protobuf: Protocol Buffers binary encoding (recommended)

For the Protobuf message definitions, please refer to gw.proto.

Command types

Request the gateway to schedule a downlink transmission.

The items must contain at least one downlink option but can contain multiple items. At most one item will be emitted by the gateway. By specifying multiple items (e.g. RX1 and RX2), the gateway can retry with the next item in case of a scheduling issue.

The context key must contain the same value as the related uplink frame. It holds the gateway internal context (e.g. internal timing information).

Defined by the DownlinkFrame Protobuf message.

JSON example (for Class-A scheduling):

{
	"downlinkId": 894104280,
	"items": [{
		"phyPayload": "YKb+agGgAwCSzNbb",
		"txInfo": {
			"frequency": 867300000,
			"power": 14,
			"modulation": {
				"lora": {
					"bandwidth": 125000,
					"spreadingFactor": 7,
					"codeRate": "CR_4_5",
					"polarizationInversion": true
				}
			},
			"timing": {
				"delay": {
					"delay": "1s"
				}
			},
			"context": "xwx0GQ=="
		}
	}, {
		"phyPayload": "YKb+agGgAwCSzNbb",
		"txInfo": {
			"frequency": 869525000,
			"power": 27,
			"modulation": {
				"lora": {
					"bandwidth": 125000,
					"spreadingFactor": 12,
					"codeRate": "CR_4_5",
					"polarizationInversion": true
				}
			},
			"timing": {
				"delay": {
					"delay": "2s"
				}
			},
			"context": "xwx0GQ=="
		}
	}],
	"gatewayId": "0016c001f153a14c"
}

config - Gateway configuration

Request the gateway to re-configure the channels. This command only works in combination with the ChirpStack Concentratord backend.

Defined by the GatewayConfiguration Protobuf message.

JSON example:

{
	"gatewayId": "0016c001f153a14c",
	"version": "717c8d9dd858e8b0",
	"channels": [{
		"frequency": 868100000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 868300000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 868500000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 867100000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 867300000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 867500000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 867700000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 867900000,
		"loraModulationConfig": {
			"bandwidth": 125000,
			"spreadingFactors": [7, 8, 9, 10, 11, 12]
		}
	}, {
		"frequency": 868300000,
		"loraModulationConfig": {
			"bandwidth": 250000,
			"spreadingFactors": [7]
		}
	}, {
		"frequency": 868800000,
		"fskModulationConfig": {
			"bandwidth": 125000,
			"bitrate": 50000
		}
	}],
	"statsInterval": "30s"
}

exec - Command execution request

This will request the execution of a command by the ChirpStack Gateway Bridge. Please note that these commands must be pre-configured in the Configuration file.

Defined by the GatewayCommandExecRequest Protobuf message.

JSON example:

{
    "gatewayId": "0016c001f153a14c",
	"execId": 23451,
    "command": "reboot",
    "token": "[BASE64 ENCODED BLOB]",
    "stdin": "[OPTIONAL BASE64 ENCODED BLOB]",
    "environment": {
        "ENV_VAR_1": "value1",
        "ENV_VAR_2": "value2"
    }
}

Note: the given environment variables will be extended to the environment variables that are already exposed to the "main" process.

raw - Raw packet-forwarder command

This payload is used for raw packet-forwarder commands that are not integrated with the ChirpStack Gateway Bridge. Currently these are the:

Defined by the RawPacketForwarderCommand Protobuf message.

JSON example:

{
    "gatewayId": "0016c001f153a14c",
    "payload": "[BASE64 ENCODED BLOB]"
}