craigerl / aprsd

Amateur radio APRS daemon which listens for messages and responds. By KM6LYW.
Apache License 2.0
142 stars 21 forks source link

Help: send-message #179

Closed g0lgs closed 1 week ago

g0lgs commented 1 week ago

Hi,

I don't understand how to use the send-message function.

Any complete examples ?

I have tried several things, but it just appears to hang or give me errors:

aprsd send-message -c ~/.config/aprsd/aprsd.yml G0LGS-6 '/help'
2024-10-29 14:15:40.047 | MainThread         | INFO     | APRSD LISTEN Started version: 3.4.2 | aprsd.cmds.send_message:send_message:89
2024-10-29 14:15:40.047 | MainThread         | INFO     | L'G0LGS' To'G0LGS-6' C'/help' | aprsd.cmds.send_message:send_message:96
2024-10-29 14:15:40.048 | MainThread         | INFO     | Creating aprslib client(euro.aprs2.net:14580) and logging in G0LGS. | aprsd.client.aprsis:setup_connection:104
2024-10-29 14:15:40.048 | MainThread         | INFO     | Attempting connection to euro.aprs2.net:14580 | aprslib.inet:_connect:226
2024-10-29 14:15:40.087 | MainThread         | INFO     | Connected to ('85.188.1.129', 14580) | aprslib.inet:_connect:233
2024-10-29 14:15:40.169 | MainThread         | INFO     | Login successful | aprsd.client.drivers.aprsis:_send_login:148
2024-10-29 14:15:40.170 | MainThread         | INFO     | Connected to T2FINLAND | aprsd.client.drivers.aprsis:_send_login:150
2024-10-29 14:15:40.176 | MainThread         | INFO     | TX↑ MessagePacket:5335 (1 of 3) G0LGS → G0LGS-6 : /help | aprsd.packets.log:log:160
2024-10-29 14:15:40.977 | MainThread         | ERROR    | APRS Packet: b'G0LGS-6>APZS20,TCPIP*,qAC,T2NORWAY::G0LGS    :ack5335' | aprsd.client.drivers.aprsis:consumer:224
Traceback (most recent call last):
  File "/home/arthurw/.venv/bin/aprsd", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/aprsd/main.py", line 67, in main
    cli(auto_envvar_prefix="APRSD")
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/aprsd/cli_helper.py", line 128, in new_func
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/home/arthurw/.venv/lib/python3.12/site-packages/aprsd/cmds/send_message.py", line 164, in send_message
    aprs_client.consumer(rx_packet, raw=False)
  File "/home/arthurw/.venv/lib/python3.12/site-packages/aprsd/client/drivers/aprsis.py", line 189, in consumer
    callback(self._parse(line))
  File "/home/arthurw/.venv/lib/python3.12/site-packages/aprsd/cmds/send_message.py", line 106, in rx_packet
    packet.log("RX")
    ^^^^^^^^^^
AttributeError: 'AckPacket' object has no attribute 'log'

I can see on aprs.fi that G0LGS-6 tried to reply after it sent the :ack5335

hemna commented 1 week ago

Funny that you post this. I JUST fixed that bug about 10 minutes ago. The fix is in master branch if you know how to use aprsd from git. Otherwise I can publish a new version.

hemna commented 1 week ago

Here is a sample script that I use to send bulletins to aprs

#!/bin/bash

source ~/devel/mine/hamradio/aprsd/.venv/bin/activate

export APRS_LOGIN=REPEAT
export APRS_PASSWORD=YYYYY

aprsd send-message BLN0 Find 3 nearest 2meter repeaters?
sleep 2
aprsd send-message BLN1 Send Message to REPEAT: "nearest 3 2m"
sleep 2
aprsd send-message BLN2 See http://aprs-repeat.hemna.com
hemna commented 1 week ago

I just released v3.4.3 to pypi that has this fix.