⚡ Deye Monitor

PHP script for monitoring Deye inverters and sending data to PVOutput

PHP Solar Energy PVOutput Deye Monitoring
View on GitHub Download

📋 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

Installation

  1. Clone or download this repository
  2. Copy config.php.example to config.php
  3. Edit config.php and fill in your credentials
  4. Test execution: php solar.php
  5. 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.php file to Git
  • The config.php file is in .gitignore to 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:

  1. Fork the project
  2. Create a branch for your feature
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

📄 License

This project is under the MIT license.