Skip to main content

Announce range closure as sunset approaches

Project description

Announce that the range is closing.

** The application is designed to run on Raspberry Pi 3B or newer. **

Between Midnight and Noon the application synchronizes the time on the Raspberry Pi with an atomic time server. It calculates the sunset for the day given the date from the OS and the longetude and latitude values provided in the ini file. It calculates the amount of time between now and one hour, one minute before sunset then goes to sleep for that long an interval.

Features

  • Calculates the sunset for the current date and location.
  • Uses a Shelly 1PM switch to turn the power on and off for an external amplifier.
  • Plays recorded messages announcing impending range closure at:
    • 1 hour before sunset
    • 30 minutes before sunset
    • 15 minutes before sunset
    • 5 minutes before sunset
    • at sunset
  • Can be started at any time and it will play the required messages.
  • Loops indefinitely...start it once and let it run.
    • Note: The application spends almost all of the time performing a sleep operation so it is not using CPU or resources.
  • Logs information to Range_Announcer_Log.txt

Requirements:

The application is intended to be run on Raspberry Pi 3B or newer with a wireless network interface and sound output jack.

The program requires inputs for:

  1. The longitude and latitude of the location.
  2. The IP address for the Shelly 1PM switch.
  3. The URLs to turn the Shelly switch on and off.
  4. A delay time to account for the delay between when the amp is powered on and when it is functioning.

These inputs are stored in the file rangeannouncer.json

Installation

To install the application run the command:
sudo pip install --upgrade range_announcer
This will install the application launcher: /usr/local/bin/RangeAnnouncer

Usage

The application is intended to be run unattended on a Raspberry Pi and start automatically.
To do that perform the following steps:

  1. Open a terminal and type: sudo nano /etc/rc.local
  2. Add the following command before the 'exit 0':
    sudo /usr/local/bin/RangeAnnouncer &
    The trailing & must be in place to fork a new process...this program doesn't normally end.
  3. In nano type Ctrl-x, then Y to save and exit.

This program will create a log in /srv/RangeAnnouncer logging informational, debug and error messages.

Notes

On Raspberry Pi I had to edit /etc/pulse/daemon.conf to set

alternate-sample-rate=48000
default-fragments=5
default-fragment-size-msec=12

History

Range Announcer is the first python application written and released by Michael J. Swenson. Built using PyCharm 2022.3.1 Community edition.

License

Range Announcer is licensed under the BSD-3-Clause license (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

range_announcer-1.3.2.tar.gz (9.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

range_announcer-1.3.2-py3-none-any.whl (9.3 MB view details)

Uploaded Python 3

File details

Details for the file range_announcer-1.3.2.tar.gz.

File metadata

  • Download URL: range_announcer-1.3.2.tar.gz
  • Upload date:
  • Size: 9.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.1

File hashes

Hashes for range_announcer-1.3.2.tar.gz
Algorithm Hash digest
SHA256 604cce3b3c8c80a7a6c8bcd8705988a812e52a22d12c2ddd1f256c87c6e9c49a
MD5 a4d1c262ea26070c1d0c5bc64fd7657e
BLAKE2b-256 eb2597b59efd184c87b6fb4fc3346aa664e76fc8e4521563ad5439dc4cd253b3

See more details on using hashes here.

File details

Details for the file range_announcer-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for range_announcer-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a72be09620b7922c860a975cf84d45568b9db0e696023ae2ea0f0cadcfb60c5c
MD5 bf0c6abb6f8b6150b239d68e9016663d
BLAKE2b-256 980fcf44287283e6b9cbb54031fd06ac16b87006a68145134b6fe0ba5481a6c3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page