Skip to content

Commit

Permalink
BREAKING: Rename error entities into fault entities (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Aug 16, 2024
1 parent a1cf3c6 commit 02ad581
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
6 changes: 3 additions & 3 deletions esp32-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ esphome:
min_version: 2024.6.0
project:
name: "syssi.esphome-pace-bms"
version: 1.0.0
version: 2.0.0

esp32:
board: wemos_d1_mini32
Expand Down Expand Up @@ -1704,7 +1704,7 @@ text_sensor:
}
return values;
# 11 Fault flag 2 byte R uint16 Hex See ^3
# 11 Status/Fault flag 2 byte R uint16 Hex See ^3
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} faults"
Expand Down Expand Up @@ -1741,7 +1741,7 @@ text_sensor:
}
return values;
# 11 Status flag 2 byte R uint16 Hex See ^3
# 11 Status/Fault flag 2 byte R uint16 Hex See ^3
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} status"
Expand Down
45 changes: 41 additions & 4 deletions esp8266-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ esphome:
min_version: 2024.6.0
project:
name: "syssi.esphome-pace-bms"
version: 1.0.0
version: 2.0.0

esp8266:
board: d1_mini
Expand Down Expand Up @@ -371,15 +371,15 @@ sensor:
# 11 Status/Fault flag 2 byte R uint16 Hex See ^3
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} errors bitmask"
name: "${name} fault status bitmask"
address: 11
register_type: holding
value_type: U_WORD
unit_of_measurement: ""
state_class: measurement
accuracy_decimals: 0

# 12 Balance status 2 byte R uint16 Hex
# 12 Balance status-bits per cell (1-16) 2 byte R uint16 Hex
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} balancer status"
Expand Down Expand Up @@ -1705,7 +1705,7 @@ text_sensor:
# 11 Status/Fault flag 2 byte R uint16 Hex See ^3
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} errors"
name: "${name} faults"
address: 11
register_type: holding
register_count: 1
Expand Down Expand Up @@ -1739,6 +1739,43 @@ text_sensor:
}
return values;
# 11 Status/Fault flag 2 byte R uint16 Hex See ^3
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} status"
address: 11
register_type: holding
register_count: 1
response_size: 2
raw_encode: HEXBYTES
lambda: |-
static const uint8_t STATUS_SIZE = 8;
static const char *const STATUS[STATUS_SIZE] = {
"CHG",
"DCHG",
"MOSFET_CHG",
"MOSFET_DCHG",
"LIMIT_CHG",
"Reserve (Bit 13)",
"Charger inversed",
"HEAT",
};
std::string values = "";
uint16_t mask = modbus_controller::word_from_hex_str(x, 0);
if (mask) {
for (int i = 8; i < (STATUS_SIZE+8); i++) {
if (mask & (1 << i)) {
values.append(STATUS[i-8]);
values.append(";");
}
}
if (!values.empty()) {
values.pop_back();
}
}
return values;
# 150 Version information 20 byte R uint16 ASCII
- platform: modbus_controller
modbus_controller_id: bms0
Expand Down

0 comments on commit 02ad581

Please sign in to comment.