Saturday, September 12, 2015

Ephemeris emails

Along with the headless mode, you can now send ephemeris emails to whoever you want.
The email you'd receive would look like this:

Ephemeris for 12 Sep 2015

At N  37°46.00' / W 122°31.00'
Sun Rise:12 Sep 2015 06:52
Sun Set :12 Sep 2015 19:20
Moon Phase: 28 day(s).

Tide at Ocean Beach:
LW Sat Sep 12 04:52:00 PDT 2015 : +0.40 feet
HW Sat Sep 12 11:34:00 PDT 2015 : +5.27 feet
LW Sat Sep 12 17:09:00 PDT 2015 : +1.45 feet
HW Sat Sep 12 23:14:00 PDT 2015 : +5.47 feet


For this, you need to set some preferences:
  • The position is used for the sun rise and set
  • The tide station must be spelled exactly as in the tide application (in the Navigation Console)
  • You can send to several recepients, separated with a semi-column
  • The timezone is used to display the sun ephemeris
  • The email provider refers to the file ephemeris.email.properties, see below
ephemeris.email.properties, this file must be in the all-scripts directory.
ee.yahoo.mail.protocol=pop3
ee.yahoo.incoming.server=pop.mail.yahoo.com
ee.yahoo.outgoing.server=smtp.mail.yahoo.com
ee.yahoo.mail.smtpauth=true
ee.yahoo.outgoing.server.port=587
ee.yahoo.mail.username=olivier.lediouris
ee.yahoo.mail.password=XXXXXX
ee.yahoo.mail.replyto=olivier@lediouris.net
#
ee.google.mail.protocol=pop3
ee.google.incoming.server=pop.gmail.com
ee.google.outgoing.server=smtp.gmail.com
ee.google.mail.smtpauth=true
ee.google.outgoing.server.port=465
ee.google.incoming.server.port=995
ee.google.mail.username=olivier.lediouris@gmail.com
ee.google.mail.password=XXXXXX
ee.google.mail.replyto=olivier.lediouris@gmail.com
#
ee.oracle.mail.protocol=imap
ee.oracle.incoming.server=stbeehive.oracle.com
ee.oracle.outgoing.server=stbeehive.oracle.com
ee.oracle.mail.smtpauth=true
ee.oracle.outgoing.server.port=465
ee.oracle.incoming.server.port=993
ee.oracle.mail.username=olivier.lediouris@oracle.com
ee.oracle.mail.password=XXXXXX
ee.oracle.mail.replyto=olivier.lediouris@oracle.com
#
The email provider mentionned in the preferences can be in this example yahoo, google, or oracle.
When all this is set, you have to modify the command line that starts the Weather Wizard in headless mode:
set JAVA_OPTIONS=%JAVA_OPTIONS% -Dheadless=true -Dephemeris.email=true -Dstart.ephemeris.loop.at=05:00
This will generate the email displayed above every day at 5am local time.
Enjoy!
PS: The code is in github, see below for details.