Skip to main content

Protobuf API Reference

admin.proto#

AdminMessage#

message description

This message is handled by the Admin plugin and is responsible for all settings/channel read/write operations. This message is used to do settings operations to both remote AND local nodes. (Prior to 1.2 these operations were done via special ToRadio operations)

FieldTypeDescription
oneof variant.set_radioRadioConfigset the radio provisioning for this node
oneof variant.set_ownerUserSet the owner for this node
oneof variant.set_channelChannelSet channels (using the new API). A special channel is the "primary channel". The other records are secondary channels. Note: only one channel can be marked as primary. If the client sets a particular channel to be primary, the previous channel will be set to SECONDARY automatically.
oneof variant.get_radio_requestboolSend the current RadioConfig in the response for this message.
oneof variant.get_radio_responseRadioConfignone
oneof variant.get_channel_requestuint32Send the specified channel in the response for this message NOTE: This field is sent with the channel index + 1 (to ensure we never try to send 'zero' - which protobufs treats as not present)
oneof variant.get_channel_responseChannelnone
oneof variant.confirm_set_channelboolSetting channels/radio config remotely carries the risk that you might send an invalid config and the radio never talks to your mesh again. Therefore if setting either of these properties remotely, you must send a confirm_xxx message within 10 minutes. If you fail to do so, the radio will assume loss of comms and revert your changes. These messages are optional when changing the local node.
oneof variant.confirm_set_radioboolnone
oneof variant.exit_simulatorboolThis message is only supported for the simulator porduino build. If received the simulator will exit successfully.
oneof variant.reboot_secondsint32Tell the node to reboot in this many seconds (or <0 to cancel reboot)

apponly.proto#

ChannelSet#

message description

This is the most compact possible representation for a set of channels. It includes only one PRIMARY channel (which must be first) and any SECONDARY channels. No DISABLED channels are included. This abstraction is used only on the the 'app side' of the world (ie python, javascript and android etc) to show a group of Channels as a (long) URL

FieldTypeDescription
settingsChannelSettingsnone

channel.proto#

Channel#

message description

A pair of a channel number, mode and the (sharable) settings for that channel

FieldTypeDescription
indexint32The index of this channel in the channel table (from 0 to MAX_NUM_CHANNELS-1) (Someday - not currently implemented) An index of -1 could be used to mean "set by name", in which case the target node will find and set the channel by settings.name.
settingsChannelSettingsThe new settings, or NULL to disable that channel
roleChannel.Rolenone

ChannelSettings#

message description

Full settings (center freq, spread factor, pre-shared secret key etc...) needed to configure a radio for speaking on a particular channel This information can be encoded as a QRcode/url so that other users can configure their radio to join the same channel. A note about how channel names are shown to users: channelname-Xy poundsymbol is a prefix used to indicate this is a channel name (idea from @professr). Where X is a letter from A-Z (base 26) representing a hash of the PSK for this channel - so that if the user changes anything about the channel (which does force a new PSK) this letter will also change. Thus preventing user confusion if two friends try to type in a channel name of "BobsChan" and then can't talk because their PSKs will be different. The PSK is hashed into this letter by "0x41 + [xor all bytes of the psk ] modulo 26" This also allows the option of someday if people have the PSK off (zero), the users COULD type in a channel name and be able to talk. Y is a lower case letter from a-z that represents the channel 'speed' settings (for some future definition of speed)

FIXME: Add description of multi-channel support and how primary vs secondary channels are used. FIXME: explain how apps use channels for security. explain how remote settings and remote gpio are managed as an example

FieldTypeDescription
tx_powerint32If zero then, use default max legal continuous power (ie. something that won't burn out the radio hardware) In most cases you should use zero here. Units are in dBm.
modem_configChannelSettings.ModemConfigNote: This is the 'old' mechanism for specifying channel parameters. Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH. As a heuristic: If bandwidth is specified, do not use modem_config. Because protobufs take ZERO space when the value is zero this works out nicely. This value is replaced by bandwidth/spread_factor/coding_rate. If you'd like to experiment with other options add them to MeshRadio.cpp in the device code.
bandwidthuint32Bandwidth in MHz Certain bandwidth numbers are 'special' and will be converted to the appropriate floating point value: 31 -> 31.25MHz
spread_factoruint32A number from 7 to 12. Indicates number of chirps per symbol as 1<<spread_factor.
coding_rateuint32The denominator of the coding rate. ie for 4/8, the value is 8. 5/8 the value is 5.
channel_numuint32NOTE: this field is independent and unrelated to the concepts in channel.proto. this is controlling the actual hardware frequency the radio is transmitting on. In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming. Most users should never need to be exposed to this field/concept. A channel number between 1 and 13 (or whatever the max is in the current region). If ZERO then the rule is "use the old channel name hash based algorithm to derive the channel number") If using the hash algorithm the channel number will be: hash(channel_name) % NUM_CHANNELS (Where num channels depends on the regulatory region). NUM_CHANNELS_US is 13, for other values see MeshRadio.h in the device code. hash a string into an integer - djb2 by Dan Bernstein. - http://www.cse.yorku.ca/~oz/hash.html unsigned long hash(char str) { unsigned long hash = 5381; int c; while ((c = str++) != 0) hash = ((hash << 5) + hash) + (unsigned char) c; return hash; }
pskbytesA simple pre-shared key for now for crypto. Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256). A special shorthand is used for 1 byte long psks. These psks should be treated as only minimally secure, because they are listed in this source code. Those bytes are mapped using the following scheme: 0 = No crypto 1 = The special "default" channel key: {0xd4, 0xf1, 0xbb, 0x3a, 0x20, 0x29, 0x07, 0x59, 0xf0, 0xbc, 0xff, 0xab, 0xcf, 0x4e, 0x69, 0xbf} 2 through 10 = The default channel key, except with 1 through 9 added to the last byte. Shown to user as simple1 through 10
namestringA SHORT name that will be packed into the URL. Less than 12 bytes. Something for end users to call the channel If this is the empty string it is assumed that this channel is the special (minimally secure) "Default"channel. In user interfaces it should be rendered as a local language translation of "X". For channel_num hashing empty string will be treated as "X". Where "X" is selected based on the English words listed above for ModemConfig
idfixed32Used to construct a globally unique channel ID. The full globally unique ID will be: "name.id" where ID is shown as base36. Assuming that the number of meshtastic users is below 20K (true for a long time) the chance of this 64 bit random number colliding with anyone else is super low. And the penalty for collision is low as well, it just means that anyone trying to decrypt channel messages might need to try multiple candidate channels. Any time a non wire compatible change is made to a channel, this field should be regenerated. There are a small number of 'special' globally known (and fairly) insecure standard channels. Those channels do not have a numeric id included in the settings, but instead it is pulled from a table of well known IDs. (see Well Known Channels FIXME)
uplink_enabledboolIf true, messages on the mesh will be sent to the public internet by any gateway ndoe
downlink_enabledboolIf true, messages seen on the internet will be forwarded to the local mesh.

