Skip to content
Edit this page

Multiple devices

Two MPPT chargers on one ESP, each on its own UART bus.

What it shows

  • Two UART buses: uart_0 on D7, uart_1 on D5
  • Two hubs, victron0 and victron1
  • Every entity references its hub with victron_id

Tip

The ESP8266 has only one full hardware UART for receiving, the second bus runs as software serial. For more than two devices prefer an ESP32 with its additional hardware UARTs.

Configuration

Source: smartsolar-mppt-esp8266-example-multiple-uarts.yaml

smartsolar-mppt-esp8266-example-multiple-uarts.yaml
substitutions:
  name: victron
  device0: victron0
  device1: victron1
  external_components_source: github://KinDR007/VictronMPPT-ESPHOME@main

esphome:
  name: ${name}
  project:
    name: "KinDR007.VictronMPPT-ESPHOME"
    version: 2.0.0

esp8266:
  board: d1_mini

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  min_auth_mode: WPA2

ota:
  platform: esphome

logger:
  baud_rate: 0
  esp8266_store_log_strings_in_flash: false

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
mqtt:
  broker: !secret mqtt_host
  username: !secret mqtt_username
  password: !secret mqtt_password
  id: mqtt_client

# api:

uart:
  - id: uart_0
    tx_pin: D8  # Not connected! The communication is read-only
    rx_pin: D7  # Connect this GPIO and GND to the first MPPT charger
    baud_rate: 19200
    rx_buffer_size: 256
  - id: uart_1
    tx_pin: D6  # Not connected! The communication is read-only
    rx_pin: D5  # Connect this GPIO and GND to the second MPPT charger
    baud_rate: 19200
    rx_buffer_size: 256

victron:
  - id: victron0
    uart_id: uart_0
    throttle: 10s
  - id: victron1
    uart_id: uart_1
    throttle: 10s

sensor:
  - platform: victron
    victron_id: victron0
    max_power_yesterday:
      name: "${device0} max power yesterday"
    panel_voltage:
      name: "${device0} panel voltage"
    panel_power:
      name: "${device0} panel power"
    battery_current:
      name: "${device0} panel current"
    load_current:
      name: "${device0} load current"

  - platform: victron
    victron_id: victron1
    max_power_yesterday:
      name: "${device1} max power yesterday"
    panel_voltage:
      name: "${device1} panel voltage"
    panel_power:
      name: "${device1} panel power"
    battery_current:
      name: "${device1} panel current"
    load_current:
      name: "${device1} load current"

text_sensor:
  - platform: victron
    victron_id: victron0
    charging_mode:
      name: "${device0} charging mode"
    error:
      name: "${device0} error"
    tracking_mode:
      name: "${device0} tracking mode"

  - platform: victron
    victron_id: victron1
    charging_mode:
      name: "${device1} charging mode"
    error:
      name: "${device1} error"
    tracking_mode:
      name: "${device1} tracking mode"

Run it

esphome run smartsolar-mppt-esp8266-example-multiple-uarts.yaml

See Build & flash for details and the secrets the example needs.