Commit Graph

58 Commits

Author SHA1 Message Date
Wizznu 206117d26a fix: Turn OFF pumps during break between pots to save power 2026-06-02 08:20:34 +07:00
Wizznu f9e89fe826 fix: Ensure sequential watering by adding explicit OFF for other pots and increased delays 2026-06-02 08:10:01 +07:00
Wizznu b81cc38773 Merge production/main into main 2026-06-02 07:51:56 +07:00
Wizznu e666c1ddea feat: Change watering mode from parallel to sequential (bergiliran) with 30s break between pots 2026-06-02 07:50:05 +07:00
Wizznu 24e9b34f62 merge remote repository 2026-05-19 19:50:15 +07:00
Wizznu 2598e6a61c add dummy data script 2026-05-19 19:42:24 +07:00
hitproject996-dev c413ebec74
Initial commit 2026-05-19 19:28:38 +07:00
Wizznu fb7e3216f1 fix: remove deprecated Flutter notification API parameters and unnecessary imports 2026-04-10 20:03:25 +07:00
Wizznu f943bd9b7c 🔧 Fix: Handle FCM messaging gracefully - fallback when not available 2026-04-10 18:17:56 +07:00
Wizznu e04763fe8e 🔧 Fix: Update Firebase path from /kontrol to /kontrol_1 - Match Flutter app data structure
- Changed FIREBASE_PATHS.kontrol from 'kontrol' to 'kontrol_1'
- Worker now reads/writes from correct path (app uses /kontrol_1)
- Fixes issue where kontrol config was always NULL
- Schedule triggers should now work correctly
- Added migration helper script (migrate-history-source.js)

This aligns worker with current app structure after schema update.
2026-04-10 17:44:04 +07:00
Wizznu 789f80ffe0 🛠️ IMPROVE: Add retry logic and better error handling for mosvet trigger
- Add retry logic (3x attempts) to updateFirebaseSmart() for better stability
- Add Firebase verification to confirm mosvet updates actually wrote to database
- Add exponential backoff (1s, 2s, 3s) between retry attempts
- Improve error logging with full error stack traces
- Add critical alerts when safety OFF fails (potential stuck mosvet)
- Better validation of kontrol config with NULL checks
- Enhanced diagnostics for all updateFirebaseSmart calls
- Ensure pump stops are retried if initial attempt fails

This fixes issues where mosvet would not trigger despite logs showing 'success'
2026-04-10 12:55:07 +07:00
Wizznu 568c4dd981 🐛 FIX: Firebase path jadwal notification - changed kontrol_1 to kontrol
- Worker was reading from /kontrol_1 but data stored at /kontrol
- This caused worker to not find any scheduled watering jadwal
- Fixed to match Flutter app which uses /kontrol path
- Result: Scheduled watering notifications will now trigger correctly
2026-04-10 12:33:36 +07:00
Wizznu 53fc4d3359 feat: add push notifications for schedule and sensor watering 2026-04-10 10:03:27 +07:00
Wizznu a02827897c chore(railway): update worker and add history migration script 2026-03-26 18:27:01 +07:00
Wizznu b361463b9d railway-worker: set auto-log 30m and cleanup retention 10 days 2026-03-24 23:05:20 +07:00
Wizznu abc867bb05 fix: prevent schedule misses with trigger window 2026-03-16 12:37:36 +07:00
Wizznu ba027dbb61 Merge branch 'main' of https://github.com/qiizwww/myrailway 2026-03-16 11:27:50 +07:00
Wizznu d10039e30a chore: sync railway worker for Railway deployment 2026-03-16 11:22:03 +07:00
qiizwww e5653a363e
Initial commit 2026-03-16 11:16:58 +07:00
Wizznu 6c3b2f3112 feat: Complete ApsGo hydroponics system with multiple features
Features implemented:
- Dashboard with real-time sensor monitoring (temp, humidity, light, soil moisture)
- Water flow status indicator with color coding
- Time-based scheduling (Kontrol Waktu/Jadwal)
- Sensor-based threshold control (Kontrol Sensor/Threshold)
- Smart mode with auto-stop when target reached
- Three pump controls: Air, Larutan Nutrisi, Pengaduk
- Manual control for all actuators
- History/logging system
- Firebase Realtime Database integration
- Railway worker backend service

