Skip to content

Commit

Permalink
Bug fixes with message notification handling - N8ACL - 11232024
Browse files Browse the repository at this point in the history
  • Loading branch information
n8acl committed Nov 23, 2024
1 parent 2dc5eac commit dd906fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ If you reach out to me and have an error, please include what error you are gett
## Change Log
Changes Prior to current year have been moved to the [ChangeLog](https://n8acl.github.io/aprsnotify/changelog/) on the wiki.

## Version 1.0.1 - Released 11/23/2024
## Changed
- Fixed a couple of bugs with handling message notifcations



## Version 1.0.0 - Released 10/30/2024
## Added
- Now uses the Apprise notification library for service notifiction support.
Expand Down
13 changes: 7 additions & 6 deletions aprsnotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
server_timezone = "Etc/UTC"
localFormat = "%Y-%m-%d %H:%M:%S"
localFormat_time = "%H:%M:%S"
localFormat_date = "%Y-%m-%d"

######################################################################################################################
## Define Functions
Expand Down Expand Up @@ -500,25 +501,25 @@ def send_msg(apobj, tag, msg, title):
data = get_api_data_payload(aprsfi_url,aprsfi_msg_payload)

for x in range(0,data['found']):
if int(data['entries'][x]["time"]) > get_last_timestamp(data['entries'][x]["dst"],'MSG'):
if int(data['entries'][x]["messageid"]) > get_last_timestamp(data['entries'][x]["dst"],'MSG'):
srccall = data['entries'][x]["srccall"]
dstcall = data['entries'][x]["dst"]
msg = data['entries'][x]["message"]
dtstamp = data['entries'][x]["time"]
lastmsgid = data['entries'][x]["messageid"]

msg_timestamp = datetime.datetime.fromtimestamp(int(dtstamp)).strftime('%H:%M:%S')
msg_datestamp = datetime.datetime.fromtimestamp(int(dtstamp)).strftime('%m/%d/%Y')
msg_timestamp = convert_local_time(int(dtstamp)).strftime(localFormat_time)
msg_datestamp = convert_local_time(int(dtstamp)).strftime(localFormat_date)

# create msg status and send to Telegram
msg_status = "On " + msg_datestamp + " at " + msg_timestamp + ", " + srccall + " sent " + dstcall + " the following APRS message: " + msg
title = "Message Notification"

if use_apprise_api:
send_msg_api('MSG', status, title)
send_msg_api('MSG', msg_status, title)
else:
send_msg(apobj, 'MSG', status, title)
send_msg(apobj, 'MSG', msg_status, title)

update_last_timestamp(station,'MSG', lastmsgid)
update_last_timestamp(dstcall,'MSG', lastmsgid)

sleep(delay_time)

0 comments on commit dd906fd

Please sign in to comment.