VictronMPPT-ESPHOME/README.md

150 lines
3.8 KiB
Markdown
Raw Normal View History

2022-01-24 20:03:07 +00:00
# VictronMPPT-ESPHOME
2021-05-30 10:34:11 +00:00
2022-01-24 20:03:07 +00:00
ESPHome component to monitor a Victron MPPT Charger via ve.direct / UART TTL
2021-05-30 10:34:11 +00:00
2022-01-24 20:03:07 +00:00
## Supported devices
All Victron MPPT Chargers providing a ve.direct port.
## Tested devices
* Victron SmartSolar MPPT 75/15
* Victron SmartSolar MPPT 100/20
* Victron SmartSolar MPPT 150/35
* Victron SmartSolar MPPT 250/70
* Victron Phoenix Inverter 12/500
## Requirements
* [ESPHome 2021.10 or higher](https://github.com/esphome/esphome/releases).
* Generic ESP32 or ESP8266 board
## Schematics
```
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
| Pin | Purpose | ESP pin |
| :-----: | :----------- | :------------- |
| **1** | **GND** | GND |
| 2 | RX | |
| **3** | **TX** | D7 (RX) |
| 4 | 5V | |
2022-05-29 13:37:28 +00:00
<a href="images/circuit.jpg" target="_blank">
<img src="images/circuit_thumbnail.jpg" width="50%">
</a>
2022-01-24 20:03:07 +00:00
## Installation
You can install this component with [ESPHome external components feature](https://esphome.io/components/external_components.html) like this:
2021-05-30 10:34:11 +00:00
```yaml
2022-01-24 20:03:07 +00:00
external_components:
- source: github://KinDR007/VictronMPPT-ESPHOME@main
uart:
id: uart0
tx_pin: D8 # Not used! The communication is read-only
rx_pin: D7
baud_rate: 19200
rx_buffer_size: 256
2021-05-30 10:34:11 +00:00
victron:
2022-01-24 20:03:07 +00:00
id: victron0
uart_id: uart0
2021-05-30 10:34:11 +00:00
sensor:
- platform: victron
2022-01-24 20:03:07 +00:00
victron_id: victron0
2021-05-30 10:34:11 +00:00
panel_voltage:
2022-01-24 20:03:07 +00:00
name: "Panel voltage"
2021-05-30 10:34:11 +00:00
battery_voltage:
2022-01-24 20:03:07 +00:00
name: "Battery voltage"
2021-05-30 10:34:11 +00:00
battery_current:
2022-01-24 20:03:07 +00:00
name: "Battery current"
2021-05-30 10:34:11 +00:00
```
2022-01-24 20:03:07 +00:00
or just use the `esp8266-example.yaml` as proof of concept:
```bash
# 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
2021-09-05 16:26:53 +00:00
2022-01-24 20:03:07 +00:00
# Validate the configuration, create a binary, upload it, and start logs
esphome run esp8266-example.yaml
2021-09-05 16:26:53 +00:00
2022-01-24 20:03:07 +00:00
```
The `uart_id` and `victron_id` is optional if you use a single UART / victron device. All sensors are optional.
The victron device pushs one status message per second. To reduce the update interval of the ESPHome entities please use the `throttle` parameter to discard some messages.
2022-01-24 20:03:07 +00:00
The available numeric sensors are:
2021-05-30 10:34:11 +00:00
- `max_power_yesterday`
- `max_power_today`
- `yield_total`
- `yield_yesterday`
- `yield_today`
- `panel_voltage`
- `panel_power`
- `battery_current`
- `day_number`
2022-01-24 20:03:07 +00:00
- `charging_mode_id`
2021-05-30 10:34:11 +00:00
- `error_code`
2021-09-05 16:26:53 +00:00
- `tracking_mode_id`
- `load_current`
2022-01-24 20:10:55 +00:00
- `ac_out_voltage`
- `ac_out_current`
- `battery_voltage`
2022-01-24 20:15:24 +00:00
- `device_mode_id`
- `warning_code`
2021-05-30 10:34:11 +00:00
2022-01-24 20:10:55 +00:00
2022-01-24 20:03:07 +00:00
The available text sensors are:
2021-09-05 16:26:53 +00:00
- `charging_mode`
- `error`
- `tracking_mode`
- `firmware_version`
- `device_type`
2022-01-24 20:15:24 +00:00
- `device_mode`
- `warning`
Binary sensors:
2022-01-24 20:03:07 +00:00
- `load_state`
- `relay_state`
Big thanks for help to ssieb for the support!