UI/UX improvements:
- Material Design 3 components
- Badge indicators for active pumps
- Conditional rendering (show only when active)
- Responsive layouts with Wrap widgets
- Color-coded status indicators

Backend fixes:
- Fixed water_flow reading from Firebase
- Fixed threshold model copyWith method
- Added pompa_pengaduk support across all models
- Smart mode with per-pot independent monitoring
- Cooldown per-threshold (not per-pot)
- Valves stop together when targets reached

Renamed: All 'Pupuk' references to 'Larutan Nutrisi Cair'
2026-02-18 08:10:43 +07:00
Wizznu c79033de91 fix: Add polling mechanism for sensor threshold monitoring
Problem:
- Firebase SDK listener not triggering (SDK timeout)
- No sensor data being checked despite sensor=true
- Log shows no SENSOR CHECK output

Solution:
- Add polling every 30 seconds using REST API (reliable)
- Keep Firebase listener as backup if SDK recovers
- Check kontrolConfig.sensor flag before processing
- Shared checkSensorThresholds() function for both methods

This ensures sensor mode works even when Firebase SDK fails
2026-02-16 19:45:29 +07:00
Wizznu 581ab42fac feat: Add verbose logging for sensor mode threshold monitoring
- Log every sensor check with full sensor data
- Display threshold config for each check
- Show detailed evaluation for each pot
- Log cooldown status and trigger events
- Help debug why mosfet not triggering
2026-02-16 19:30:34 +07:00
Wizznu 91cb3eaaea feat: Dynamic threshold system for sensor-based watering
- Detect all threshold_* nodes from kontrol_1
- Support unlimited threshold configurations
- Each threshold: batas_bawah, batas_atas, smart_mode, pot_aktif[], pompa settings
- Smart mode: water until batas_atas reached
- Fixed mode: water for fixed duration
- Setup script: setup-firebase-threshold.js for auto Firebase initialization
- Improved logging: show threshold ID, mode, and pot info on trigger
2026-02-16 12:31:26 +07:00
Wizznu 1224c8e867 feat: Threshold-based sensor system with unlimited threshold configs
- NEW: Flexible threshold system (threshold_1, threshold_2, ... unlimited)
- Each threshold: batas_bawah, batas_atas, durasi, smart_mode, pot_aktif[]
- Smart mode: siram sampai batas_atas tercapai
- Fixed mode: siram sesuai durasi tetap
- ThresholdModel: Complete model with validation
- ThresholdService: CRUD operations for threshold management
- ThresholdManagementPage: UI untuk list dan manage threshold
- ThresholdFormPage: Add/edit form dengan slider dan pot selection
- Worker.js: Dynamic threshold_* detection and processing
- Navigation: Sensor button now goes to ThresholdManagementPage
- Firebase: Auto-setup script with example threshold data (threshold_1, threshold_2, threshold_3)
- Path: All threshold data stored in /kontrol_1
2026-02-16 12:30:13 +07:00
Wizznu abef985a11 APSGO V2.1 NEW APS 2026-02-16 11:40:41 +07:00
Wizznu 6f4b7c25f1 feat: Flexible jadwal system + kontrol_1 path support
- Added FIREBASE_PATHS config for easy path switching
- Support unlimited jadwal (jadwal_1, jadwal_2, ... jadwal_N)
- Each jadwal can select specific pots (pot_aktif array)
- Per-schedule config: duration, pompa_air, pompa_pupuk
- Updated all kontrol refs to use FIREBASE_PATHS.kontrol (kontrol_1)
- Added setup script for auto Firebase initialization
- Added comprehensive documentation (FLEXIBLE_SCHEDULE_GUIDE.md)
- Backward compatible with legacy waktu_1/waktu_2 format

Files added:
- setup-firebase-jadwal.js: Auto setup Firebase jadwal
- FLEXIBLE_SCHEDULE_GUIDE.md: Complete guide for flexible schedules
- firebase-example.json: Example Firebase structure

