syssi / esphome-pace-bms

ESPHome component to monitor and control a PACE Battery Management System (PACE-BMS) via RS485 (Modbus)
Apache License 2.0
28 stars 9 forks source link

Strange response from 485 #54

Open tumbochka opened 1 week ago

tumbochka commented 1 week ago

Hello!

We discussed an ability to monitor several battery banks via rs-232 in Seplos project but stucked so I decided to try another approach. I bought a device:

telegram-cloud-photo-size-2-5393096000597517877-y

It has esp32 and rs485.

Then I installed your config using 21 and 22 pins:

substitutions:
  name: pace-bms
  device_description: "Monitor and control a PACE BMS via RS485 (Modbus)"
  tx_pin: GPIO22
  rx_pin: GPIO21
  #flow_control_pin: GPIO18

esphome:
  name: ${name}
  comment: ${device_description}
  min_version: 2024.6.0
  project:
    name: "syssi.esphome-pace-bms"
    version: 2.0.0

esp32:
  board: wemos_d1_mini32
  framework:
    type: esp-idf

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

ota:
  platform: esphome

logger:
  level: DEBUG

# 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
    baud_rate: 9600
    tx_pin: ${tx_pin}
    rx_pin: ${rx_pin}
    debug:
      direction: BOTH
      dummy_receiver: false

modbus:
  - id: modbus0
    uart_id: uart_0
    # flow_control_pin: ${flow_control_pin}
    send_wait_time: 200ms

modbus_controller:
  - id: bms0
    # Slave address 0x01
    address: 0x01
    modbus_id: modbus0
    command_throttle: 200ms
    update_interval: 10s
  # - id: bms1
  #   # Slave address 0x02
  #   address: 0x02
  #   modbus_id: modbus0
  #   command_throttle: 200ms
  #   update_interval: 10s    

binary_sensor:
  #  11  Status/Fault flag                     2 byte   R  uint16  Hex See ^3
  #      Bit 8: Status: Charging operation
  - platform: modbus_controller
    modbus_controller_id: bms0
    name: "${name} charging operation"
    address: 11
    register_type: holding
    bitmask: 0x0100

  #  11  Status/Fault flag                     2 byte   R  uint16  Hex See ^3
  #      Bit 8: Status: Charging operation
  - platform: modbus_controller
    modbus_controller_id: bms1
    name: "${name} charging operation"
    address: 11
    register_type: holding
    bitmask: 0x0100

.... and other sensors   

I changed the 485 protocol to Pace in pbms tools.

And I got the following response:

[23:04:56][D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[23:04:57][D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[23:04:57][D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[23:04:57][D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[23:04:57][D][uart_debug:114]: >>> 01:03:00:00:00:08:44:0C
[23:04:57][D][modbus_controller:040]: Modbus command to device=1 register=0x00 countdown=0 no response received - removed from send queue
[23:04:57][D][uart_debug:114]: >>> 01:03:00:09:00:04:94:0B
[23:04:58][D][uart_debug:114]: >>> 01:03:00:09:00:04:94:0B
[23:04:58][D][uart_debug:114]: >>> 01:03:00:09:00:04:94:0B
[23:04:58][W][modbus:114]: Modbus CRC Check failed! B541!=777
[23:04:58][D][uart_debug:114]: <<< 87:FF:91:77:07:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:7F:7E:FF:FF:EF:77:E7:00:7F:7E:FF:FF:EF:77:E7:00:7F:7E:FF:FF:EF:77:E7:00:7F:7E:FF:FF:EF:77:E7:00:7F:7E:FF:FF:EF:77:E7:00:7F:7E:ED:FF:F7:D7:7A:7F:7E:ED:FF:F7:D7:7A:7F:7E:ED:FF:F7
[23:04:58][D][uart_debug:114]: >>> 01:03:00:09:00:04:94:0B
[23:04:58][D][uart_debug:114]: >>> 01:03:00:09:00:04:94:0B
[23:04:58][D][modbus_controller:040]: Modbus command to device=1 register=0x09 countdown=0 no response received - removed from send queue
[23:04:59][D][uart_debug:114]: >>> 01:03:00:0F:00:16:F4:07
[23:04:59][D][uart_debug:114]: >>> 01:03:00:0F:00:16:F4:07
[23:04:59][D][uart_debug:114]: >>> 01:03:00:0F:00:16:F4:07
[23:04:59][D][uart_debug:114]: >>> 01:03:00:0F:00:16:F4:07
[23:04:59][D][uart_debug:114]: >>> 01:03:00:0F:00:16:F4:07
[23:05:00][D][modbus_controller:040]: Modbus command to device=1 register=0x0F countdown=0 no response received - removed from send queue
[23:05:00][D][uart_debug:114]: >>> 01:03:00:3C:00:37:C4:10
[23:05:00][D][uart_debug:114]: >>> 01:03:00:3C:00:37:C4:10
[23:05:00][D][uart_debug:114]: >>> 01:03:00:3C:00:37:C4:10
[23:05:00][D][uart_debug:114]: >>> 01:03:00:3C:00:37:C4:10
[23:05:00][D][uart_debug:114]: >>> 01:03:00:3C:00:37:C4:10
[23:05:01][D][modbus_controller:040]: Modbus command to device=1 register=0x3C countdown=0 no response received - removed from send queue
[23:05:04][D][uart_debug:114]: >>> 02:03:00:0B:00:01:F5:FB
[23:05:04][D][uart_debug:114]: >>> 02:03:00:0B:00:01:F5:FB
[23:05:04][D][uart_debug:114]: >>> 02:03:00:0B:00:01:F5:FB
[23:05:04][D][uart_debug:114]: >>> 02:03:00:0B:00:01:F5:FB
[23:05:05][D][uart_debug:114]: >>> 02:03:00:0B:00:01:F5:FB
[23:05:05][D][uart_debug:114]: <<< D7:7A:7F:7E:ED:FF:F7:D7:7A:7F:7E:ED:FF:F7:D7:7A:7F:7E:E1:FF:D3:17:7C:7F:7E:E1:FF:D3:17:7C:7F:7E:E1:FF:D3:17:7C:7F:7E:E1:FF:D3:17:7C:7F:7E:E1:FF:D3:17:7C:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:7F:7E:87:FF:91:77:07:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15:02:BF:FF:E9:FF:FD:15

What could I do wrong?

syssi commented 1 week ago
  1. Which port of your BMS do you use for RS485 communication?
  2. Please check the DIP switch configuration. Did you select select address 0x01 here?
  3. How does your data cable look like?
  4. Did you try to swap GPIO22 and GPIO21 just for testing?
tumbochka commented 1 week ago
  1. The one I used for the solar assistent previously.

image

The 485 that near CAN (the closest one)

  1. It's correct, the Master battery.

image

  1. Just cut a network cable and insert orange, orange-white and green-white.

image

  1. Yep no response at all in this case.
tumbochka commented 3 days ago

@syssi Any ideas? :)

syssi commented 3 days ago

Do you have an second ESP and RS485 converter to make some tests?

tumbochka commented 3 days ago

@syssi Need to purchase may be :) Could you please take a look at this thread when you have some time? https://github.com/syssi/esphome-seplos-bms/discussions/68