1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-21 23:55:17 -05:00
Go to file
Hemna 96bae795a5 Fix unknown characterset emails
Some emails that had an unknown character set.  when that happens
we can't decode the body of the message properly, so the default body
string was being used, and was attempting to be decoded.  Only byte
strings can be decoded, so the default string is now labeled as a byte
encoding.
2020-12-15 17:59:17 -05:00
.github/workflows Refactor networking and commands 2020-12-11 19:29:18 -05:00
aprsd Fix unknown characterset emails 2020-12-15 17:59:17 -05:00
build Updates for building containers 2020-12-15 10:32:53 -05:00
examples/plugins Fixed the usage string after plugins introduced 2020-12-13 21:51:39 -05:00
tests Update tox environment to fix formatting python errors 2020-12-11 08:47:56 -05:00
tools Added tox support 2019-05-15 20:12:59 +00:00
.gitignore First stab at migrating this to a pytpi repo 2018-11-21 13:56:29 -08:00
dev-requirements.in Reworked Plugin loading 2020-12-15 07:50:10 -05:00
dev-requirements.txt Reworked Plugin loading 2020-12-15 07:50:10 -05:00
docker-compose.yml Updates for building containers 2020-12-15 10:32:53 -05:00
Dockerfile Updates for building containers 2020-12-15 10:32:53 -05:00
Dockerfile-dev Updates for building containers 2020-12-15 10:32:53 -05:00
INSTALL.txt Update INSTALL.txt 2020-12-09 08:05:08 -08:00
MANIFEST.in First stab at migrating this to a pytpi repo 2018-11-21 13:56:29 -08:00
README.rst Updated README with a TOC 2020-12-15 10:51:02 -05:00
requirements.in Reworked Plugin loading 2020-12-15 07:50:10 -05:00
requirements.txt Reworked Plugin loading 2020-12-15 07:50:10 -05:00
setup.cfg Rewrote the README.md to README.rst 2020-12-14 11:35:10 -05:00
setup.py Update tox environment to fix formatting python errors 2020-12-11 08:47:56 -05:00
test-requirements-py2.txt Update tox environment to fix formatting python errors 2020-12-11 08:47:56 -05:00
test-requirements.txt Initial conversion to click 2020-12-09 09:47:37 -05:00
tox.ini Created plugin.py for Command Plugins 2020-12-13 20:57:30 -05:00

=====
APRSD
=====

.. image:: https://github.com/craigerl/aprsd/workflows/python/badge.svg
    :target: https://github.com/craigerl/aprsd/actions

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://black.readthedocs.io/en/stable/

.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
    :target: https://timothycrosley.github.io/isort/

.. contents:: :local:

Listen on amateur radio aprs-is network for messages and respond to them.
You must have an amateur radio callsign to use this software.  Put  your
callsign in the "USER" variable and update your aprs-is password in "PASS".
You must also have an imap email account available for polling.

Current messages this will respond to:
--------------------------------------

::

  APRS messages:
   l(ocation) [callsign]  = descriptive current location of your radio
                            8 Miles E Auburn CA 1673' 39.92150,-120.93950 0.1h ago
   w(eather)              = weather forecast for your radio's current position
                            58F(58F/46F) Partly Cloudy. Tonight, Heavy Rain.
   t(ime)                 = respond with the current time
   f(ortune)              = respond with a short fortune
   -email_addr email text = send an email, say "mapme" to send a current position/map
   -2                     = resend the last 2 emails from your imap inbox to this radio
   p(ing)                 = respond with Pong!/time
   anything else          = respond with usage


Meanwhile this code will monitor a single imap mailbox and forward email
to your BASECALLSIGN over the air.  Only radios using the BASECALLSIGN are allowed
to send email, so consider this security risk before using this (or Amatuer radio in
general).  Email is single user at this time.