Channel.Role#

enum description

How this channel is being used (or not).

Note: this field is an enum to give us options for the future. In particular, someday we might make a 'SCANNING' option. SCANNING channels could have different frequencies and the radio would occasionally check that freq to see if anything is being transmitted.

For devices that have multiple physical radios attached, we could keep multiple PRIMARY/SCANNING channels active at once to allow cross band routing as needed. If a device has only a single radio (the common case) only one channel can be PRIMARY at a time (but any number of SECONDARY channels can't be sent received on that common frequency)

NameNumberDescription
DISABLED0This channel is not in use right now
PRIMARY1This channel is used to set the frequency for the radio - all other enabled channels must be SECONDARY
SECONDARY2Secondary channels are only used for encryption/decryption/authentication purposes. Their radio settings (freq etc) are ignored, only psk is used.

ChannelSettings.ModemConfig#

enum description

Standard predefined channel settings Note: these mappings must match ModemConfigChoice in the device code.

NameNumberDescription
Bw125Cr45Sf1280< Bw = 125 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC < on. Default medium range (5.469 kbps)
Bw500Cr45Sf1281< Bw = 500 kHz, Cr = 4/5, Sf(7) = 128chips/symbol, CRC < on. Fast+short range (21.875 kbps)
Bw31_25Cr48Sf5122< Bw = 31.25 kHz, Cr = 4/8, Sf(9) = 512chips/symbol, < CRC on. Slow+long range (275 bps)
Bw125Cr48Sf40963< Bw = 125 kHz, Cr = 4/8, Sf(12) = 4096chips/symbol, CRC < on. Slow+long range (183 bps)

deviceonly.proto#

ChannelFile#

message description

The on-disk saved channels

FieldTypeDescription
channelsChannelThe channels our node knows about

DeviceState#

message description

This message is never sent over the wire, but it is used for serializing DB state to flash in the device code FIXME, since we write this each time we enter deep sleep (and have infinite flash) it would be better to use some sort of append only data structure for the receive queue and use the preferences store for the other stuff

FieldTypeDescription
legacyRadioLegacyRadioConfigMoved to its own file, but we keep this here so we can automatically migrate old radio.region settings
my_nodeMyNodeInfoRead only settings/info about this node
ownerUserMy owner info
node_dbNodeInfonone
receive_queueMeshPacketReceived packets saved for delivery to the phone
versionuint32A version integer used to invalidate old save files when we make incompatible changes This integer is set at build time and is private to NodeDB.cpp in the device code.
rx_text_messageMeshPacketWe keep the last received text message (only) stored in the device flash, so we can show it on the screen. Might be null
no_saveboolUsed only during development. Indicates developer is testing and changes should never be saved to flash.
did_gps_resetboolSome GPSes seem to have bogus settings from the factory, so we always do one factory reset.

LegacyRadioConfig#

message description

This is a stub version of the old 1.1 representation of RadioConfig. But only keeping the region info. The device firmware uses this stub while migrating old nodes to the new preferences system.

FieldTypeDescription
preferencesLegacyRadioConfig.LegacyPreferencesnone

LegacyRadioConfig.LegacyPreferences#

FieldTypeDescription
regionRegionCodeThe region code for my radio (US, CN, EU433, etc...)

environmental_measurement.proto#

EnvironmentalMeasurement#

FieldTypeDescription
temperaturefloatnone
relative_humidityfloatnone
barometric_pressurefloatnone

mesh.proto#

Data#

message description

(Formerly called SubPacket) The payload portion fo a packet, this is the actual bytes that are sent inside a radio packet (because from/to are broken out by the comms library)

FieldTypeDescription
portnumPortNumFormerly named typ and of type Type
payloadbytesRequired
want_responseboolNot normally used, but for testing a sender can request that recipient responds in kind (i.e. if it received a position, it should unicast back it's position). Note: that if you set this on a broadcast you will receive many replies.
destfixed32The address of the destination node. This field is is filled in by the mesh radio device software, application layer software should never need it. RouteDiscovery messages must populate this. Other message types might need to if they are doing multihop routing.
sourcefixed32The address of the original sender for this message. This field should only be populated for reliable multihop packets (to keep packets small).
request_idfixed32Only used in routing or response messages. Indicates the original message ID that this message is reporting failure on. (formerly called original_id)

FromRadio#

message description

Packets from the radio to the phone will appear on the fromRadio characteristic. It will support READ and NOTIFY. When a new packet arrives the device will BLE notify? It will sit in that descriptor until consumed by the phone, at which point the next item in the FIFO will be populated.

FieldTypeDescription
numuint32The packet num, used to allow the phone to request missing read packets from the FIFO, see our bluetooth docs
oneof payloadVariant.packetMeshPacketnone
oneof payloadVariant.my_infoMyNodeInfoTells the phone what our node number is, can be -1 if we've not yet joined a mesh. NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.
oneof payloadVariant.node_infoNodeInfoOne packet is sent for each node in the on radio DB starts over with the first node in our DB
oneof payloadVariant.log_recordLogRecordset to send debug console output over our protobuf stream
oneof payloadVariant.config_complete_iduint32sent as true once the device has finished sending all of the responses to want_config recipient should check if this ID matches our original request nonce, if not, it means your config responses haven't started yet. NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.
oneof payloadVariant.rebootedboolSent to tell clients the radio has just rebooted. Set to true if present. Not used on all transports, currently just used for the serial console. NOTE: This ID must not change - to keep (minimal) compatibility with <1.2 version of android apps.

LogRecord#

message description

Debug output from the device.

To minimize the size of records inside the device code, if a time/source/level is not set on the message it is assumed to be a continuation of the previously sent message. This allows the device code to use fixed maxlen 64 byte strings for messages, and then extend as needed by emitting multiple records.

FieldTypeDescription
messagestringnone
timefixed32Seconds since 1970 - or 0 for unknown/unset
sourcestringUsually based on thread name - if known
levelLogRecord.LevelNot yet set

MeshPacket#

message description

A packet envelope sent/received over the mesh only payloadVariant is sent in the payload portion of the LORA packet. The other fields are either not sent at all, or sent in the special 16 byte LORA header.

FieldTypeDescription
fromfixed32The sending node number. Note: Our crypto implementation uses this field as well. See crypto for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though.
tofixed32The (immediatSee Priority description for more details.y should be fixed32 instead, this encoding only hurts the ble link though.
channeluint32(Usually) If set, this indicates the index in the secondary_channels table that this packet was sent/received on. If unset, packet was on the primary channel. A particular node might know only a subset of channels in use on the mesh. Therefore channel_index is inherently a local concept and meaningless to send between nodes. Very briefly, while sending and receiving deep inside the device Router code, this field instead contains the 'channel hash' instead of the index. This 'trick' is only used while the payloadVariant is an 'encrypted'.
oneof payloadVariant.decodedDatanone
oneof payloadVariant.encryptedbytesnone
idfixed32A unique ID for this packet. Always 0 for no-ack packets or non broadcast packets (and therefore take zero bytes of space). Otherwise a unique ID for this packet, useful for flooding algorithms. ID only needs to be unique on a per sender basis, and it only needs to be unique for a few minutes (long enough to last for the length of any ACK or the completion of a mesh broadcast flood). Note: Our crypto implementation uses this id as well. See crypto for details. FIXME - really should be fixed32 instead, this encoding only hurts the ble link though.
rx_timefixed32The time this message was received by the esp32 (secs since 1970). Note: this field is never sent on the radio link itself (to save space) Times are typically not sent over the mesh, but they will be added to any Packet (chain of SubPacket) sent to the phone (so the phone can know exact time of reception)
rx_snrfloatNever* sent over the radio links. Set during reception to indicate the SNR of this packet. Used to collect statistics on current link quality.
hop_limituint32If unset treated as zero (no forwarding, send to adjacent nodes only) if 1, allow hopping through one node, etc... For our usecase real world topologies probably have a max of about 3. This field is normally placed into a few of bits in the header.
want_ackboolThis packet is being sent as a reliable message, we would prefer it to arrive at the destination. We would like to receive a ack packet in response. Broadcasts messages treat this flag specially: Since acks for broadcasts would rapidly flood the channel, the normal ack behavior is suppressed. Instead, the original sender listens to see if at least one node is rebroadcasting this packet (because naive flooding algorithm). If it hears that the odds (given typical LoRa topologies) the odds are very high that every node should eventually receive the message. So FloodingRouter.cpp generates an implicit ack which is delivered to the original sender. If after some time we don't hear anyone rebroadcast our packet, we will timeout and retransmit, using the regular resend logic. Note: This flag is normally sent in a flag bit in the header when sent over the wire
priorityMeshPacket.PriorityThe priority of this message for sending. See MeshPacket.Priority description for more details.
rx_rssiint32rssi of received packet. Only sent to phone for dispay purposes.

MyNodeInfo#

message description

Unique local debugging info for this node Note: we don't include position or the user info, because that will come in the Sent to the phone in response to WantNodes.

FieldTypeDescription
my_node_numuint32Tells the phone what our node number is, default starting value is lowbyte of macaddr, but it will be fixed if that is already in use
has_gpsboolNote: This flag merely means we detected a hardware GPS in our node. Not the same as UserPreferences.location_sharing
num_bandsuint32# of frequencies that can be used (set at build time in the device flash image). Note: this is different from max_channels, this field is telling the # of frequency bands this node can use. (old name was num_channels)
max_channelsuint32The maximum number of 'software' channels that can be set on this node.
regionstringDeprecated! ONLY USED IN DEVICE CODE (for upgrading old 1.0 firmwares) DO NOT READ ELSEWHERE. The region code for my radio (US, CN, etc...) Note: This string is deprecated. The 1.0 builds populate it based on the flashed firmware name. But for newer builds this string will be unpopulated (missing/null). For those builds you should instead look at the new read/write region enum in UserSettings The format of this string was 1.0-US or 1.0-CN etc.. Or empty string if unset.
hw_model_deprecatedstringTBEAM, HELTEC, etc... Starting in 1.2.11 moved to hw_model enum in the NodeInfo object. Apps will still need the string here for older builds (so OTA update can find the right image), but if the enum is available it will be used instead.
firmware_versionstring0.0.5 etc...
error_codeCriticalErrorCodeAn error message we'd like to report back to the mothership through analytics. It indicates a serious bug occurred on the device, the device coped with it, but we still want to tell the devs about the bug. This field will be cleared after the phone reads MyNodeInfo (i.e. it will only be reported once) a numeric error code to go with error message, zero means no error
error_addressuint32A numeric error address (nonzero if available)
error_countuint32The total number of errors this node has ever encountered (well - since the last time we discarded preferences)
reboot_countuint32The total number of reboots this node has ever encountered (well - since the last time we discarded preferences)
message_timeout_msecuint32How long before we consider a message abandoned and we can clear our caches of any messages in flight Normally quite large to handle the worst case message delivery time, 5 minutes. Formerly called FLOOD_EXPIRE_TIME in the device code
min_app_versionuint32The minimum app version that can talk to this device. Phone/PC apps should compare this to their build number and if too low tell the user they must update their app

NodeInfo#

message description

The bluetooth to device link:

Old BTLE protocol docs from TODO, merge in above and make real docs...

use protocol buffers, and NanoPB

messages from device to phone: POSITION_UPDATE (..., time) TEXT_RECEIVED(from, text, time) OPAQUE_RECEIVED(from, payload, time) (for signal messages or other applications)

messages from phone to device: SET_MYID(id, human readable long, human readable short) (send down the unique ID string used for this node, a human readable string shown for that id, and a very short human readable string suitable for oled screen) SEND_OPAQUE(dest, payload) (for signal messages or other applications) SEND_TEXT(dest, text) Get all nodes() (returns list of nodes, with full info, last time seen, loc, battery level etc) SET_CONFIG (switches device to a new set of radio params and preshared key, drops all existing nodes, force our node to rejoin this new group)

Full information about a node on the mesh

FieldTypeDescription
numuint32the node number
userUserThe user info for this node
positionPositionThis position data. Note: before 1.2.14 we would also store the last time we've heard from this node in position.time, that is no longer true. Position.time now indicates the last time we received a POSITION from that node.
snrfloatReturns the Signal-to-noise ratio (SNR) of the last received message, as measured by the receiver. Return SNR of the last received message in dB
last_heardfixed32Set to indicate the last time we received a packet from this node

Position#

message description

a gps position

FieldTypeDescription
latitude_isfixed32The new preferred location encoding, divide by 1e-7 to get degrees in floating point
longitude_isfixed32none
altitudeint32In meters above MSL
battery_levelint321-100 (0 means not provided)
timefixed32This is usually not sent over the mesh (to save space), but it is sent from the phone so that the local device can set its RTC If it is sent over the mesh (because there are devices on the mesh without GPS), it will only be sent by devices which has a hardware GPS clock. seconds since 1970

RouteDiscovery#

message description

A message used in our Dynamic Source Routing protocol (RFC 4728 based)

FieldTypeDescription
routefixed32The list of nodenums this packet has visited so far

Routing#

message description

A Routing control Data packet handled by the routing plugin

FieldTypeDescription
oneof variant.route_requestRouteDiscoveryA route request going from the requester
oneof variant.route_replyRouteDiscoveryA route reply
oneof variant.error_reasonRouting.ErrorA failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide details on the type of failure).

ToRadio#

message description

packets/commands to the radio will be written (reliably) to the toRadio characteristic. Once the write completes the phone can assume it is handled.

FieldTypeDescription
oneof payloadVariant.packetMeshPacketsend this packet on the mesh
oneof payloadVariant.peer_infoToRadio.PeerInfoInformation about the peer, sent after the phone sneds want_config_id. Old clients do not send this, which is fine.
oneof payloadVariant.want_config_iduint32phone wants radio to send full node db to the phone, This is typically the first packet sent to the radio when the phone gets a bluetooth connection. The radio will respond by sending back a MyNodeInfo, a owner, a radio config and a series of FromRadio.node_infos, and config_complete the integer you write into this field will be reported back in the config_complete_id response this allows clients to never be confused by a stale old partially sent config.
oneof payloadVariant.disconnectboolTell API server we are disconnecting now. This is useful for serial links where there is no hardware/protocol based notification that the client has dropped the link. (Sending this message is optional for clients)

ToRadio.PeerInfo#

message description

Instead of sending want_config_id as a uint32, newer clients send this structure with information about the client.

FieldTypeDescription
app_versionuint32The numeric version code for the client application, which in some cases are used to control device behavior (so the device can make assumptions about who is using the API.
mqtt_gatewayboolTrue if the peer device can gateway MQTT packets. If true, the device will not try to send packets to the internet directly, instead it will pass the packets to the peer for dispatching. This feature is optional, if set to false the device will assume the client can not gateway to MQTT.

User#

message description

Broadcast when a newly powered mesh node wants to find a node num it can use Sent from the phone over bluetooth to set the user id for the owner of this node. Also sent from nodes to each other when a new node signs on (so all clients can have this info)

The algorithm is as follows: when a node starts up, it broadcasts their user and the normal flow is for all other nodes to reply with their User as well (so the new node can build its nodedb) If a node ever receives a User (not just the first broadcast) message where the sender node number equals our node number, that indicates a collision has occurred and the following steps should happen:

If the receiving node (that was already in the mesh)'s macaddr is LOWER than the new User who just tried to sign in: it gets to keep its nodenum. We send a broadcast message of OUR User (we use a broadcast so that the other node can receive our message, considering we have the same id - it also serves to let observers correct their nodedb) - this case is rare so it should be okay.

If any node receives a User where the macaddr is GTE than their local macaddr, they have been vetoed and should pick a new random nodenum (filtering against whatever it knows about the nodedb) and rebroadcast their User.

A few nodenums are reserved and will never be requested: 0xff - broadcast 0 through 3 - for future use

FieldTypeDescription
idstringA globally unique ID string for this user. In the case of Signal that would mean +16504442323, for the default macaddr derived id it would be !<8 hexidecimal bytes>. Note: app developers are encouraged to also use the following standard node IDs "^all" (for broadcast), "^local" (for the locally connected node)
long_namestringA full name for this user, i.e. "Kevin Hester"
short_namestringA VERY short name, ideally two characters. Suitable for a tiny OLED screen
macaddrbytesThis is the addr of the radio. Not populated by the phone, but added by the esp32 when broadcasting
hw_modelHardwareModelTBEAM, HELTEC, etc... Starting in 1.2.11 moved to hw_model enum in the NodeInfo object. Apps will still need the string here for older builds (so OTA update can find the right image), but if the enum is available it will be used instead.
is_licensedboolIn some regions HAM radio operators have different bandwidth limitations than others. If this user is a licensed operator, set this flag. Also, "long_name" should be their licence number.

Constants#

enum description

Shared constants between device and phone

NameNumberDescription
Unused0First enum must be zero, and we are just using this enum to pass int constants between two very different environments
DATA_PAYLOAD_LEN240From mesh.options note: this payload length is ONLY the bytes that are sent inside of the radiohead packet Data.payload max_size:240

CriticalErrorCode#

enum description

Error codes for critical errors

The device might report these fault codes on the screen. If you encounter a fault code, please post on the meshtastic.discourse.group and we'll try to help.

NameNumberDescription
None0none
TxWatchdog1A software bug was detected while trying to send lora
SleepEnterWait2A software bug was detected on entry to sleep
NoRadio3No Lora radio hardware could be found
Unspecified4Not normally used
UBloxInitFailed5We failed while configuring a UBlox GPS
NoAXP1926This board was expected to have a power management chip and it is missing or broken
InvalidRadioSetting7The channel tried to set a radio setting which is not supported by this chipset, radio comms settings are now undefined.
TransmitFailed8Radio transmit hardware failure. We sent data to the radio chip, but it didn't reply with an interrupt.
Brownout9We detected that the main CPU voltage dropped below the minumum acceptable value
SX1262Failure10Selftest of SX1262 radio chip failed
RadioSpiBug11A (likely software but possibly hardware) failure was detected while trying to send packets. If this occurs on your board, please post in the forum so that we can ask you to collect some information to allow fixing this bug

HardwareModel#

enum description

Note: these enum names must EXACTLY match the string used in the device bin/build-all.sh script. Because they will be used to find firmware filenames in the android app for OTA updates. To match the old style filenames, _ is converted to -, p is converted to .

NameNumberDescription
UNSET0none
TLORA_V21none
TLORA_V12none
TLORA_V2_1_1p63none
TBEAM4none
HELTEC5none
TBEAM0p76none
T_ECHO7none
TLORA_V1_1p38none
RAK46319none
LORA_RELAY_V132Less common/prototype boards listed here (needs one more byte over the air)
NRF52840DK33none
PPR34none
GENIEBLOCKS35none
NRF52_UNKNOWN36none
PORTDUINO37none
ANDROID_SIM38The simulator built into the android app

LogRecord.Level#

enum description

Log levels, chosen to match python logging conventions.

NameNumberDescription
UNSET0none
CRITICAL50none
ERROR40none
WARNING30none
INFO20none
DEBUG10none
TRACE5none

MeshPacket.Priority#

enum description

The priority of this message for sending. Higher priorities are sent first (when managing the transmit queue). This field is never sent over the air, it is only used internally inside of a local device node. API clients (either on the local node or connected directly to the node) can set this parameter if necessary.

(values must be <= 127 to keep protobuf field to one byte in size.

Detailed background on this field:

I noticed a funny side effect of lora being so slow: Usually when making a protocol there isn’t much need to use message priority to change the order of transmission (because interfaces are fairly fast). But for lora where packets can take a few seconds each, it is very important to make sure that critical packets are sent ASAP. In the case of meshtastic that means we want to send protocol acks as soon as possible (to prevent unneeded retransmissions), we want routing messages to be sent next, then messages marked as reliable and finally ‘background’ packets like periodic position updates.

So I bit the bullet and implemented a new (internal - not sent over the air) field in MeshPacket called ‘priority’. And the transmission queue in the router object is now a priority queue.

NameNumberDescription
UNSET0Treated as Priority.DEFAULT
MIN1none
BACKGROUND10Background position updates are sent with very low priority - if the link is super congested they might not go out at all
DEFAULT64This priority is used for most messages that don't have a priority set
RELIABLE70If priority is unset but the message is marked as want_ack, assume it is important and use a slightly higher priority
ACK120Ack/naks are sent with very high priority to ensure that retransmission stops as soon as possible
MAX127none

Routing.Error#

enum description

A failure in delivering a message (usually used for routing control messages, but might be provided in addition to ack.fail_id to provide details on the type of failure).

NameNumberDescription
NONE0This message is not a failure
NO_ROUTE1Our node doesn't have a route to the requested destination anymore.
GOT_NAK2We received a nak while trying to forward on your behalf
TIMEOUT3none
NO_INTERFACE4No suitable interface could be found for delivering this packet
MAX_RETRANSMIT5We reached the max retransmission count (typically for naive flood routing)
NO_CHANNEL6No suitable channel was found for sending this packet (i.e. was requested channel index disabled?)
TOO_LARGE7The packet was too big for sending (exceeds interface MTU after encoding)
NO_RESPONSE8The request had want_response set, the request reached the destination node, but no service on that node wants to send a response (possibly due to bad channel permissions)
BAD_REQUEST32The application layer service on the remote node received your request, but considered your request somehow invalid
NOT_AUTHORIZED33The application layer service on the remote node received your request, but considered your request not authorized (i.e you did not send the request on the required bound channel)

mqtt.proto#

ServiceEnvelope#

message description

This message wraps a MeshPacket with extra metadata about the sender and how it arrived.

FieldTypeDescription
packetMeshPacketThe (probably encrypted) packet
channel_idstringThe global channel ID it was sent on
gateway_idstringThe sending gateway node ID. Can we use this to authenticate/prevent fake nodeid impersonation for senders? - i.e. use gateway/mesh id (which is authenticated) + local node id as the globally trusted nodenum

portnums.proto#

PortNum#

enum description

For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a unique 'portnum' for their application.

If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to this master table. PortNums should be assigned in the following range:

0-63 Core Meshtastic use, do not use for third party apps 64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application 256-511 Use one of these portnums for your private applications that you don't want to register publically

All other values are reserved.

Note: This was formerly a Type enum named 'typ' with the same id #

We have change to this 'portnum' based scheme for specifying app handlers for particular payloads. This change is backwards compatible by treating the legacy OPAQUE/CLEAR_TEXT values identically.

NameNumberDescription
UNKNOWN_APP0Deprecated: do not use in new code (formerly called OPAQUE) A message sent from a device outside of the mesh, in a form the mesh does not understand NOTE: This must be 0, because it is documented in IMeshService.aidl to be so
TEXT_MESSAGE_APP1A simple UTF-8 text message, which even the little micros in the mesh can understand and show on their screen eventually in some circumstances even signal might send messages in this form (see below) Formerly called CLEAR_TEXT
REMOTE_HARDWARE_APP2A message receive acknowledgment, sent in cleartext - allows radio to show user that a message has been read by the recipient, optional Note: this concept has been removed for now. Once READACK is implemented, use the new packet type/port number stuff? @exclude CLEAR_READACK = 2; Reserved for built-in GPIO/example app. See remote_hardware.proto/HardwareMessage for details on the message sent/received to this port number
POSITION_APP3The built-in position messaging app. See Position for details on the message sent to this port number. payload is a Position protobuf
NODEINFO_APP4The built-in user info app. See User for details on the message sent to this port number. payload is a User protobuf
ROUTING_APP5Protocol control packets for mesh protocol use, payload is a Routing protobuf
ADMIN_APP6Admin control packets, payload is a AdminMessage protobuf
REPLY_APP32Provides a 'ping' service that replies to any packet it receives. Also this serves as a small example plugin.
IP_TUNNEL_APP33Used for the python IP tunnel feature
SERIAL_APP64Provides a hardware serial interface to send and receive from the Meshtastic network. Connect to the RX/TX pins of a device with 38400 8N1. Packets received from the Meshtastic network is forwarded to the RX pin while sending a packet to TX will go out to the Mesh network. Maximum packet size of 240 bytes. Plugin is disabled by default can be turned on by setting SERIALPLUGIN_ENABLED = 1 in SerialPlugh.cpp. Maintained by Jm Casler (MC Hamster) : jm@casler.org
STORE_FORWARD_APP65STORE_FORWARD_APP (Work in Progress) Maintained by Jm Casler (MC Hamster) : jm@casler.org
RANGE_TEST_APP66STORE_FORWARD_APP (Work in Progress) Maintained by Jm Casler (MC Hamster) : jm@casler.org
ENVIRONMENTAL_MEASUREMENT_APP67Provides a format to send and receive environmental data from the Meshtastic network. Maintained by Charles Crossan (crossan007) : crossan007@gmail.com
PRIVATE_APP256Private applications should use portnums >= 256. To simplify initial development and testing you can use "PRIVATE_APP" in your code without needing to rebuild protobuf files (via bin/regin_protos.sh)
ATAK_FORWARDER257ATAK Forwarder Plugin https://github.com/paulmandal/atak-forwarder
MAX511Currently we limit port nums to no higher than this value

radioconfig.proto#

RadioConfig#

message description

The entire set of user settable/readable settings for our radio device. Includes both the current channel settings and any preferences the user has set for behavior of their node

FieldTypeDescription
preferencesRadioConfig.UserPreferencesnone

RadioConfig.UserPreferences#

message description

see software design for more information on these preferences

FieldTypeDescription
position_broadcast_secsuint32We should send our position this often (but only if it has changed significantly) Defaults to 15 minutes
send_owner_intervaluint32Send our owner info at least this often (also we always send once at boot - to rejoin the mesh)
wait_bluetooth_secsuint32Power management state machine option. See power management for details. 0 for default of 1 minute
screen_on_secsuint32Power management state machine option. See power management for details. 0 for default of one minute
phone_timeout_secsuint32Power management state machine option. See power management for details. 0 for default of 15 minutes IMPORTANT NOTE FOR DEVICE CLIENTS: YOU MUST SEND SOME SORT OF PACKET TO THE PHONE AT LEAST THIS OFTEN OR THE DEVICE WILL DECIDE YOU ARE GONE!
phone_sds_timeout_secuint32Power management state machine option. See power management for details. 0 for default of two hours, MAXUINT for disabled
mesh_sds_timeout_secsuint32Power management state machine option. See power management for details. 0 for default of two hours, MAXUINT for disabled
sds_secsuint32Power management state machine option. See power management for details. 0 for default of one year
ls_secsuint32Power management state machine option. See power management for details. 0 for default of 3600
min_wake_secsuint32Power management state machine option. See power management for details. 0 for default of 10 seconds
wifi_ssidstringIf set, this node will try to join the specified wifi network and acquire an address via DHCP
wifi_passwordstringIf set, will be use to authenticate to the named wifi
wifi_ap_modeboolIf set, the node will operate as an AP (and DHCP server), otherwise it will be a station
regionRegionCodeThe region code for my radio (US, CN, EU433, etc...)
charge_currentChargeCurrentSets the current of the battery charger
is_routerboolAre we operating as a router. Changes behavior in the following ways: The device will only sleep for critically low battery level (i.e. always tries to stay alive for the mesh) In the future routing decisions will preferentially route packets through nodes with this attribute (because assumed good line of sight)
is_low_powerboolIf set, we are powered from a low-current source (i.e. solar), so even if it looks like we have power flowing in we should try to minimize power consumption as much as possible. YOU DO NOT NEED TO SET THIS IF YOU'VE set is_router (it is implied in that case).
fixed_positionboolIf set, this node is at a fixed position. We will generate GPS position updates at the regular interval, but use whatever the last lat/lon/alt we have for the node. The lat/lon/alt can be set by an internal GPS or with the help of the app.
serial_disabledboolIf set, this will disable the SerialConsole by not initilizing the StreamAPI
location_shareLocationSharingHow our location is shared with other nodes (or the local phone)
gps_operationGpsOperationHow the GPS hardware in this unit is operated. Note: This is independent of how our location is shared with other devices. For that see LocationSharing
gps_update_intervaluint32How often should we try to get GPS position (in seconds) when we are in GpsOpMobile mode? or zero for the default of once every 30 seconds or a very large value (maxint) to update only once at boot.
gps_attempt_timeuint32How long should we try to get our position during each gps_update_interval attempt? (in seconds) Or if zero, use the default of 30 seconds. If we don't get a new gps fix in that time, the gps will be put into sleep until the next gps_update_rate window.
frequency_offsetfloatThis parameter is for advanced users with advanced test equipment, we do not recommend most users use it. A frequency offset that is added to to the calculated band center frequency. Used to correct for crystal calibration errors.
mqtt_serverstringThe server to use for our MQTT global message gateway feature. If not set, the default server will be used
mqtt_disabledboolIf a meshtastic node is able to reach the internet it will normally attempt to gateway any channels that are marked as is_uplink_enabled or is_downlink_enabled. But if this flag is set, all MQTT features will be disabled and no servers will be contacted.
factory_resetboolThis setting is never saved to disk, but if set, all device settings will be returned to factory defaults. (Region, serial number etc... will be preserved)
debug_log_enabledboolBy default we turn off logging as soon as an API client connects (to keep shared serial link quiet). Set this to true to leave the debug log outputting even when API is active.
ignore_incominguint32If true, radio should not try to be smart about what packets to queue to the phone bool keep_all_packets = 101; If true, we will try to capture all the packets sent on the mesh, not just the ones destined to our node. bool promiscuous_mode = 102; For testing it is useful sometimes to force a node to never listen to particular other nodes (simulating radio out of range). All nodenums listed in ignore_incoming will have packets they send droped on receive (by router.cpp)
serialplugin_enabledboolPreferences for the SerialPlugin FIXME - Move this out of UserPreferences and into a section for plugin configuration.
serialplugin_echoboolnone
serialplugin_rxduint32none
serialplugin_txduint32none
serialplugin_timeoutuint32none
serialplugin_modeuint32none
ext_notification_plugin_enabledboolPreferences for the ExternalNotificationPlugin FIXME - Move this out of UserPreferences and into a section for plugin configuration.
ext_notification_plugin_output_msuint32none
ext_notification_plugin_outputuint32none
ext_notification_plugin_activeboolnone
ext_notification_plugin_alert_messageboolnone
ext_notification_plugin_alert_bellboolnone
range_test_plugin_enabledboolPreferences for the RangeTestPlugin FIXME - Move this out of UserPreferences and into a section for plugin configuration.
range_test_plugin_senderuint32none
range_test_plugin_saveboolnone
store_forward_plugin_enabledboolPreferences for the StoreForwardPlugin FIXME - Move this out of UserPreferences and into a section for plugin configuration. (was 136)
store_forward_plugin_recordsuint32none
environmental_measurement_plugin_measurement_enabledboolPreferences for the EnvironmentalMeasurement Plugin FIXME - Move this out of UserPreferences and into a section for plugin configuration. Enable/Disable the environmental measurement plugin measurement collection
environmental_measurement_plugin_screen_enabledboolEnable/Disable the environmental measurement plugin on-device display
environmental_measurement_plugin_read_error_count_thresholduint32Sometimes sensor reads can fail. If this happens, we will retry a configurable number of attempts, each attempt will be delayed by the minimum required refresh rate for that sensor
environmental_measurement_plugin_update_intervaluint32Interval in seconds of how often we should try to send our measurements to the mesh
environmental_measurement_plugin_recovery_intervaluint32Sometimes we can end up with more than read_error_count_threshold failures. In this case, we will stop trying to read from the sensor for a while. Wait this long until trying to read from the sensor again
environmental_measurement_plugin_display_farenheitboolWe'll always read the sensor in Celsius, but sometimes we might want to display the results in Farenheit as a "user preference".
environmental_measurement_plugin_sensor_typeRadioConfig.UserPreferences.EnvironmentalMeasurementSensorTypeSpecify the sensor type
environmental_measurement_plugin_sensor_pinuint32Specify the peferred GPIO Pin for sensor readings

ChargeCurrent#

enum description

Sets the charge control current of devices with a battery charger that can be configured. This is passed into the axp power management chip like on the tbeam.

NameNumberDescription
MAUnset0none
MA1001none
MA1902none
MA2803none
MA3604none
MA4505none
MA5506none
MA6307none
MA7008none
MA7809none
MA88010none
MA96011none
MA100012none
MA108013none
MA116014none
MA124015none
MA132016none

GpsOperation#

enum description

How the GPS hardware in this unit is operated. Note: This is independent of how our location is shared with other devices. For that see LocationSharing

NameNumberDescription
GpsOpUnset0This is treated as GpsOpMobile - it is the default setting
GpsOpStationary1Note: This mode was removed, because it is identical go GpsOpMobile with a gps_update_rate of once per day This node is mostly stationary, we should try to get location only once per day, Once we have that position we should turn the GPS to sleep mode This is the recommended configuration for stationary 'router' nodes
GpsOpMobile2This node is mobile and we should get GPS position at a rate governed by gps_update_rate
GpsOpTimeOnly3We should only use the GPS to get time (no location data should be acquired/stored) Once we have the time we treat gps_update_interval as MAXINT (i.e. sleep forever)
GpsOpDisabled4GPS is always turned off - this mode is not recommended - use GpsOpTimeOnly instead

LocationSharing#

enum description

How our location is shared with other nodes (or the local phone)

NameNumberDescription
LocUnset0This is the default and treated as LocEnabled.
LocEnabled1We are sharing our location
LocDisabled2We are not sharing our location (if the unit has a GPS it will default to only get time - i.e. GpsOpTimeOnly)

RadioConfig.UserPreferences.EnvironmentalMeasurementSensorType#

NameNumberDescription
DHT110none

RegionCode#

enum description

The frequency/regulatory region the user has selected.

Note: In 1.0 builds (which must still be supported by the android app for a long time) this field will be unpopulated.

If firmware is ever upgraded from an old 1.0ish build, the old MyNodeInfo.region string will be used to set UserPreferences.region and the old value will be no longer set.

NameNumberDescription
Unset0none
US1none
EU4332none
EU8653none
CN4none
JP5none
ANZ6none
KR7none
TW8none
RU9none

remote_hardware.proto#

HardwareMessage#

message description

An example app to show off the plugin system. This message is used for REMOTE_HARDWARE_APP PortNums.

Also provides easy remote access to any GPIO.

In the future other remote hardware operations can be added based on user interest (i.e. serial output, spi/i2c input/output).

FIXME - currently this feature is turned on by default which is dangerous because no security yet (beyond the channel mechanism). It should be off by default and then protected based on some TBD mechanism (a special channel once multichannel support is included?)

FieldTypeDescription
typHardwareMessage.TypeWhat type of HardwareMessage is this?
gpio_maskuint64What gpios are we changing. Not used for all MessageTypes, see MessageType for details
gpio_valueuint64For gpios that were listed in gpio_mask as valid, what are the signal levels for those gpios. Not used for all MessageTypes, see MessageType for details

HardwareMessage.Type#

NameNumberDescription
UNSET0Unset/unused
WRITE_GPIOS1Set gpio gpios based on gpio_mask/gpio_value
WATCH_GPIOS2We are now interested in watching the gpio_mask gpios. If the selected gpios change, please broadcast GPIOS_CHANGED. Will implicitly change the gpios requested to be INPUT gpios.
GPIOS_CHANGED3The gpios listed in gpio_mask have changed, the new values are listed in gpio_value
READ_GPIOS4Read the gpios specified in gpio_mask, send back a READ_GPIOS_REPLY reply with gpio_value populated
READ_GPIOS_REPLY5A reply to READ_GPIOS. gpio_mask and gpio_value will be populated