8000 GitHub - rlggyp/deye-exporter · GitHub
[go: up one dir, main page]

Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

deye-exporter

The deye-exporter is a lightweight Prometheus exporter for collecting and exposing metrics from Deye solar inverter systems via the Deye Cloud API. It transforms inverter, weather, and station data into Prometheus-compatible metrics for easy monitoring and integration.

Features

  • Collects real-time and monthly metrics from Deye inverters via HTTP API
  • Exposes metrics such as battery SOC, power flows, solar generation, grid import, weather, and station capacity
  • Dockerized for easy deployment

Exported Metrics

Metric Name Description
battery_soc_ratio Battery state of charge as a ratio (0.0 to 1.0)
battery_discharge Current battery discharge power in Watts
load_power Real-time power consumption by the load in Watts
grid_import Real-time power imported from the utility grid (PLN) in Watts
solar_generation Real-time solar photovoltaic power production in Watts
solar_generation_daily Total solar energy produced today in kilowatt-hours (kWh)
temperature Current ambient outdoor temperature in degrees Celsius
humidity Current outdoor relative humidity percentage (0-100)
monthly_grid Total energy imported from grid this month in Watts
monthly_grid_ratio Proportion of grid energy in total monthly consumption (0.0 to 1.0)
monthly_solar_usage Monthly total of solar energy consumed directly by the load in Watts
monthly_solar_usage_ratio Ratio of load demand met by solar energy this month (0.0 to 1.0)
monthly_battery_discharge Monthly total of energy supplied to the load from the battery in Watts
monthly_battery_discharge_ratio Ratio of load demand met by battery storage this month (0.0 to 1.0)
monthly_solar_generation Total cumulative solar energy generated this month in Watts
monthly_solar_generation_ratio Ratio of generated solar energy used vs stored this month (0.0 to 1.0)
monthly_battery_charge Total energy used to charge the battery this month in Watts
monthly_battery_charge_ratio Proportion of solar generation diverted to battery charging (0.0 to 1.0)
network_status Network connectivity status (0: NORMAL, 1: PARTIAL_OFFLINE, 2: ALL_OFFLINE, 3: NO_DEVICE, 4: UNKNOWN)
installed_capacity Total rated peak power capacity of the PV installation in kWp

API Endpoints

/deye

Method: GET
Query Parameters:

  • target: Station ID of the Deye inverter

Example:

GET /deye?target=123456

Returns Prometheus-formatted metrics for the specified station.

Configuration

Example config.yaml

access_token: "your_deye_cloudaccess_access_token"

Set the path to this file using the CONFIG_FILE environment variable.

Example log4rs.yaml

refresh_rate: 30 seconds

appenders:
  rolling_file:
    kind: rolling_file
    path: "/etc/deye-exporter/logs/app.log"
    policy:
      kind: compound
      trigger:
        kind: size
        limit: 1 mb
      roller:
        kind: fixed_window
        pattern: "/etc/deye-exporter/logs/app-{}.log"
        base: 1
        count: 7
    encoder:
      pattern: "{d(%Y-%m-%d %H:%M:%S)} [{l}] {t} - {m}{n}"

root:
  level: info
  appenders:
    - rolling_file

Configure logging as needed. Set the path using the LOG_CONFIG_FILE environment variable.

Prometheus Integration

Sample Scrape Config

scrape_configs:
  - job_name: 'deye'
    metrics_path: /deye
    static_configs:
      - targets:
        - 123456 # Deye station ID
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 127.0.0.1:9120 # Address of the deye-exporter container or host

Docker Usage

Build and Run

docker build -t deye-exporter:latest .
docker run -d -p 9120:9120 \
  -e CONFIG_FILE=/etc/deye-exporter/config.yaml \
  -e LOG_CONFIG_FILE=/etc/deye-exporter/log4rs.yaml \
  -v $(pwd)/configs:/etc/deye-exporter \
  rlggyp/deye-exporter:latest

Run with Prebuilt Image

You can use the prebuilt image from Docker Hub without building locally:

docker run -d -p 9120:9120 \
  -e CONFIG_FILE=/etc/deye-exporter/config.yaml \
  -e LOG_CONFIG_FILE=/etc/deye-exporter/log4rs.yaml \
  -v $(pwd)/configs:/etc/deye-exporter \
  rlggyp/deye-exporter:latest

Or with Docker Compose:

services:
  deye-exporter:
    image: rlggyp/deye-exporter:latest
    container_name: deye-exporter
    environment:
      - CONFIG_FILE=/etc/deye-exporter/config.yaml
      - LOG_CONFIG_FILE=/etc/deye-exporter/log4rs.yaml
    ports:
      - 9120:9120
    volumes:
      - ./configs:/etc/deye-exporter
    restart: unless-stopped

No need to build anything—just pull and run!

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0