BMS Daly PZEM-004T Podłączanie do jednego WT32-ETH01 Kilka UART-ów

Mam podłączone i skonfigurowane BMS Daly do esphome i drugi zestaw pzem-004T podłączone do innego esphome.
Chcę podłączyć BMS i Pzem do jednego wt32-ETH01
Wiem że dostępne 3linie Uart.
Ma ktoś przykładowy kod aby sensory wykorzystywały odpowiednie Uart1/Uart2

Jeśli już masz coś skonfigurowane i działające, to należy podać wszystkie dostępne informacje zakładając nowy temat, bo chcący ewentualnie pomóc nie będą musieli szukać informacji w internecie, a Ty je masz przed nosem i liczysz przecież na pomoc. Podasz kody YAML swoich konfiguracji ESPHome i może otrzymasz gotowca łączącego wszystko w całość. Minimum wysiłku, to wrzucenie linków do dokumentacji ESPHome dla komponentów, o które pytasz.

1 polubienie

BMS–esp wt32-eth01

esphome:
  name: offgrid
  friendly_name: OffGrid

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
    level: INFO
    baud_rate: 0

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"
# Enable Web server
web_server:
  port: 80


ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16
  # Optional manual IP
  manual_ip:
    static_ip: 192.168.10.156
    gateway: 192.168.10.1
    subnet: 255.255.255.0

uart:
  tx_pin: GPIO1
  rx_pin: GPIO3
  baud_rate: 9600
  rx_buffer_size: 512

daly_bms:
  update_interval: 20s

sensor:
  - platform: daly_bms
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    max_cell_voltage:
      name: "Max Cell Voltage"
    max_cell_voltage_number:
      name: "Max Cell Voltage Number"
    min_cell_voltage:
      name: "Min Cell Voltage"
    min_cell_voltage_number:
      name: "Min Cell Voltage Number"
    max_temperature:
      name: "Max Temperature"
    max_temperature_probe_number:
      name: "Max Temperature Probe Number"
    min_temperature:
      name: "Min Temperature"
    min_temperature_probe_number:
      name: "Min Temperature Probe Number"
    remaining_capacity:
      name: "Remaining Capacity"
    cells_number:
      name: "Cells Number"
    temperature_1:
      name: "Temperature 1"
    temperature_2:
      name: "Temperature 2"
    cell_1_voltage:
      name: "Cell 1 Voltage"
    cell_2_voltage:
      name: "Cell 2 Voltage"
    cell_3_voltage:
      name: "Cell 3 Voltage"
    cell_4_voltage:
      name: "Cell 4 Voltage"
    cell_5_voltage:
      name: "Cell 5 Voltage"
    cell_6_voltage:
      name: "Cell 6 Voltage"
    cell_7_voltage:
      name: "Cell 7 Voltage"
    cell_8_voltage:
      name: "Cell 8 Voltage"


text_sensor:
  - platform: daly_bms
    status:
      name: "BMS Status"


binary_sensor:
  - platform: daly_bms
    charging_mos_enabled:
      name: "Charging MOS"
    discharging_mos_enabled:
      name: "Discharging MOS"

PZEM-004T—Esp32

esphome:
  name: esp32energia

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xxx"

# Enable Web server
web_server:
  port: 80

wifi:
  ssid: "xxx"
  password: "xxx"


  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32"
    password: "xxx"

captive_portal:
    


# Example configuration entry
uart:
  rx_pin: GPIO1
  tx_pin: GPIO3
  baud_rate: 9600

modbus:

sensor:
# Pomiar mocy energia
  - platform: pzemac
    current:
      name: "energia Current"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    voltage:
      name: "energia Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    energy:
      name: "energia Energy"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power:
      name: "energia Power"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    frequency:
      name: "energia Frequency"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power_factor:
      name: "energia Power Factor"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    update_interval: 6s

Widziałem ten artykuł i od tygodnia próbowałem różne warianty łącznia i za każdym razem nie miałem połączenia z żadnym z urządzeń.

Jedyna różnica między konfiguracjami jest wykorzystanie innych płytek esp z lanem i bez.

Żeby nie leżało koło siebie kilka esp32 mam zamiar przejść na jeden wt32-eth01

Na początek zmienił bym boards na wt32-eth01 podążając za listą:

https://docs.platformio.org/en/latest/boards/espressif32/wt32-eth01.html

Proszę jeszcze o próbkę Twojego kodu z użyciem dwóch UART.
Właśnie dziś wpadła do mnie płytka z WT32-ETH01 więc może znajdę czas na testowanie.

No właśnie jak dodaję uart1 uart2 to nie może skompilować lub nie działa.
Aktualny kod mam taki:

esphome:
  name: offgrid
  friendly_name: OffGrid

esp32:
  board: wt32-eth01
  framework:
    type: arduino

# Enable logging
logger:
    level: INFO
    baud_rate: 0
# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"


ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16
  # Optional manual IP
  manual_ip:
    static_ip: 192.168.10.156
    gateway: 192.168.10.1
    subnet: 255.255.255.0

uart:
  - id: uart_1
    tx_pin: GPIO1
    rx_pin: GPIO3
    baud_rate: 9600
    rx_buffer_size: 512
  - id: uart_2
    tx_pin: GPIO17
    rx_pin: GPIO05
    baud_rate: 9600

daly_bms:
  update_interval: 20s

