Compare commits

...

4 Commits
2.7.0 ... 2.7.1

Author SHA1 Message Date
github-actions
d53ced216c bump version to 2.7.1 2025-08-18 19:40:36 +00:00
Ian McEwen
f5ecd28705 protobufs: v2.7.5 2025-08-18 09:52:48 -07:00
Ian McEwen
82ad9b2f51 Merge pull request #813 from pdxlocations/unmess-unmessageable
Fix --set-owner by calling setOwner!
2025-08-18 09:50:28 -07:00
pdxlocations
03aaa4c98e always call setOwner 2025-08-06 21:58:42 -07:00
5 changed files with 179 additions and 87 deletions

View File

@@ -343,37 +343,36 @@ def onConnected(interface):
closeNow = True closeNow = True
waitForAckNak = True waitForAckNak = True
# Validate owner names before connecting to device long_name = args.set_owner.strip() if args.set_owner else None
if args.set_owner is not None: short_name = args.set_owner_short.strip() if args.set_owner_short else None
stripped_long_name = args.set_owner.strip()
if not stripped_long_name:
meshtastic.util.our_exit("ERROR: Long Name cannot be empty or contain only whitespace characters")
if hasattr(args, 'set_owner_short') and args.set_owner_short is not None: if long_name is not None and not long_name:
stripped_short_name = args.set_owner_short.strip() meshtastic.util.our_exit("ERROR: Long Name cannot be empty or contain only whitespace characters")
if not stripped_short_name:
meshtastic.util.our_exit("ERROR: Short Name cannot be empty or contain only whitespace characters")
if args.set_owner and args.set_owner_short: if short_name is not None and not short_name:
print(f"Setting device owner to {args.set_owner} and short name to {args.set_owner_short}") meshtastic.util.our_exit("ERROR: Short Name cannot be empty or contain only whitespace characters")
elif args.set_owner:
print(f"Setting device owner to {args.set_owner}")
elif args.set_owner_short and not args.set_owner:
print(f"Setting device owner short to {args.set_owner_short}")
if args.set_is_unmessageable: if long_name and short_name:
print(f"Setting device owner to {long_name} and short name to {short_name}")
elif long_name:
print(f"Setting device owner to {long_name}")
elif short_name:
print(f"Setting device owner short to {short_name}")
unmessagable = None
if args.set_is_unmessageable is not None:
unmessagable = ( unmessagable = (
meshtastic.util.fromStr(args.set_is_unmessageable) meshtastic.util.fromStr(args.set_is_unmessageable)
if isinstance(args.set_is_unmessageable, str) if isinstance(args.set_is_unmessageable, str)
else args.set_is_unmessageable else args.set_is_unmessageable
) )
print(f"Setting device owner is_unmessageable to {unmessagable}")
if unmessagable is not None: interface.getNode(args.dest, False, **getNode_kwargs).setOwner(
print(f"Setting device owner is_unmessageable to {unmessagable}") long_name=long_name,
interface.getNode( short_name=short_name,
args.dest, False, **getNode_kwargs).setOwner(long_name=args.set_owner, is_unmessagable=unmessagable
short_name=args.set_owner_short, is_unmessagable=unmessagable )
)
if args.set_canned_message: if args.set_canned_message:
closeNow = True closeNow = True

View File

File diff suppressed because one or more lines are too long

View File

