đ Description
This script connects to multiple Deye devices on a local network, collects real-time power data, and sends the information to the PVOutput service for visualization and analysis.
đĄ Note: This script was created to solve the issue described in the PVOutput forum where automatic uploads from Deye/Solarman systems stopped working.
⨠Features
đ Multiple Device Monitoring
Collects data from multiple devices sequentially
đ Automatic Retry
Retries connection on failure with exponential backoff (up to 3 attempts)
đ Smart Fallback
Uses average of successful values for failed devices
âī¸ PVOutput Integration
Automatically sends data to the cloud service
đ Complete Logging
Logs all operations and errors to a log file
đ Secure Configuration
Credentials separated from source code
đ Quick Start
Prerequisites
- PHP 7.4+
- cURL extension enabled
- Access to local network where Deye devices are connected
- Internet access for PVOutput communication
Installation
- Clone or download this repository
- Copy
config.php.exampletoconfig.php - Edit
config.phpand fill in your credentials - Test execution:
php solar.php - Set up cron for automatic execution
âī¸ Configuration
The config.php file contains all necessary settings:
return [
'devices' => [
'host' => '192.168.1.100',
'username' => 'admin',
'password' => 'admin',
'ports' => [1231, 1232, 1233, 1234, 1235],
'path' => '/status.html',
],
'pvoutput' => [
'api_key' => 'YOUR_API_KEY_HERE',
'system_id' => 'YOUR_SYSTEM_ID_HERE',
],
'settings' => [
'timezone' => 'America/Sao_Paulo',
'max_retries' => 3,
'base_delay' => 5,
'http_timeout' => 10,
'curl_timeout' => 30,
'delay_between_devices' => 5,
],
];
â ī¸ Important: Get your PVOutput API Key and System ID from pvoutput.org. See HOW_TO_GET_KEYS.md for detailed instructions.
đ Cron Scheduling
To collect data every 5 minutes:
*/5 * * * * cd /path/to/deye-pvoutput && php solar.php >> /dev/null 2>&1
To collect every hour:
0 * * * * cd /path/to/deye-pvoutput && php solar.php >> /dev/null 2>&1
âšī¸ Note: Free PVOutput has request limits (60 requests per hour). Check the official documentation for details.
đ§ Configuration Variables
| Variable | Default | Description |
|---|---|---|
max_retries |
3 | Maximum number of attempts per device |
base_delay |
5 | Initial delay in seconds (grows exponentially) |
http_timeout |
10 | Timeout for HTTP connections in seconds |
curl_timeout |
30 | Timeout for cURL requests in seconds |
delay_between_devices |
5 | Delay between device requests (seconds) |
đ Security
- NEVER commit the
config.phpfile to Git - The
config.phpfile is in.gitignoreto protect your credentials - Use strong credentials for Deye devices
- Keep your PVOutput API Key secure
- Run script on secure/private network when possible
đ Documentation
đ¤ Contributing
Contributions are welcome! Please:
- Fork the project
- Create a branch for your feature
- Commit your changes
- Push to the branch
- Open a Pull Request
đ License
This project is under the MIT license.