{"id":44749544,"url":"https://github.com/tyeth/vpd-chart-service","last_synced_at":"2026-02-15T22:34:34.815Z","repository":{"id":318374140,"uuid":"1071014312","full_name":"tyeth/vpd-chart-service","owner":"tyeth","description":null,"archived":false,"fork":false,"pushed_at":"2025-12-10T22:49:12.000Z","size":8872,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-11T07:56:40.032Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tyeth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-06T18:41:30.000Z","updated_at":"2025-12-10T22:49:10.000Z","dependencies_parsed_at":"2025-10-06T21:21:23.581Z","dependency_job_id":null,"html_url":"https://github.com/tyeth/vpd-chart-service","commit_stats":null,"previous_names":["tyeth/vpd-chart-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tyeth/vpd-chart-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fvpd-chart-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fvpd-chart-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fvpd-chart-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fvpd-chart-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tyeth","download_url":"https://codeload.github.com/tyeth/vpd-chart-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tyeth%2Fvpd-chart-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29490966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-02-15T22:34:34.623Z","updated_at":"2026-02-15T22:34:34.807Z","avatar_url":"https://github.com/tyeth.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VPD Chart Service\n\nA microservice for generating Vapor Pressure Deficit (VPD) charts with crop-specific guidance and growth stage zones.\n\n## Features\n\n- **Scientifically accurate VPD calculations**: Uses the established Tetens equation following Wikipedia/ASHRAE standards\n- **Accurate VPD curves**: Zones properly curve with temperature (not flat bands!)\n- **Crop-specific configurations**: Pre-configured for cannabis, tomato, lettuce, orchid, and general use\n- **Growth stage awareness**: Different VPD ranges for seedling, vegetative, flowering, and recovery stages\n- **Smart band display**: Shows relevant zones based on your input\n- **Adafruit IO integration**: Post charts directly to your IoT dashboard\n\n\u003e **About VPD Calculations**: This service uses scientifically validated formulas for VPD calculation. See [VPD-CALCULATION.md](./VPD-CALCULATION.md) for detailed methodology, formulas, and verification.\n\n## Installation\n\n### Local Development\n\n```bash\nnpm install\nnpm start\n```\n\nServer runs on `http://localhost:3000` by default.\n\n### Deploy to Cloudflare Workers\n\nThis service can be deployed to Cloudflare's global edge network with zero code changes!\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/tyeth/vpd-chart-service)\n\nOr manually:\n```bash\nnpm install -g wrangler\nwrangler login\nwrangler deploy\n```\n\nSee [CLOUDFLARE.md](./CLOUDFLARE.md) for complete deployment instructions.\n\n## API Usage\n\n### Basic Request\n\n```bash\nGET /vpd-chart?air_temp=24\u0026rh=65\u0026crop_type=cannabis\u0026stage=veg\n```\n\n### Parameters\n\n| Parameter | Required | Description | Example |\n|-----------|----------|-------------|---------|\n| `air_temp` | **Yes** | Air temperature in °C | `24` |\n| `rh` | No | Relative humidity (%) | `65` |\n| `leaf_temp` | No | Leaf temperature in °C | `22` |\n| `vpd` | No | Direct VPD value (kPa) | `1.1` |\n| `crop_type` | No | Crop type (see list below) | `cannabis` |\n| `stage` | No | Growth stage (see below) | `veg` |\n| `show_timestamp` | No | Show last updated timestamp | `true`, `false`, or custom string |\n| `timezone_offset` | No | Timezone offset in hours (alias: `tz_offset`) | `5` (UTC+5), `-8` (UTC-8) |\n| `callback_url` | No | Adafruit IO webhook URL | (see integration) |\n| `feed_url` | No | Adafruit IO feed URL | (see integration) |\n| `aio_key` | No | Adafruit IO API key | (see integration) |\n\n**Timestamp Parameters:**\n- If `show_timestamp=true`, displays current UTC time (or with offset if `timezone_offset` is provided)\n- If `show_timestamp` is a custom string, displays that string as-is\n- `timezone_offset` accepts positive or negative hour offsets (e.g., `5` for UTC+5, `-8` for UTC-8)\n\n**VPD Calculation Priority:**\n- If `vpd` is provided, it's used directly (other params are informational only)\n- If `rh` is provided, VPD is calculated from air temp and RH (most accurate)\n- If only `leaf_temp` is provided, VPD is calculated from temp difference\n- If neither `rh` nor `leaf_temp` is provided, leaf temp defaults to air_temp - 2°C\n\nYou can provide both `rh` and `leaf_temp` if you have both measurements - RH will be used for VPD calculation while leaf temp will be displayed on the chart.\n\n### Crop Types\n\nAvailable crop types:\n- `general` (default)\n- `cannabis`\n- `tomato`\n- `lettuce`\n- `orchid`\n\nSee `crop_config_template.md` for adding custom crops.\n\n### Growth Stages\n\nEach crop has these stages configured:\n- `seedling` - Early growth, high humidity needs\n- `veg` - Vegetative growth\n- `flower` - Flowering/fruiting phase\n- `sick-dry` - Recovery from dry/heat stress\n- `sick-wet` - Recovery from overwatering\n- `sick-pest` - Recovery from pest damage\n- `sick-chemical` - Recovery from nutrient burn\n- `sick-unknown` - General recovery mode\n\n### Chart Display Logic\n\nThe chart shows different VPD zones depending on what you specify:\n\n**When `stage` is NOT specified:**\n- Shows all 3 main growth stages: seedling, veg, flower\n- Clean overview of healthy growth ranges\n- Perfect for general monitoring\n\n**When `stage` IS specified:**\n- Shows ONLY that one specific stage (whether normal growth or recovery)\n- Maximum clarity and focus\n- Examples:\n  - `stage=veg` → Shows only the vegetative zone\n  - `stage=sick-dry` → Shows only the dry-stress recovery zone\n\n**Why this design?**\n- **No clutter**: Maximum 3 zones on any chart\n- **Clear focus**: See exactly what you need for your situation  \n- **Sick stages are standalone**: Each recovery zone is independent - only shown when specifically requested\n\n## Response Format\n\n```json\n{\n  \"vpd\": \"1.234\",\n  \"air_temp\": 24,\n  \"rh\": 65,\n  \"crop_type\": \"Cannabis\",\n  \"stage\": \"veg\",\n  \"status\": \"optimal\",\n  \"image\": \"iVBORw0KGgoAAAANS...\",\n  \"image_format\": \"png\"\n}\n```\n\nThe `image` field contains a base64-encoded PNG chart.\n\nStatus values:\n- `optimal` - VPD is within the ideal range for this stage\n- `too_low` - VPD is below optimal (too humid)\n- `too_high` - VPD is above optimal (too dry)\n- `unknown` - No stage specified, can't determine status\n\n## Examples\n\n### Basic chart with RH\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=tomato\u0026stage=flower\"\n```\n\n### Chart with leaf temperature\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=26\u0026leaf_temp=24\u0026crop_type=cannabis\u0026stage=veg\"\n```\n\n### Chart with both RH and leaf temperature\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=26\u0026rh=65\u0026leaf_temp=24\u0026crop_type=cannabis\u0026stage=veg\"\n```\nWhen both are provided, RH is used for VPD calculation (more accurate), and leaf temp is shown on the chart.\n\n### General overview (no stage)\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=22\u0026rh=70\u0026crop_type=lettuce\"\n```\nThis shows seedling, veg, and flower zones (3 zones total).\n\n### Focused on vegetative growth\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=cannabis\u0026stage=veg\"\n```\nThis shows ONLY the veg zone (1 zone).\n\n### Recovery from dry stress\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=55\u0026crop_type=cannabis\u0026stage=sick-dry\"\n```\nThis shows ONLY the sick-dry recovery zone (1 zone).\n\n### Chart with timestamp\n```bash\n# Show current UTC timestamp\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=cannabis\u0026stage=veg\u0026show_timestamp=true\"\n\n# Show timestamp with timezone offset (UTC+5)\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=cannabis\u0026stage=veg\u0026show_timestamp=true\u0026timezone_offset=5\"\n\n# Show timestamp with negative offset (UTC-8, Pacific Time)\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=cannabis\u0026stage=veg\u0026show_timestamp=true\u0026tz_offset=-8\"\n\n# Show custom timestamp\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=60\u0026crop_type=cannabis\u0026stage=veg\u0026show_timestamp=2025-10-26%2010:30:00\"\n```\n\n### List available crops and stages\n```bash\ncurl \"http://localhost:3000/crops\"\n```\n\n## Adafruit IO Integration\n\n### Method 1: Raw Webhook (Recommended)\n\n1. Create a webhook in Adafruit IO\n2. Use the webhook URL as `callback_url`:\n\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=65\u0026crop_type=cannabis\u0026stage=veg\u0026callback_url=https://io.adafruit.com/api/v2/webhooks/feed/YOUR_WEBHOOK_ID/raw\"\n```\n\n### Method 2: Feed + API Key\n\n```bash\ncurl \"http://localhost:3000/vpd-chart?air_temp=24\u0026rh=65\u0026crop_type=cannabis\u0026stage=veg\u0026feed_url=https://io.adafruit.com/USERNAME/feeds/FEED_KEY\u0026aio_key=YOUR_AIO_KEY\"\n```\n\nBoth methods return the chart image in the response AND post it to Adafruit IO.\n\n## How VPD Zones Work\n\nThe charts display VPD zones as **curves, not flat bands**. This is scientifically accurate because:\n\n1. VPD is calculated from temperature and relative humidity\n2. At constant RH, higher temperatures produce higher VPD\n3. Each zone represents a constant RH band\n4. These RH bands create upward-sloping curves as temperature increases\n\nFor example, the vegetative zone (0.8-1.2 kPa at 24°C) represents approximately 72% RH to 56% RH. At 15°C, those same RH values produce lower VPD (~0.5-0.7 kPa), while at 35°C they produce higher VPD (~1.3-1.9 kPa).\n\n## Chart Axes\n\nThe chart uses reversed axes for easier reading:\n\n- **X-axis (Humidity)**: 100% (left) to 0% (right) - High humidity on left, low on right\n- **Y-axis (Temperature)**: 35°C (bottom) to 15°C (top) - High temperature at bottom, low at top\n\nThis layout makes it intuitive to see that:\n- Moving left = higher humidity = lower VPD (more humid conditions)\n- Moving right = lower humidity = higher VPD (drier conditions)\n- Moving down = higher temperature = higher VPD (hotter conditions)\n- Moving up = lower temperature = lower VPD (cooler conditions)\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Run in dev mode with auto-reload\nnpm run dev\n\n# Run tests\nnode test_chart.js\n```\n\n## License\n\nMIT\n\n## Contributing\n\nSee `crop_config_template.md` for instructions on adding new crop types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyeth%2Fvpd-chart-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyeth%2Fvpd-chart-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyeth%2Fvpd-chart-service/lists"}