{"id":46638224,"url":"https://github.com/tetherto/miningos-wrk-ext-openweather","last_synced_at":"2026-03-08T02:13:15.999Z","repository":{"id":340876435,"uuid":"1129677059","full_name":"tetherto/miningos-wrk-ext-openweather","owner":"tetherto","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-26T23:02:59.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-27T05:35:07.763Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tetherto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-07T12:30:01.000Z","updated_at":"2026-02-26T23:03:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tetherto/miningos-wrk-ext-openweather","commit_stats":null,"previous_names":["tetherto/miningos-wrk-ext-openweather"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/tetherto/miningos-wrk-ext-openweather","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-ext-openweather","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-ext-openweather/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-ext-openweather/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-ext-openweather/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tetherto","download_url":"https://codeload.github.com/tetherto/miningos-wrk-ext-openweather/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tetherto%2Fminingos-wrk-ext-openweather/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30242406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2026-03-08T02:13:11.365Z","updated_at":"2026-03-08T02:13:15.983Z","avatar_url":"https://github.com/tetherto.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miningos-wrk-ext-openweather\n\nA distributed worker service that wraps the OpenWeatherMap API to provide weather data monitoring for MiningOS. This worker is part of MiningOS infrastructure ecosystem and provides real-time weather information, relevant for managing heat dissipation and renewable energy-dependent mining operations.\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Architecture](#architecture)\n3. [Installation](#installation)\n4. [Configuration](#configuration)\n5. [Running the Worker](#running-the-worker)\n6. [RPC Methods](#rpc-methods)\n\n## Overview\n\nThe worker fetches data from OpenWeatherMap API at configurable intervals, stores it persistently in memory and backs it up using Hyperbee, and exposes it via RPC methods.\n\n## Features\n\n- **Multi-site monitoring**: Configure and monitor weather for multiple geographic locations\n- **Comprehensive weather data**: Current conditions, 24-hour forecasts, and 5-day forecasts\n- **Persistent storage**: Weather data cached in Hyperbee for reliability\n- **Distributed access**: RPC interface for remote data retrieval via Hyperswarm\n- **Configurable intervals**: Adjustable data fetch frequencies\n\n## Architecture\n\nThis worker extends `tether-wrk-base`, which provides:\n- RPC server infrastructure via Hyperswarm\n- Persistent storage via Hyperbee\n- Configuration management\n- Logging facilities\n\nThe worker architecture consists of:\n1. **OpenWeatherApi client**: HTTP wrapper for OpenWeatherMap API\n2. **Data fetcher**: Periodic polling with configurable intervals\n3. **Data processor**: Transforms API responses into normalized format\n4. **Storage layer**: Hyperbee-based persistence\n5. **RPC server**: Exposes weather data to distributed clients\n\n## Installation\n```bash\n# Clone the repository\ngit clone https://github.com/tetherto/miningos-weather-worker.git\ncd miningos-weather-worker\n\n# Install dependencies\nnpm install\n\n# Setup configuration files\nbash setup-config.sh\n```\n\n## Configuration\n\n### OpenWeather Configuration (`config/openweather.json`)\n\n```json\n{\n  \"secretApiKey\": \"your-openweathermap-api-key\",\n  \"openweather\": {\n    \"baseUrl\": \"https://api.openweathermap.org\",\n    \"dataFetchIntervalMs\": 1800000\n  },\n  \"sites\": [\n    {\n      \"name\": \"Site-Name\",\n      \"lat\": -33.333,\n      \"lon\": -55.555\n    }\n  ]\n}\n```\n\n#### Configuration Parameters\n\n- **`secretApiKey`**: Your OpenWeatherMap API key (obtain from https://openweathermap.org/api)\n- **`openweather.baseUrl`**: OpenWeatherMap API base URL (version 3.0 endpoint)\n- **`openweather.dataFetchIntervalMs`**: Data refresh interval in milliseconds (default: 1800000 = 30 minutes)\n- **`sites`**: Array of site configurations\n  - **`name`**: Unique identifier for the site\n  - **`lat`**: Latitude coordinate (numeric value)\n  - **`lon`**: Longitude coordinate (numeric value)\n\n## Running the Worker\n\n### Development Mode\n\n```bash\nnpm run dev\n```\n\n### Production Mode\n\n```bash\nnode worker.js --wtype wrk-openweather-rack --env production --rack rack-1\n```\n\n## RPC Methods\n\nThe worker exposes the following RPC methods via Hyperswarm.\n\n#### `getWrkExtData`\n\nRetrieves comprehensive weather data for all configured sites.\n\n**Request:**\n```javascript\n{}  // Currently accepts empty object\n```\n\n**Success Response:**\n```javascript\n{\n  \"Site-Name\": {\n    \"overview\": {\n      \"temperature\": 25.3,          // Current temperature (°C)\n      \"icon\": \"sunny\",              // standardized icon name\n      \"clouds\": 20,                 // Cloud coverage (%)\n      \"visibility\": 10000,          // Visibility (meters)\n      \"humidity\": 65,               // Humidity (%)\n      \"wind\": {\n        \"speed\": 3.5,               // Wind speed (m/s)\n        \"deg\": 180                  // Wind direction (degrees)\n      },\n      \"timezone\": \"UTC\",\n      \"time\": \"10/24/2025, 3:45:00 PM\"  // Local time at site (format depends on server locale)\n    },\n    \"forecast24h\": [\n      {\n        \"datetime\": 1729785600000,  // Unix timestamp (ms)\n        \"temperature\": 24.8,        // Temperature (°C)\n        \"humidity\": 68,             // Humidity (%)\n        \"description\": \"clear sky\"  // Weather description\n      }\n      // ... next 24 hours\n    ],\n    \"forecast5d\": [\n      {\n        \"datetime\": 1729900800000,  // Unix timestamp (ms)\n        \"temperature\": 26.2,        // Day temperature (°C)\n        \"humidity\": 62,             // Humidity (%)\n        \"description\": \"few clouds\" // Weather description\n      }\n      // ... next 5 days\n    ]\n  }\n}\n```\n\n**Weather Icon Mapping:**\n\nThe worker normalizes OpenWeatherMap icons to MiningOS standard icons:\n\n| OpenWeather Icon | MiningOS Icon | Description |\n|-----------------|------------|-------------|\n| 01d, 01n | sunny | Clear sky |\n| 02d, 02n | partlyCloudy | Few clouds |\n| 03d, 03n, 04d, 04n, 50d, 50n | cloudy | Cloudy/Overcast |\n| 09d, 09n, 10d, 10n | rainy | Rain |\n| 11d, 11n | rainThunder | Thunderstorm |\n| 13d, 13n | snowy | Snow |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-ext-openweather","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftetherto%2Fminingos-wrk-ext-openweather","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftetherto%2Fminingos-wrk-ext-openweather/lists"}