There are additional parameters in the code (sorry), so be sure to set your
email server, and associated logins, passwords.  search for "yourdomain",
"password".  Search for "shortcuts" to setup email aliases as well.


Installation:
-------------

  pip install aprsd

Example usage:
==============

  aprsd -h

Example output:
---------------

SEND EMAIL (radio to smtp server)
=================================

::

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :-user@host.com test new shortcuts global, radio to pc{29
    From        : KM6XXX
    Message     : -user@host.com test new shortcuts global, radio to pc
    Msg number  : 29

    Sending Email_________________
    To          : user@host.com
    Subject     : KM6XXX
    Body        : test new shortcuts global, radio to pc

    Sending ack __________________ Tx(3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :ack29
    To          : KM6XXX
    Ack number  : 29


RECEIVE EMAIL (imap server to radio)
====================================

::

    Sending message_______________ 6(Tx3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :-somebody@gmail.com email from internet to radio{6
    To          : KM6XXX
    Message     : -somebody@gmail.com email from internet to radio

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack6
    From        : KM6XXX
    Message     : ack6
    Msg number  : 0


WEATHER
=======

::

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :weather{27
    From        : KM6XXX
    Message     : weather
    Msg number  : 27

    Sending message_______________ 6(Tx3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :58F(58F/46F) Partly cloudy. Tonight, Heavy Rain.{6
    To          : KM6XXX
    Message     : 58F(58F/46F) Party Cloudy. Tonight, Heavy Rain.

    Sending ack __________________ Tx(3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :ack27
    To          : KM6XXX
    Ack number  : 27

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack6
    From        : KM6XXX
    Message     : ack6
    Msg number  : 0


LOCATION
========

::

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :location{28
    From        : KM6XXX
    Message     : location
    Msg number  : 28

    Sending message_______________ 7(Tx3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :8 Miles NE Auburn CA 1673' 39.91150,-120.93450 0.1h ago{7
    To          : KM6XXX   
    Message     : 8 Miles E Auburn CA 1673' 38.91150,-120.93450 0.1h ago

    Sending ack __________________ Tx(3)
    Raw         : KM6XXX-9>APRS::KM6XXX   :ack28
    To          : KM6XXX   
    Ack number  : 28

    Received message______________
    Raw         : KM6XXX>APY400,WIDE1-1,qAO,KM6XXX-1::KM6XXX-9 :ack7
    From        : KM6XXX
    Message     : ack7
    Msg number  : 0

AND... ping, fortune, time.....


Development
-----------

Workflow
========

While working aprsd, The workflow is as follows

* Edit code, save file
* run tox -epep8
* run tox -efmt
* run tox -p
* git commit


Release
=======

To do release to pypi:

* Tag release with 

   git tag -v1.XX -m "New release"

* push release tag up

  git push origin master --tags

* Build dist and wheel

  python setup.py sdist bdist_wheel

* Verify build is valid for pypi (need twine installed )

  pip install twine
  twine check dist/*

* Once twine is happy, upload release to pypi

  twine upload dist/*


Docker Container
----------------

Building
========

There are 2 versions of the container Dockerfile that can be used.
The main Dockerfile, which is for building the official release container
based off of the pip install version of aprsd and the Dockerfile-dev,
which is used for building a container based off of a git branch of
the repo.

Official Build
==============

 docker build -t hemna6969/aprsd:latest .

Development Build
=================

 docker build -t hemna6969/aprsd:latest -f Dockerfile-dev .


Running the container
=====================

There is a docker-compose.yml file that can be used to run your container.
There are 2 volumes defined that can be used to store your configuration
and the plugins directory:  /config and /plugins

If you want to install plugins at container start time, then use the
environment var in docker-compose.yml specified as APRS_PLUGINS
Provide a csv list of pypi installable plugins.  Then make sure the plugin
python file is in your /plugins volume and the plugin will be installed at
container startup.  The plugin may have dependencies that are required.
The plugin file should be copied to /plugins for loading by aprsd