SYSTEM ACTIVITY MONITOR

Scheduler: ...
Heartbeat: ...
Current: -
Next: -
IBEX: -
Today: - -
Time: --:--:--
Activity Log
Relay Commands
Archives
System Diagram
Start End Component Task Status Schedule Hours Next Run Message Duration
Loading...
Time Plant Action Result Response Error
Loading...
Month Records Size Date Range Actions
Loading...
Archive Info

• Archives are stored as compressed JSON files on the server

• Location: /opt/docker/volumes/logs-production/activity_archive/

• "Archive & Cleanup" moves old records to files and deletes them from DB

• "Restore" brings archived records back to the database temporarily

1. SCHEDULER MAIN LOOP (services/unified_scheduler.py) - runs every 10 seconds
START
|
Check api_schedule table
SELECT * FROM api_schedule WHERE next_run_at <= NOW()
|
Tasks due?
YES
|
Execute each task
run_task()
Calls registered handler
|
Log to system_activity
activity_logger.py
NO
|
Update heartbeat
scheduler_heartbeat table
|
Sleep 10 seconds
time.sleep(10)
|
Loop back to START
2. FEC CONTROL PROCESS (fec:control) - runs at :00, :15, :30, :45
FEC:CONTROL START
|
1. Get IBEX Price
services/scraper.py
get_current_price()
|
Price valid?
for today
NO
|
Send Telegram Alert
notification.py
NO CONTROL - ABORT!
|
END (Error)
YES
|
2. Query Plants from DB
DB: inverters table
WHERE control_type='ifttt' AND limit_type!='няма'
|
3. FOR EACH PLANT:
Loop through all plants
|
price > threshold?
YES (price high)
|
ACTION = STOP
Turn OFF relay
NO (price low)
|
ACTION = START
Turn ON relay
|
4. Send eWeLink Command
services/ewelink_service.py
set_device_power(device_id, state)
|
Success?
YES
|
5. Verify State
get_device_status_direct()
Confirm relay state
NO
|
Queue for Retry
pending_commands table
fec:retry will handle
|
6. Log Result
DB: relay_command_history
plant, action, success, error, response_time
|
Next plant in loop
|
7. Send Summary Notification
notification.py
Telegram: X started, Y stopped, Z failed
|
END (Success)
3. eWeLink DEVICE STATUS (ewelink:device_status) - runs at :58, :13, :28, :43
START
-->
Fetch all devices
ewelink_service.py
-->
Cache device states
Memory cache
-->
Update relay_devices table
DB: current_state
-->
END
4. PRODUCTION DATA COLLECTION (huawei/growatt/solis/sungrow/abb:production)
START
-->
Get API credentials
api_credentials table
-->
Call External API
*_realtime.py
-->
Parse response
power, energy, status
-->
Save to DB
inverter_realtime_data
-->
END
FILE REFERENCE - Кой файл какво прави
TaskSource FileDescriptionSchedule
unified_schedulerservices/unified_scheduler.pyMain loop - checks and runs tasksEvery 10s
fec:controlservices/relay_manager.pyIBEX price -> relay control:00, :15, :30, :45
fec:retryservices/relay_manager.pyRetry failed commands:05, :20, :35, :50
ewelink:device_statusservices/ewelink_service.pyCache device states:58, :13, :28, :43
huawei:productionservices/huawei_realtime.pyFetch Huawei data:03, :18, :33, :48
growatt:productionservices/growatt_realtime.pyFetch Growatt data:05, :20, :35, :50
solis:productionservices/solis_realtime.pyFetch Solis data:07, :22, :37, :52
ibex:pricesservices/scraper.pyFetch IBEX prices:10 (14-20h)
LIVE SCHEDULED TASKS --:--:--
Loading...