{"id":19807909,"url":"https://github.com/slayingripper/fireaprs","last_synced_at":"2025-02-28T12:40:24.925Z","repository":{"id":170932641,"uuid":"518800068","full_name":"Slayingripper/FireAPRS","owner":"Slayingripper","description":"Grabs Data from weather satellites and posts them to APRS.FI ","archived":false,"fork":false,"pushed_at":"2025-01-23T18:35:29.000Z","size":5428,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T19:29:20.466Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Slayingripper.png","metadata":{"files":{"readme":"README.md","changelog":"news.py","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-28T10:26:17.000Z","updated_at":"2025-01-23T18:35:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a94ec67-789c-4dcb-b819-d78b4a5b54a2","html_url":"https://github.com/Slayingripper/FireAPRS","commit_stats":null,"previous_names":["slayingripper/fireaprs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slayingripper%2FFireAPRS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slayingripper%2FFireAPRS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slayingripper%2FFireAPRS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Slayingripper%2FFireAPRS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Slayingripper","download_url":"https://codeload.github.com/Slayingripper/FireAPRS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241151187,"owners_count":19918425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T09:12:21.318Z","updated_at":"2025-02-28T12:40:24.918Z","avatar_url":"https://github.com/Slayingripper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FireAPRS\n\n![APRS World](icon/aprs_world_5in.png)\n\nFireAPRS utilizes NASA's VIIRS satellite data to monitor and plot the locations of active fires within a specified geographical area on the APRS network over the past 24 hours. This tool offers flexibility through its configuration file, allowing users to define any geographical \"box\" of interest and customize various operational parameters.\n\n## Table of Contents\n\n- [FireAPRS](#fireaprs)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n    - [Configuration File Structure](#configuration-file-structure)\n  - [Usage](#usage)\n    - [Command-Line Arguments](#command-line-arguments)\n    - [Running the Tool](#running-the-tool)\n    - [Example APRS Messages](#example-aprs-messages)\n  - [Logging](#logging)\n  - [Troubleshooting](#troubleshooting)\n    - [**1. Invalid Uncompressed Location Error on aprs.fi**](#1-invalid-uncompressed-location-error-on-aprsfi)\n    - [**2. API Response Error for AQI**](#2-api-response-error-for-aqi)\n    - [**3. Empty RSS Feed Warning**](#3-empty-rss-feed-warning)\n    - [**4. APRS Disconnect Error**](#4-aprs-disconnect-error)\n  - [License](#license)\n\n## Features\n\n- **Fire Detection:** Automatically downloads and processes VIIRS satellite data to identify active fires within the defined geographical area.\n- **APRS Integration:** Sends APRS messages to plot fire locations on the APRS network, providing real-time fire monitoring.\n- **Optional AQI and News Fetching:** \n  - **Air Quality Index (AQI):** Fetches AQI data for fire locations to provide additional environmental context.\n  - **News Links:** Retrieves relevant news articles related to fire incidents.\n- **Customizable Messages:** Sends tailored APRS messages based on available data, including a default \"No fires today\" message when no active fires are detected.\n- **Configurable Scheduling:** Allows users to set the interval (in minutes) for periodic data fetching and APRS messaging.\n- **Flexible Configuration:** Easily define the geographical area of interest and adjust operational parameters via the `config.ini` file.\n\n## Installation\n\n1. **Clone the Repository:**\n\n   ```bash\n   git clone https://github.com/slayingripper/FireAPRS.git\n   cd FireAPRS\n   ```\n\n2. **Create a Virtual Environment (Optional but Recommended):**\n\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   ```\n\n3. **Install Dependencies:**\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n4. **Create Necessary Directories:**\n\n   ```bash\n   mkdir -p data\n   ```\n\n## Configuration\n\nFireAPRS is configured via the `config.ini` file located in the project root directory. This file defines various settings, including APRS credentials, VIIRS data source, AQI API token, news feed URL, and logging preferences.\n\n### Configuration File Structure\n\n```ini\n[aprssend]\ncallsign = YOUR_CALLSIGN\npassword = YOUR_PASSWORD\ncomment = Fire Alert!!!\nsymbol = T  # 'T' represents a tree in APRS symbols\nport = 14580\n\n[viirs]\nurl = https://firms.modaps.eosdis.nasa.gov/data/active_fire/noaa-20-viirs-c2/csv/J1_VIIRS_C2_Global_24h.csv\nfilepath = data/SUOMI_VIIRS_C2_Global_24h.csv\nlatitude1 = 35.844535  # Top-left latitude\nlatitude2 = 34.511083  # Bottom-right latitude\nlongitude1 = 31.816406  # Top-left longitude\nlongitude2 = 34.661865  # Bottom-right longitude\n\n[AQI]\nauthtoken = YOUR_AQI_AUTHTOKEN\n\n[newsfeed]\nlink = YOUR_RSS_FEED_URL\nkeyword = fire\n\n[logging]\nlevel = INFO\nlog_file = fire_aprs.log\n```\n\n#### **Section Descriptions:**\n\n- **[aprssend]:** APRS server connection details.\n  - `callsign`: Your APRS callsign.\n  - `password`: Your APRS password.\n  - `comment`: Comment field in APRS packets.\n  - `symbol`: APRS symbol representing the data (default is 'T' for tree).\n  - `port`: Port number for APRS connection (default is `14580`).\n\n- **[viirs]:** VIIRS satellite data settings.\n  - `url`: URL to download the latest VIIRS active fire data.\n  - `filepath`: Local path to save the downloaded CSV file.\n  - `latitude1` \u0026 `longitude1`: Coordinates for the top-left corner of the geographical area.\n  - `latitude2` \u0026 `longitude2`: Coordinates for the bottom-right corner of the geographical area.\n\n- **[AQI]:** Air Quality Index settings.\n  - `authtoken`: Your AQI API token from [World Air Quality Index (WAQI) API](https://aqicn.org/data-platform/token/#/).\n\n- **[newsfeed]:** News feed settings.\n  - `link`: URL to the RSS feed for fetching news related to fires.\n  - `keyword`: Keyword to filter relevant news articles (e.g., `fire`).\n\n- **[logging]:** Logging preferences.\n  - `level`: Logging level (`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`).\n  - `log_file`: Path to the log file.\n\n Usage\n\nFireAPRS can be executed via the command line, offering flexibility through various flags to enable or disable certain features.\n\n### Command-Line Arguments\n\n- `-i`, `--interval`:  \n  **Description:** Set the interval in minutes between data fetches.  \n  **Default:** `60` minutes.\n\n- `--no-aqi`:  \n  **Description:** Disable fetching Air Quality Index (AQI) data.  \n  **Default:** Enabled.\n\n- `--no-news`:  \n  **Description:** Disable fetching news links related to fires.  \n  **Default:** Enabled.\n\n### Running the Tool\n\n1. **Basic Execution with All Features Enabled:**\n\n   ```bash\n   python main.py\n   ```\n\n   *This command fetches fire data, AQI information, and news links at the default interval of 60 minutes.*\n\n2. **Disable AQI Fetching:**\n\n   ```bash\n   python main.py --no-aqi\n   ```\n\n   *Fetches fire data and news links without retrieving AQI information.*\n\n3. **Disable News Fetching:**\n\n   ```bash\n   python main.py --no-news\n   ```\n\n   *Fetches fire data and AQI information without retrieving news links.*\n\n4. **Disable Both AQI and News Fetching:**\n\n   ```bash\n   python main.py --no-aqi --no-news\n   ```\n\n   *Fetches only fire data and sends minimal APRS messages.*\n\n5. **Set a Custom Interval (e.g., Every 5 Minutes):**\n\n   ```bash\n   python main.py --interval 5\n   ```\n\n6. **Combine Flags (e.g., Disable News and Set Interval to 30 Minutes):**\n\n   ```bash\n   python main.py --no-news --interval 30\n   ```\n\n### Example APRS Messages\n\n- **With AQI and News Enabled:**\n\n  ```\n  5B4ANU-12\u003eAPDR15,TCPIP*,qAC,T2STRAS:=3443.56N/03318.99E:AQI Temp: 25°C, News: http://newslink.com/article\n  ```\n\n- **Without AQI and News:**\n\n  ```\n  5B4ANU-11\u003eAPDR15,TCPIP*,qAC,T2STRAS:=3400.00N/3100.00E:Fire detected\n  ```\n\n- **No Fires Detected:**\n\n  ```\n  5B4ANU-11\u003eAPDR15,TCPIP*,qAC,T2STRAS:=3400.00N/3100.00E:T No fires today\n  ```\n\n*Ensure that the coordinates are correctly formatted to avoid invalid location errors on APRS clients.*\n\n\n## Logging\n\nFireAPRS maintains detailed logs to assist with monitoring and troubleshooting.\n\n- **Log File:** `fire_aprs.log`  \n  *Located in the project root directory.*\n\n- **Log Levels:**  \n  - `DEBUG`: Detailed information, typically of interest only when diagnosing problems.\n  - `INFO`: Confirmation that things are working as expected.\n  - `WARNING`: An indication that something unexpected happened.\n  - `ERROR`: Due to a more serious problem, the software has not been able to perform some function.\n  - `CRITICAL`: A serious error, indicating that the program itself may be unable to continue running.\n\n*Configure the desired log level in the `[logging]` section of `config.ini`.*\n\n## Troubleshooting\n\n### **1. Invalid Uncompressed Location Error on aprs.fi**\n\n**Issue:**  \nAPRSSF displays the message:  \n`Fire detected [Invalid uncompressed location]`\n\n**Cause:**  \nIncorrect formatting of latitude and longitude coordinates in APRS messages.\n\n**Solution:**  \nEnsure that the `format_coordinates` method in `aprs_sender.py` correctly converts decimal degrees to the `DDMM.mmN/S` and `DDDMM.mmE/W` formats.\n\n**Verification Steps:**\n\n1. **Check `format_coordinates` Method:**\n\n   Ensure it correctly converts coordinates. Example implementation:\n\n   ```python\n   def format_coordinates(self, latitude, longitude):\n       # Convert decimal degrees to degrees and minutes\n       lat_deg = int(latitude)\n       lat_min = (latitude - lat_deg) * 60\n       lon_deg = int(longitude)\n       lon_min = (longitude - lon_deg) * 60\n\n       # Determine N/S and E/W\n       lat_direction = 'N' if lat_deg \u003e= 0 else 'S'\n       lon_direction = 'E' if lon_deg \u003e= 0 else 'W'\n\n       # Absolute degrees for formatting\n       lat_deg_abs = abs(lat_deg)\n       lon_deg_abs = abs(lon_deg)\n\n       # Format with leading zeros and two decimal places\n       formatted_lat = f\"{lat_deg_abs:02d}{lat_min:05.2f}{lat_direction}\"\n       formatted_lon = f\"{lon_deg_abs:03d}{lon_min:05.2f}{lon_direction}\"\n\n       return formatted_lat, formatted_lon\n   ```\n\n2. **Run the Tool and Verify APRS Messages:**\n\n   After correcting, run FireAPRS and check aprs.fi for valid location markers.\n\n### **2. API Response Error for AQI**\n\n**Issue:**  \n```\nAPI response error for city 'Mari': Invalid key\nCould not retrieve AQI temperature for city: Mari\n```\n\n**Cause:**  \nInvalid or expired AQI API key.\n\n**Solution:**  \n\n1. **Obtain a Valid AQI API Key:**\n   - Register at the [World Air Quality Index (WAQI) API](https://aqicn.org/data-platform/token/#/) to obtain a valid API token.\n\n2. **Update `config.ini`:**\n   - Replace the placeholder with your valid AQI API token.\n\n   ```ini\n   [AQI]\n   authtoken = YOUR_VALID_AQI_AUTHTOKEN\n   ```\n\n3. **Restart FireAPRS:**\n\n   ```bash\n   python main.py\n   ```\n\n### **3. Empty RSS Feed Warning**\n\n**Issue:**  \n```\nWARNING - Encountered issues parsing the RSS feed: \u003cunknown\u003e:2:-1: Document is empty\nINFO - Keyword 'fire' not found in any entry titles.\n```\n\n**Cause:**  \nThe RSS feed URL is invalid, empty, or not returning expected data.\n\n**Solution:**\n\n1. **Verify RSS Feed URL:**\n   - Ensure the `link` in the `[newsfeed]` section of `config.ini` is correct and accessible.\n   - Test the URL in a web browser or using `curl`:\n\n     ```bash\n     curl -I YOUR_RSS_FEED_URL\n     ```\n\n2. **Update `config.ini` if Necessary:**\n   - Replace with a valid RSS feed URL that provides news related to fires.\n\n   ```ini\n   [newsfeed]\n   link = https://example.com/fire-news.rss\n   keyword = fire\n   ```\n\n3. **Handle Empty or Invalid Feeds Gracefully:**\n   - FireAPRS already sends a default APRS message when no news links are found.\n\n4. **Restart FireAPRS:**\n\n   ```bash\n   python main.py\n   ```\n\n### **4. APRS Disconnect Error**\n\n**Issue:**  \n```\nERROR - Error disconnecting from APRS: 'IS' object has no attribute 'disconnect'\n```\n\n**Cause:**  \nThe `aprslib.IS` object may not have a `disconnect` method due to an outdated library version or incorrect usage.\n\n**Solution:**\n\n1. **Upgrade `aprslib`:**\n\n   ```bash\n   pip install --upgrade aprslib\n   ```\n\n2. **Verify `disconnect` Method:**\n\n   In your Python environment, check if `aprslib.IS` has the `disconnect` method:\n\n   ```python\n   import aprslib\n   print(hasattr(aprslib.IS, 'disconnect'))\n   ```\n\n   *This should output `True`.*\n\n3. **Update `aprs_sender.py`:**\n\n   Ensure the `disconnect` method is correctly implemented with proper error handling.\n\n   ```python\n   def disconnect(self):\n       try:\n           if hasattr(self.ais, 'disconnect'):\n               self.ais.disconnect()\n               logging.info(\"Disconnected from APRS.\")\n           else:\n               logging.warning(\"The 'IS' object does not have a 'disconnect' method. Attempting manual socket closure.\")\n               if hasattr(self.ais, 'sock'):\n                   self.ais.sock.close()\n                   logging.info(\"Manually closed the APRS connection.\")\n               else:\n                   logging.error(\"The 'IS' object does not have a 'sock' attribute.\")\n       except Exception as e:\n           logging.error(f\"Error disconnecting from APRS: {e}\")\n   ```\n\n4. **Restart FireAPRS:**\n\n   ```bash\n   python main.py\n   ```\n\n## License\n\nThis project is licensed under the [GNU](LICENSE).\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslayingripper%2Ffireaprs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslayingripper%2Ffireaprs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslayingripper%2Ffireaprs/lists"}