Add functionality to the python ingestor to determine channel number and name for received message packages. The following script shows how to get the correct values from the interface (example):
If role is 1, the channel is PRIMARY and does not have a name or index. Set the channel index to 0 and the name to the MODEM_PRESET constant if available or to the CHANNEL env variable as fallback.
If the role is 2, take the channel index from chan[i].index and the channel name from chan[i].settings.name
Keep this array of channel index and channel name tuples around during runtime, they will never change during runtime, we will need this for message packages.
Now, each message package we receive gets matched for channel index number (often just called channel) and appended the field channel_name that matches the channel settings name from the aforementioned tuple so that we tag each message with a human-readable channel name. Do that before posting them to the potatomesh instance API.
If the channel is not known, or the index does not have a name, or the package is encrypted, do not set the channel_name.
Before #124
Add functionality to the python ingestor to determine channel number and name for received message packages. The following script shows how to get the correct values from the interface (example):
```
from meshtastic.mesh_interface import MeshInterface
from meshtastic.serial_interface import SerialInterface
from meshtastic.protobuf import channel_pb2
ifce: MeshInterface = SerialInterface("/dev/ttyACM0")
node = ifce.localNode
chan = node.channels
print(chan[0])
# settings {
# psk: "\001"
# module_settings {
# position_precision: 15
# }
# }
# role: PRIMARY
print(chan[1])
# index: 1
# settings {
# psk: "\001"
# name: "TEST"
# module_settings {
# position_precision: 15
# }
# }
# role: SECONDARY
```
If role is `1`, the channel is PRIMARY and does not have a name or index. Set the channel index to `0` and the name to the MODEM_PRESET constant if available or to the CHANNEL env variable as fallback.
If the role is `2`, take the channel index from chan[i].index and the channel name from chan[i].settings.name
Keep this array of channel index and channel name tuples around during runtime, they will never change during runtime, we will need this for message packages.
Now, each message package we receive gets matched for channel index number (often just called channel) and appended the field channel_name that matches the channel settings name from the aforementioned tuple so that we tag each message with a human-readable channel name. Do that before posting them to the potatomesh instance API.
If the channel is not known, or the index does not have a name, or the package is encrypted, do not set the channel_name.
<!-- github-sync-id:3511374870 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Before #124
Add functionality to the python ingestor to determine channel number and name for received message packages. The following script shows how to get the correct values from the interface (example):
If role is
1, the channel is PRIMARY and does not have a name or index. Set the channel index to0and the name to the MODEM_PRESET constant if available or to the CHANNEL env variable as fallback.If the role is
2, take the channel index from chan[i].index and the channel name from chan[i].settings.nameKeep this array of channel index and channel name tuples around during runtime, they will never change during runtime, we will need this for message packages.
Now, each message package we receive gets matched for channel index number (often just called channel) and appended the field channel_name that matches the channel settings name from the aforementioned tuple so that we tag each message with a human-readable channel name. Do that before posting them to the potatomesh instance API.
If the channel is not known, or the index does not have a name, or the package is encrypted, do not set the channel_name.