Changes:
- worker.js: Dynamic schedule detection, kontrol_1 path support
2026-02-16 11:05:22 +07:00
Wizznu 561881e18e fix: Optimize Firebase connection with smart fallback system - SDK timeout 10s->5s - Smart fallback after 3 consecutive failures - API statistics tracking (SDK vs REST) - Auto-recovery every 50 minutes 2026-02-16 09:58:17 +07:00
Wizznu 3259070563 docs: Add comprehensive project status documentation 2026-02-11 17:22:16 +07:00
Wizznu 09ee9ea516 feat: Complete ApsGo system with Railway Worker automation
- Real-time scheduling system working with 20s delay per section
- 1 schedule time controls multiple pumps simultaneously
- Railway Worker with Firebase SDK + REST API fallback
- Timeout handling and job queue management
- Comprehensive documentation and troubleshooting guides
- Flutter mobile app with dual mode (manual + auto scheduling)
2026-02-11 17:17:22 +07:00
Wizznu 5e85ad61e2 HOTFIX: Fix incomplete replacement causing syntax errors in setFirebaseViaREST and readFirebaseSmart 2026-02-11 12:32:48 +07:00
Wizznu 935e1059f6 CRITICAL: Fix fetch() timeout not working in Node.js + add job-level timeout + extensive debug logging 2026-02-11 12:23:10 +07:00
Wizznu 1fc1d7ecbc HOTFIX: Fix syntax error in healthCheck function (line 878) 2026-02-11 12:01:16 +07:00
Wizznu 895ce4c1fe CRITICAL FIX: Add timeout+REST fallback for ALL Firebase operations (set, read, delete) 2026-02-11 11:57:25 +07:00
Wizznu 68ce136317 Fix Firebase update timeout: add REST API fallback for write operations 2026-02-11 11:39:09 +07:00
Wizznu 5c8c93c104 Fix BullMQ job ID: replace colon with underscore 2026-02-11 11:25:43 +07:00
Wizznu 4d9add606e Add Firebase REST API fallback and smart fetch mechanism 2026-02-11 11:12:03 +07:00
Wizznu 6ce4affe6b Critical fix: Add timeout handler for Firebase fetch to prevent hanging 2026-02-11 11:03:19 +07:00
Wizznu 6e4f73928f Add extensive debug logging to trace checkScheduledWatering execution 2026-02-11 10:49:56 +07:00
Wizznu 556199a28d Fix: Add error handling and timing fix for scheduler checks 2026-02-11 10:38:33 +07:00
Wizznu 6cf05184f5 Add urgent fix summary and action steps 2026-02-11 10:30:51 +07:00
Wizznu 025c39a4f0 Add comprehensive debugging guide for scheduler and aktuator issues 2026-02-11 10:29:15 +07:00
Wizznu 76bb751962 Fix: Add verbose logging for debugging scheduler and aktuator issues 2026-02-11 10:27:13 +07:00
Wizznu 8b8ad29c4d Add debugging: time sync monitoring, manual test functions, aktuator validation 2026-02-11 10:06:49 +07:00
Wizznu 4434a05db1 Completely suppress Firebase SDK warnings 2026-02-11 07:58:50 +07:00
Wizznu acefe143b4 Add crash prevention and keep-alive mechanisms 2026-02-11 07:55:08 +07:00
Wizznu 2f59a363da Optimize worker: reduce Firebase warnings and verbose logging 2026-02-11 07:49:29 +07:00
Wizznu 9b64706b4d Merge and update Railway Worker with fixes 2026-02-11 07:42:09 +07:00
Wizznu 8da7b66494 Initial commit: Railway Worker for ApsGo IoT System 2026-02-11 07:40:33 +07:00
Wizznu 59dc0b45d9 fix: Remove BOM from railway.json
Fixed Railway deployment error:
'invalid character ï looking for beginning of value'

Cause: UTF-8 BOM (Byte Order Mark) at file start
Solution: Recreated file with UTF-8 without BOM
Railway JSON parser now reads correctly
2026-02-10 11:37:34 +07:00
Wizznu 94499d02d5 feat: Add Dockerfile for Railway deployment
Added production-ready Dockerfile:
- Node.js 18 Alpine (lightweight)
- Multi-stage dependency installation
- Health check monitoring
- Non-root user for security
- Production optimizations

Added .dockerignore:
- Exclude node_modules (reinstalled in Docker)
- Exclude .env files (Railway injects env vars)
- Reduce image size
- Faster build times

Railway will now detect project type via Dockerfile instead of guessing from package.json.
This ensures proper build configuration for BullMQ worker.
2026-02-10 11:29:49 +07:00