KinDR007/VictronMPPT-ESPHOME
حول
يربط واجهة VE.Direct لشاحن Victron MPPT بعقدة ESPHome.
مشاريع أخرىالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- +٢
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلVictronMPPT-ESPHOME
ESPHome component to monitor a Victron device (MPPT, SmarShunt, BMV, Phoenix Inverter ... ) via ve.direct / UART TTL
Supported devices
All Victron devices providing a ve.direct port.
Tested devices
Victron SmartSolar MPPT 75/10 rev2 (0xA074)
Victron SmartSolar MPPT 75/15
Victron SmartSolar MPPT 100/15
Victron SmartSolar MPPT 100/20
Victron BlueSolar MPPT 100/30
Victron SmartSolar MPPT 150/35
Victron SmartSolar MPPT 150/45
Victron SmartSolar MPPT 150/60
Victron SmartSolar MPPT VE.Can 150/100 rev2 (Using VE.Direct port)
Victron SmartSolar MPPT 250/70
Victron Phoenix Inverter 12/500
Victron Blue Smart IP65 Charger 12|25
Victron Orion XS 12|12
Victron SmartShunt 500A/50mV
Requirements
- ESPHome 2024.6.0 or higher.
- Generic ESP32, ESP8266, BK72xx or RP2040 board
Schematics
Attention: The TX voltage of the VE.Direct interface depends on the product: Some are 5V, others 3.3V!
Please measure the voltage between TX and GND. In case of a logic level of 5V you should add a voltage divider or logic level converter between the ESP and the Victron device.
UART-TTL
┌────────────────┐ ┌──────────────────┐
│ GND o│<-------------->│o GND │
│ Victron TX o│--------------->│o D7 ESP32/ │
│ Charger RX o│ │ ESP8266 │<-- GND
│ 5V o│ │ │<-- 3.3V
└────────────────┘ └──────────────────┘
# UART-TTL jack (JST-PH 2.0mm pinch)
┌─── ─────── ────┐
│ │
│ O O O O │
│GND RX TX VCC │
└────────────────┘
If you are unsure about to pin order please measure the voltage between GND and VCC (5V). If you measure a positive voltage you know the position of VCC and GND!
JST-PH jack (direct connection noninsulated)
| Pin | Purpose | ESP8266 pin | ESP32 pin |
|---|---|---|---|
| 1 | GND | GND | GND |
| 2 | RX | ||
| 3 | TX | D7 (RX) | GPIO16 (RX) |
| 4 | 5V |
note: JST-PH connector on this image has lock downwards
According to the VE.direct FAQ, the 5V/3.3 pin has a strict current limitation, allowing only 10mA on average with occasional 20mA bursts lasting up to 5 milliseconds. ESP devices like the ESP8266 and ESP32 draw significantly more current than this limit, typically several hundred milliamperes during startup and an additional 100-150mA when transmitting, which would immediately overload and permanently damage the Victron device's power circuit. Therefore, powering an ESP directly from these pins is not possible.
note: Level shifter (5V<->3.3V)between esp32 and mppt is not necessary (tested on esp32 nodemcu v1 and MPPT 75/115 , MPPT 150/35 and smartshunt 500A)
Safe connection (insulated)
use ADUM 1201 for galvanic isolation between ESP and Victron Devices (or make an insulated cable for Ve.direct)
| Ve.Direct |
Ve.Direct |
Purpose (wire color) | connect | ADUM1201 #2 | ADUM1201 #1 | connect | ESP8266 pin | ESP32 pin | USB TTL cable |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | GND (black) | <- -> | GND2 | GND1 | <- -> | GND | GND | GND |
| 2 | 2 | RX (red) | <- -> | VOB | VIB | <- -> | D8 (TX) | GPIO17 (TX) | TX |
| 3 | 3 | TX (white) | <- -> | VIA | VOA | <- -> | D7 (RX) | GPIO16 (RX) | RX |
| 4 | 4 | 5V or 3V3 (yellow) | <- -> | VDD2 | VDD1 | <- -> | 3V3 or 5V | 3V3 or 5V | 3V3 or 5V |
Note that if the VE.direct RX line is connected to VOB on the ADUM1201, the corresponding VIB needs to be connected to a valid signal, i.e. VDD1 or GND1. Depending on the RX pin configuration of the device, this might enable/disable the device. Check the device documentation for details. If unsure, best leave the RX line unconnected, in which case the VIB pin of the ADUM still should be tied to VDD1 or GND1 to not have it floating.
Installation
You can install this component with ESPHome external components feature like this:
external_components:
- source: github://KinDR007/VictronMPPT-ESPHOME@main
uart:
id: uart_0
tx_pin: D8 # Not used! The communication is read-only
rx_pin: D7
baud_rate: 19200
rx_buffer_size: 256
victron:
id: victron0
uart_id: uart_0
sensor:
- platform: victron
victron_id: victron0
panel_voltage:
name: "Panel voltage"
battery_voltage:
name: "Battery voltage"
battery_current:
name: "Battery current"
or just use the esp8266-example.yaml as proof of concept:
# Install esphome
pip3 install esphome
# Clone this external component
git clone https://github.com/KinDR007/VictronMPPT-ESPHOME.git
cd VictronMPPT-ESPHOME
# Create a secret.yaml containing some setup specific secrets
cat > secrets.yaml <<EOF
mqtt_host: MY_MQTT_HOST
mqtt_username: MY_MQTT_USERNAME
mqtt_password: MY_MQTT_PASSWORD
wifi_ssid: MY_WIFI_SSID
wifi_password: MY_WIFI_PASSWORD
EOF
# Validate the configuration, create a binary, upload it, and start logs
esphome run esp8266-example.yaml
The uart_id and victron_id is optional if you use a single UART / victron device. All sensors are optional.
The victron device sends its data once per second. Devices with many fields (e.g. BMV-70x/712, SmartShunt) split it into several blocks, each with its own checksum. To reduce the update interval of the ESPHome entities please use the throttle parameter to discard whole blocks:
- Each block type (identified by its first field) is published at most once per interval, so all values of the device are updated once per interval.
- The first block of each type after boot is published immediately.
- The interval is rounded to the nearest second (halves are rounded up).
throttle: 2sandthrottle: 1500mspublish every second block of a type,throttle: 1s(default) every block. - Blocks dropped because of a checksum error do not count, the next valid block of that type is published.
To throttle single entities, use the sensor filters of ESPHome instead (e.g. throttle or throttle_average).
Entities
Binary sensors
| Label | Sensor name |
|---|---|
| LOAD | load_state |
| Relay | relay_state |
Sensors
| Label | Sensor name |
|---|---|
| AC_OUT_V | ac_out_voltage |
| AC_OUT_I | ac_out_current |
| AC_OUT_S | ac_out_apparent_power |
| CE | consumed_amp_hours |
| CS | charging_mode_id |
| DM | midpoint_deviation_of_the_battery_bank |
| ERR | error_code |
| HSDS | day_number |
| MPPT | tracking_mode_id |
| I | battery_current |
| I2 | battery_current_2 |
| I3 | battery_current_3 |
| IL | load_current |
| MODE | device_mode_id |
| MON | dc_monitor_mode_id |
| OR | off_reason_bitmask |
| P | instantaneous_power |
| PPV | panel_power |
| SOC | state_of_charge |
| T | battery_temperature |
| TTG | time_to_go |
| VPV | panel_voltage |
| V | battery_voltage |
| V2 | battery_voltage_2 |
| V3 | battery_voltage_3 |
| VM | midpoint_voltage_of_the_battery_bank |
| VS | auxiliary_battery_voltage |
| WARN | warning_code |
| H1 | depth_of_the_deepest_discharge |
| H2 | depth_of_the_last_discharge |
| H3 | depth_of_the_average_discharge |
| H4 | number_of_charge_cycles |
| H5 | number_of_full_discharges |
| H6 | cumulative_amp_hours_drawn |
| H7 | min_battery_voltage |
| H8 | max_battery_voltage |
| H9 | last_full_charge |
| H10 | number_of_automatic_synchronizations |
| H11 | number_of_low_main_voltage_alarms |
| H12 | number_of_high_main_voltage_alarms |
| H13 | number_of_low_auxiliary_voltage_alarms |
| H14 | number_of_high_auxiliary_voltage_alarms |
| H15 | min_auxiliary_battery_voltage |
| H16 | max_auxiliary_battery_voltage |
| H17 | amount_of_discharged_energy |
| H18 | amount_of_charged_energy |
| H19 | yield_total |
| H20 | yield_today |
| H21 | max_power_today |
| H22 | yield_yesterday |
| H23 | max_power_yesterday |
| DC_IN_V | dc_input_voltage |
| DC_IN_I | dc_input_current |
| DC_IN_P | dc_input_power |
Text sensors
| Label | Sensor name |
|---|---|
| Alarm | alarm_condition_active |
| AR | alarm_reason |
| BMV | model_description |
| CS | charging_mode |
| ERR | error |
| FW | firmware_version |
| FWE | firmware_version_24bit |
| HC# | hardware_revision |
| MODE | device_mode |
| MON | dc_monitor_mode |
| MPPT | tracking_mode |
| OR | off_reason |
| PID | device_type |
| WARN | warning |
| SER# | serial_number |
Debugging
If this component doesn't work out of the box for your device please flash the debug-esp8266-example.yaml and create an issue providing the full ESPHome log.
esphome run debug-esp8266-example.yaml
Thanks
Big thanks for help to ssieb for the support!
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…