sensor:
  - platform: daly_bms
    id: uart_1
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    max_cell_voltage:
      name: "Max Cell Voltage"
    max_cell_voltage_number:
      name: "Max Cell Voltage Number"
    min_cell_voltage:
      name: "Min Cell Voltage"
    min_cell_voltage_number:
      name: "Min Cell Voltage Number"
    max_temperature:
      name: "Max Temperature"
    max_temperature_probe_number:
      name: "Max Temperature Probe Number"
    min_temperature:
      name: "Min Temperature"
    min_temperature_probe_number:
      name: "Min Temperature Probe Number"
    remaining_capacity:
      name: "Remaining Capacity"
    cells_number:
      name: "Cells Number"
    temperature_1:
      name: "Temperature 1"
    temperature_2:
      name: "Temperature 2"
    cell_1_voltage:
      name: "Cell 1 Voltage"
    cell_2_voltage:
      name: "Cell 2 Voltage"
    cell_3_voltage:
      name: "Cell 3 Voltage"
    cell_4_voltage:
      name: "Cell 4 Voltage"
    cell_5_voltage:
      name: "Cell 5 Voltage"
    cell_6_voltage:
      name: "Cell 6 Voltage"
    cell_7_voltage:
      name: "Cell 7 Voltage"
    cell_8_voltage:
      name: "Cell 8 Voltage"
 
  - platform: pzemac
    id: uart_1
    current:
      name: "energia Current"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    voltage:
      name: "energia Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    energy:
      name: "energia Energy"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power:
      name: "energia Power"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    frequency:
      name: "energia Frequency"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power_factor:
      name: "energia Power Factor"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    update_interval: 6s

text_sensor:
  - platform: daly_bms
    id: uart_1
    status:
      name: "BMS Status"


binary_sensor:
  - platform: daly_bms
    id: uart_1
    charging_mos_enabled:
      name: "Charging MOS"


    discharging_mos_enabled:
      name: "Discharging MOS"

Zebrałeś logi podczas kompilacji, wskazują na jakiś błąd? Jak przebiega walidacja YAML?

EDIT:
Może być potrzebne określenie adresów i ID dla sekcji modbus.

Pozmieniałem trochę i nie chciało mi się skompilować, ale się udało z takim kodem:

  name: offgrid
  friendly_name: OffGrid

esp32:
  board: wt32-eth01
  framework:
    type: arduino

# Enable logging
logger:
    level: INFO
    baud_rate: 0
# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  password: "xxx"


ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16
  # Optional manual IP
  manual_ip:
    static_ip: 192.168.10.156
    gateway: 192.168.10.1
    subnet: 255.255.255.0

uart:
  - id: uart_1
    tx_pin: GPIO1
    rx_pin: GPIO3
    baud_rate: 9600
    rx_buffer_size: 512
  - id: uart_2
    tx_pin: GPIO17
    rx_pin: GPIO05
    baud_rate: 9600

daly_bms:
  uart_id: uart_1
  update_interval: 20s

modbus:
  - id: uart_22
    uart_id: uart_2
  
sensor:
  - platform: daly_bms
    voltage:
      name: "Battery Voltage"
    current:
      name: "Battery Current"
    battery_level:
      name: "Battery Level"
    max_cell_voltage:
      name: "Max Cell Voltage"
    max_cell_voltage_number:
      name: "Max Cell Voltage Number"
    min_cell_voltage:
      name: "Min Cell Voltage"
    min_cell_voltage_number:
      name: "Min Cell Voltage Number"
    max_temperature:
      name: "Max Temperature"
    max_temperature_probe_number:
      name: "Max Temperature Probe Number"
    min_temperature:
      name: "Min Temperature"
    min_temperature_probe_number:
      name: "Min Temperature Probe Number"
    remaining_capacity:
      name: "Remaining Capacity"
    cells_number:
      name: "Cells Number"
    temperature_1:
      name: "Temperature 1"
    temperature_2:
      name: "Temperature 2"
    cell_1_voltage:
      name: "Cell 1 Voltage"
    cell_2_voltage:
      name: "Cell 2 Voltage"
    cell_3_voltage:
      name: "Cell 3 Voltage"
    cell_4_voltage:
      name: "Cell 4 Voltage"
    cell_5_voltage:
      name: "Cell 5 Voltage"
    cell_6_voltage:
      name: "Cell 6 Voltage"
    cell_7_voltage:
      name: "Cell 7 Voltage"
    cell_8_voltage:
      name: "Cell 8 Voltage"
 
  - platform: pzemac
    modbus_id: uart_22
    current:
      name: "energia Current"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    voltage:
      name: "energia Voltage"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    energy:
      name: "energia Energy"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power:
      name: "energia Power"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    frequency:
      name: "energia Frequency"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    power_factor:
      name: "energia Power Factor"
      filters:
        - sliding_window_moving_average:
            window_size: 10
            send_every: 10   
    update_interval: 6s

text_sensor:
  - platform: daly_bms

    status:
      name: "BMS Status"


binary_sensor:
  - platform: daly_bms

    charging_mos_enabled:
      name: "Charging MOS"


    discharging_mos_enabled:
      name: "Discharging MOS"

Po poludniu uruchomię bateria i zobacze czy działa.

Edit.
Konfiguracja jest działająca. Dziękuję za wskazówki.

1 polubienie