diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 4b36f8d..18ea484 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -442,7 +442,8 @@ def onConnected(interface): channelIndex = mt_config.channel_index or 0 if checkChannel(interface, channelIndex): print( - f"Sending text message {args.sendtext} to {args.dest} on channelIndex:{channelIndex} {"using PRIVATE_APP port" if args.private else ""}" + f"Sending text message {args.sendtext} to {args.dest} on channelIndex:{channelIndex}" + f" {'using PRIVATE_APP port' if args.private else ''}" ) interface.sendText( args.sendtext, diff --git a/meshtastic/mesh_interface.py b/meshtastic/mesh_interface.py index ddc938d..b05157b 100644 --- a/meshtastic/mesh_interface.py +++ b/meshtastic/mesh_interface.py @@ -354,7 +354,7 @@ class MeshInterface: # pylint: disable=R0902 wantResponse: bool = False, onResponse: Optional[Callable[[dict], Any]] = None, channelIndex: int = 0, - portNum: int = portnums_pb2.PortNum.TEXT_MESSAGE_APP + portNum: portnums_pb2.PortNum.ValueType = portnums_pb2.PortNum.TEXT_MESSAGE_APP ): """Send a utf8 string to some other node, if the node has a display it will also be shown on the device. diff --git a/meshtastic/tests/test_main.py b/meshtastic/tests/test_main.py index 86d3ad2..7f99c84 100644 --- a/meshtastic/tests/test_main.py +++ b/meshtastic/tests/test_main.py @@ -593,10 +593,10 @@ def test_main_sendtext(capsys): iface = MagicMock(autospec=SerialInterface) def mock_sendText( - text, dest, wantAck=False, wantResponse=False, onResponse=None, channelIndex=0 + text, dest, wantAck=False, wantResponse=False, onResponse=None, channelIndex=0, portNum=0 ): print("inside mocked sendText") - print(f"{text} {dest} {wantAck} {wantResponse} {channelIndex}") + print(f"{text} {dest} {wantAck} {wantResponse} {channelIndex} {portNum}") iface.sendText.side_effect = mock_sendText @@ -620,10 +620,10 @@ def test_main_sendtext_with_channel(capsys): iface = MagicMock(autospec=SerialInterface) def mock_sendText( - text, dest, wantAck=False, wantResponse=False, onResponse=None, channelIndex=0 + text, dest, wantAck=False, wantResponse=False, onResponse=None, channelIndex=0, portNum=0 ): print("inside mocked sendText") - print(f"{text} {dest} {wantAck} {wantResponse} {channelIndex}") + print(f"{text} {dest} {wantAck} {wantResponse} {channelIndex} {portNum}") iface.sendText.side_effect = mock_sendText