@@ -2382,6 +2382,83 @@ class MeshPacket(google.protobuf.message.Message):
The message is delayed and was originally a direct message The message is delayed and was originally a direct message
""" """
class _TransportMechanism:
ValueType = typing.NewType("ValueType", builtins.int)
V: typing_extensions.TypeAlias = ValueType
class _TransportMechanismEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[MeshPacket._TransportMechanism.ValueType], builtins.type):
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
TRANSPORT_INTERNAL: MeshPacket._TransportMechanism.ValueType # 0
"""
The default case is that the node generated a packet itself
"""
TRANSPORT_LORA: MeshPacket._TransportMechanism.ValueType # 1
"""
Arrived via the primary LoRa radio
"""
TRANSPORT_LORA_ALT1: MeshPacket._TransportMechanism.ValueType # 2
"""
Arrived via a secondary LoRa radio
"""
TRANSPORT_LORA_ALT2: MeshPacket._TransportMechanism.ValueType # 3
"""
Arrived via a tertiary LoRa radio
"""
TRANSPORT_LORA_ALT3: MeshPacket._TransportMechanism.ValueType # 4
"""
Arrived via a quaternary LoRa radio
"""
TRANSPORT_MQTT: MeshPacket._TransportMechanism.ValueType # 5
"""
Arrived via an MQTT connection
"""
TRANSPORT_MULTICAST_UDP: MeshPacket._TransportMechanism.ValueType # 6
"""
Arrived via Multicast UDP
"""
TRANSPORT_API: MeshPacket._TransportMechanism.ValueType # 7
"""
Arrived via API connection
"""
class TransportMechanism(_TransportMechanism, metaclass=_TransportMechanismEnumTypeWrapper):
"""
Enum to identify which transport mechanism this packet arrived over
"""
TRANSPORT_INTERNAL: MeshPacket.TransportMechanism.ValueType # 0
"""
The default case is that the node generated a packet itself
"""
TRANSPORT_LORA: MeshPacket.TransportMechanism.ValueType # 1
"""
Arrived via the primary LoRa radio
"""
TRANSPORT_LORA_ALT1: MeshPacket.TransportMechanism.ValueType # 2
"""
Arrived via a secondary LoRa radio
"""
TRANSPORT_LORA_ALT2: MeshPacket.TransportMechanism.ValueType # 3
"""
Arrived via a tertiary LoRa radio
"""
TRANSPORT_LORA_ALT3: MeshPacket.TransportMechanism.ValueType # 4
"""
Arrived via a quaternary LoRa radio
"""
TRANSPORT_MQTT: MeshPacket.TransportMechanism.ValueType # 5
"""
Arrived via an MQTT connection
"""
TRANSPORT_MULTICAST_UDP: MeshPacket.TransportMechanism.ValueType # 6
"""
Arrived via Multicast UDP
"""
TRANSPORT_API: MeshPacket.TransportMechanism.ValueType # 7
"""
Arrived via API connection
"""
FROM_FIELD_NUMBER: builtins.int FROM_FIELD_NUMBER: builtins.int
TO_FIELD_NUMBER: builtins.int TO_FIELD_NUMBER: builtins.int
CHANNEL_FIELD_NUMBER: builtins.int CHANNEL_FIELD_NUMBER: builtins.int
@@ -2402,6 +2479,7 @@ class MeshPacket(google.protobuf.message.Message):
NEXT_HOP_FIELD_NUMBER: builtins.int NEXT_HOP_FIELD_NUMBER: builtins.int
RELAY_NODE_FIELD_NUMBER: builtins.int RELAY_NODE_FIELD_NUMBER: builtins.int
TX_AFTER_FIELD_NUMBER: builtins.int TX_AFTER_FIELD_NUMBER: builtins.int
TRANSPORT_MECHANISM_FIELD_NUMBER: builtins.int
to: builtins.int to: builtins.int
""" """
The (immediate) destination for this packet The (immediate) destination for this packet
@@ -2509,6 +2587,10 @@ class MeshPacket(google.protobuf.message.Message):
Timestamp after which this packet may be sent. Timestamp after which this packet may be sent.
Set by the firmware internally, clients are not supposed to set this. Set by the firmware internally, clients are not supposed to set this.
""" """
transport_mechanism: global___MeshPacket.TransportMechanism.ValueType
"""
Indicates which transport mechanism this packet arrived over
"""
@property @property
def decoded(self) -> global___Data: def decoded(self) -> global___Data:
""" """
@@ -2537,9 +2619,10 @@ class MeshPacket(google.protobuf.message.Message):
next_hop: builtins.int = ..., next_hop: builtins.int = ...,
relay_node: builtins.int = ..., relay_node: builtins.int = ...,
tx_after: builtins.int = ..., tx_after: builtins.int = ...,
transport_mechanism: global___MeshPacket.TransportMechanism.ValueType = ...,
) -> None: ... ) -> None: ...
def HasField(self, field_name: typing.Literal["decoded", b"decoded", "encrypted", b"encrypted", "payload_variant", b"payload_variant"]) -> builtins.bool: ... def HasField(self, field_name: typing.Literal["decoded", b"decoded", "encrypted", b"encrypted", "payload_variant", b"payload_variant"]) -> builtins.bool: ...
def ClearField(self, field_name: typing.Literal["channel", b"channel", "decoded", b"decoded", "delayed", b"delayed", "encrypted", b"encrypted", "from", b"from", "hop_limit", b"hop_limit", "hop_start", b"hop_start", "id", b"id", "next_hop", b"next_hop", "payload_variant", b"payload_variant", "pki_encrypted", b"pki_encrypted", "priority", b"priority", "public_key", b"public_key", "relay_node", b"relay_node", "rx_rssi", b"rx_rssi", "rx_snr", b"rx_snr", "rx_time", b"rx_time", "to", b"to", "tx_after", b"tx_after", "via_mqtt", b"via_mqtt", "want_ack", b"want_ack"]) -> None: ... def ClearField(self, field_name: typing.Literal["channel", b"channel", "decoded", b"decoded", "delayed", b"delayed", "encrypted", b"encrypted", "from", b"from", "hop_limit", b"hop_limit", "hop_start", b"hop_start", "id", b"id", "next_hop", b"next_hop", "payload_variant", b"payload_variant", "pki_encrypted", b"pki_encrypted", "priority", b"priority", "public_key", b"public_key", "relay_node", b"relay_node", "rx_rssi", b"rx_rssi", "rx_snr", b"rx_snr", "rx_time", b"rx_time", "to", b"to", "transport_mechanism", b"transport_mechanism", "tx_after", b"tx_after", "via_mqtt", b"via_mqtt", "want_ack", b"want_ack"]) -> None: ...
def WhichOneof(self, oneof_group: typing.Literal["payload_variant", b"payload_variant"]) -> typing.Literal["decoded", "encrypted"] | None: ... def WhichOneof(self, oneof_group: typing.Literal["payload_variant", b"payload_variant"]) -> typing.Literal["decoded", "encrypted"] | None: ...
global___MeshPacket = MeshPacket global___MeshPacket = MeshPacket
@@ -3493,9 +3576,17 @@ class Heartbeat(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor DESCRIPTOR: google.protobuf.descriptor.Descriptor
NONCE_FIELD_NUMBER: builtins.int
nonce: builtins.int
"""
The nonce of the heartbeat message
"""
def __init__( def __init__(
self, self,
*,
nonce: builtins.int = ...,
) -> None: ... ) -> None: ...
def ClearField(self, field_name: typing.Literal["nonce", b"nonce"]) -> None: ...
global___Heartbeat = Heartbeat global___Heartbeat = Heartbeat

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "meshtastic" name = "meshtastic"
version = "2.7.0" version = "2.7.1"
description = "Python API & client shell for talking to Meshtastic devices" description = "Python API & client shell for talking to Meshtastic devices"
authors = ["Meshtastic Developers <contact@meshtastic.org>"] authors = ["Meshtastic Developers <contact@meshtastic.org>"]
license = "GPL-3.0-only" license = "GPL-3.0-only"