GithubHelp home page GithubHelp logo

austilphukir / deye-inverter-mqtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kbialek/deye-inverter-mqtt

0.0 0.0 0.0 62 KB

Reads Deye solar inverter metrics and posts them over mqtt

License: Apache License 2.0

Shell 0.17% Python 93.65% Makefile 3.07% Dockerfile 3.11%

deye-inverter-mqtt's Introduction

Deye solar inverter MQTT bridge

Reads Deye solar inverter metrics using Modbus over TCP and publishes them over MQTT.

Tested with:

Supported metrics

The meaning of certain registers depends on the inverter type. For example, string inverters use registers 0x46 - 0x4e to report AC phase voltage/current. On the other hand, micro inverters use this same registers to report pv1-pv4 cumulative energy. Generally there are three types of inverters documented in the specification: string, micro and hybrid. In the table below you can see, that the metrics are assigned to specific groups. Empty value indicates a general purpose metric, that is available in all type of inverters. You should specify the set of groups that is appropriate for your inverter in DEYE_METRIC_GROUPS environment variable, otherwise only general purpose metrics will be reported over mqtt. Typically you should set it to either string or micro. Additional groups may be added in the future.

Metric Modbus address MQTT topic suffix Unit Groups
Production today 0x3c day_energy kWh
Uptime 0x3e uptime minutes
Total Production (Active) 0x3F - 0x40 total_energy kWh
Daily Production 1 0x41 dc/pv1/day_energy kWh micro
Daily Production 2 0x42 dc/pv2/day_energy kWh micro
Daily Production 3 0x43 dc/pv3/day_energy kWh micro
Daily Production 4 0x44 dc/pv4/day_energy kWh micro
Total Production 1 0x45 - 0x46 dc/pv1/total_energy kWh micro
Total Production 2 0x47 - 0x48 dc/pv2/total_energy kWh micro
Total Production 3 0x4a - 0x4b dc/pv3/total_energy kWh micro
Total Production 4 0x4d - 0x4e dc/pv4/total_energy kWh micro
AC Phase 1 voltage 0x49 ac/l1/voltage V string, micro
AC Phase 2 voltage 0x4a ac/l2/voltage V string
AC Phase 3 voltage 0x4b ac/l3/voltage V string
AC Phase 1 current 0x4c ac/l1/current A string, micro
AC Phase 2 current 0x4d ac/l2/current A string
AC Phase 3 current 0x4e ac/l3/current A string
AC Frequency 0x4f ac/freq Hz
Operating power 0x50 operating_power W string, micro
DC total power 0x52 dc/total_power W string, micro
AC apparent power 0x54 ac/apparent_power W string, micro
AC active power 0x56 - 0x57 ac/active_power W string, micro
AC reactive power 0x58 ac/reactive_power W string, micro
Radiator temperature 0x5a radiator_temp C
IGBT temperature 0x5b igbt_temp C
DC PV1 voltage 0x6d dc/pv1/voltage V
DC PV1 current 0x6e dc/pv1/current A
DC PV2 voltage 0x6f dc/pv2/voltage V
DC PV2 current 0x70 dc/pv2/current A
DC PV3 voltage 0x71 dc/pv3/voltage V
DC PV3 current 0x72 dc/pv3/current A
DC PV4 voltage 0x73 dc/pv4/voltage V
DC PV4 current 0x74 dc/pv4/current A

Installation

  1. Copy config.env.example as config.env

  2. Fill in values in config.env

  3. Run the container

    docker run --rm --env-file config.env ghcr.io/kbialek/deye-inverter-mqtt
    

Configuration

All configuration options are controlled through environment variables.

  • LOG_LEVEL - application log level, can be any of DEBUG, INFO, WARN, ERROR
  • DEYE_DATA_READ_INTERVAL - interval between subsequent data reads, in seconds, defaults to 60
  • DEYE_METRIC_GROUPS - a comma delimited set of:
    • string - set when connecting to a string inverter
    • micro - set when connecting to a micro inverter
  • DEYE_LOGGER_SERIAL_NUMBER - inverter data logger serial number
  • DEYE_LOGGER_IP_ADDRESS - inverter data logger IP address
  • DEYE_LOGGER_PORT - inverter data logger communication port, typically 8899
  • MQTT_HOST
  • MQTT_PORT
  • MQTT_USERNAME
  • MQTT_PASSWORD
  • MQTT_TOPIC_PREFIX - mqtt topic prefix used for all inverter metrics

Reading and writing raw register values

The tool allows reading and writing raw register values directly in the terminal.

USE AT YOUR OWN RISK! Be sure to know what you are doing. Writing invalid values may damage the inverter. By using this tool you accept this risk and you take full responsiblity for the consequences.

  • To read register value execute:

    docker run --rm --env-file config.env ghcr.io/kbialek/deye-inverter-mqtt r <reg_address>
    

    where <reg_address> is register address (decimal)

  • To write register value execute:

    docker run --rm --env-file config.env ghcr.io/kbialek/deye-inverter-mqtt w <reg_address> <reg_value>
    

    where <reg_address> is register address (decimal), and <reg_value> is a value to set (decimal)

Development

  1. Install python dependencies
    pip install -r requirements.txt
    
  2. Running the code
    1. Option 1 - Run the code locally without using Docker
      1. Fill in config.env file
      2. Execute make run
    2. Option 2 - Build a new docker image locally (for amd64 architecture)
      1. Execute make docker-build-local
      2. Fill in config.env file
      3. Execute make docker-run
  3. To run the tests use make test

deye-inverter-mqtt's People

Contributors

kbialek avatar antagor avatar geeks-r-us avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.