-
Notifications
You must be signed in to change notification settings - Fork 3
Decoding of Battery Type and Error Code; small fixes; CT Info and Settings #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
d281dd5
9ef7bf7
9332284
4b0b520
8d9232d
b62c00f
d51f8a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,67 +45,15 @@ binary_sensor: | |
bitmask: 0x1 | ||
|
||
sensor: | ||
# New - To be Tested | ||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - Active Power Regulation" | ||
id: "${entities_id_prefix}_General_Active_Power_Regulation" | ||
register_type: holding | ||
address: 77 | ||
unit_of_measurement: "%" | ||
value_type: S_WORD | ||
accuracy_decimals: 1 | ||
filters: | ||
- multiply: 0.1 # Converts value to percentage | ||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - Reactive Power Regulation" | ||
id: "${entities_id_prefix}_General_Reactive_Power_Regulation" | ||
register_type: holding | ||
address: 78 | ||
unit_of_measurement: "%" | ||
value_type: S_WORD | ||
accuracy_decimals: 1 | ||
filters: | ||
- multiply: 0.1 # Converts value to percentage | ||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - Apparent Power Regulation" | ||
id: "${entities_id_prefix}_General_Apparent_Power_Regulation" | ||
register_type: holding | ||
address: 79 | ||
unit_of_measurement: "" | ||
value_type: S_WORD | ||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - Island Protection Enable" | ||
id: "${entities_id_prefix}_General_Island_Protection_Enable" | ||
register_type: holding | ||
address: 83 | ||
unit_of_measurement: "" | ||
value_type: S_WORD | ||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - Grid Check Source" | ||
name: "${entities_name_prefix}-General - Grid check from Meter or CT" | ||
id: "${entities_id_prefix}_General_Grid_Check_Source" | ||
register_type: holding | ||
address: 344 | ||
unit_of_measurement: "" | ||
value_type: U_WORD | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't be easier to have an |
||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - External Current Clamp Phase" | ||
id: "${entities_id_prefix}_General_External_Current_Clamp_Phase" | ||
register_type: holding | ||
address: 144 | ||
unit_of_measurement: "" | ||
value_type: S_WORD | ||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-General - DC Transformer Temperature" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
text_sensor: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed ? |
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
bitmask: 0 | ||
register_type: holding | ||
address: 500 | ||
raw_encode: HEXBYTES | ||
id: "${entities_id_prefix}_Status_Running_Status" | ||
name: "${entities_name_prefix}-Status - Running Status" | ||
lambda: |- | ||
uint16_t value = modbus_controller::word_from_hex_str(x, 0); | ||
switch (value) { | ||
case 0: return std::string("standby"); | ||
case 1: return std::string("selfcheck"); | ||
case 2: return std::string("normal"); | ||
case 3: return std::string("alarm"); | ||
case 4: return std::string("fault"); | ||
default: return std::string("----"); | ||
} | ||
return x; | ||
|
||
sensor: | ||
- platform: modbus_controller | ||
|
@@ -44,8 +23,8 @@ sensor: | |
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
name: "${entities_name_prefix}-Status - Warning3" | ||
id: "${entities_id_prefix}_Status_Warning3" | ||
name: "${entities_name_prefix}-Status - Error1" | ||
KastB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id: "${entities_id_prefix}_Status_Error1" | ||
register_type: holding | ||
address: 555 | ||
accuracy_decimals: 0 | ||
|
@@ -54,8 +33,8 @@ sensor: | |
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
name: "${entities_name_prefix}-Status - Error1" | ||
id: "${entities_id_prefix}_Status_Error1" | ||
name: "${entities_name_prefix}-Status - Error2" | ||
id: "${entities_id_prefix}_Status_Error2" | ||
KastB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
register_type: holding | ||
address: 556 | ||
accuracy_decimals: 0 | ||
|
@@ -64,8 +43,8 @@ sensor: | |
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
name: "${entities_name_prefix}-Status - Error2" | ||
id: "${entities_id_prefix}_Status_Error2" | ||
name: "${entities_name_prefix}-Status - Error3" | ||
id: "${entities_id_prefix}_Status_Error3" | ||
KastB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
register_type: holding | ||
address: 557 | ||
accuracy_decimals: 0 | ||
|
@@ -74,13 +53,14 @@ sensor: | |
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
name: "${entities_name_prefix}-Status - Error3" | ||
id: "${entities_id_prefix}_Status_Error3" | ||
name: "${entities_name_prefix}-Status - Error4" | ||
id: "${entities_id_prefix}_Status_Error4" | ||
KastB marked this conversation as resolved.
Show resolved
Hide resolved
|
||
register_type: holding | ||
address: 558 | ||
accuracy_decimals: 0 | ||
value_type: U_WORD | ||
|
||
|
||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
name: "${entities_name_prefix}-Status - Failure Status of Communication Board" | ||
|
@@ -89,3 +69,80 @@ sensor: | |
address: 548 | ||
accuracy_decimals: 0 | ||
value_type: U_WORD | ||
|
||
|
||
text_sensor: | ||
- platform: modbus_controller | ||
modbus_controller_id: ${modbus_controller_id} | ||
skip_updates: 2 | ||
bitmask: 0 | ||
register_type: holding | ||
address: 500 | ||
raw_encode: HEXBYTES | ||
id: "${entities_id_prefix}_Status_Running_Status" | ||
name: "${entities_name_prefix}-Status - Running Status" | ||
lambda: |- | ||
uint16_t value = modbus_controller::word_from_hex_str(x, 0); | ||
switch (value) { | ||
case 0: return std::string("standby"); | ||
case 1: return std::string("selfcheck"); | ||
case 2: return std::string("normal"); | ||
case 3: return std::string("alarm"); | ||
case 4: return std::string("fault"); | ||
default: return std::string("----"); | ||
} | ||
return x; | ||
|
||
#new / untested | ||
- platform: template | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks very interesting 👍 (but I cannot really evaluate the Logic of the Code without diving into it in Detail & troubleshooting with the Deye Inverter). |
||
name: "${entities_name_prefix}-Status - Inverter Faults" | ||
lambda: |- | ||
static const std::map<int, std::string> faults = { | ||
{7, "DC/DC Soft Start Fault"}, | ||
{10, "Auxiliary Power Supply Failure"}, | ||
{13, "Working Mode Change"}, | ||
{18, "AC Over Current"}, | ||
{20, "DC Over Current"}, | ||
{22, "Emergency Stop Fault"}, | ||
{23, "AC Leakage Current or Transient Over Current"}, | ||
{24, "DC Insulation Impedance Failure"}, | ||
{26, "DC Busbar Imbalanced"}, | ||
{29, "Parallel Communication Fault"}, | ||
{35, "No AC Grid"}, | ||
{41, "Parallel System Stop"}, | ||
{42, "AC Line Low Voltage"}, | ||
{46, "Backup Battery Fault"}, | ||
{47, "AC Over Frequency"}, | ||
{48, "AC Lower Frequency"}, | ||
{49, "Backup Battery Fault"}, | ||
{56, "DC Busbar Voltage Low"}, | ||
{58, "BMS Communication Fault"}, | ||
{63, "ARC Fault"}, | ||
{64, "Heat Sink Temperature Failure"}, | ||
}; | ||
|
||
std::vector<std::string> errors; | ||
uint16_t registers[4] = {id(${entities_id_prefix}_Status_Error1).state, id(${entities_id_prefix}_Status_Error1).state, id(${entities_id_prefix}_Status_Error3).state, id(${entities_id_prefix}_Status_Error4).state}; | ||
int offset = 0; | ||
|
||
for (int i = 0; i < 4; i++) { | ||
for (int bit = 0; bit < 16; bit++) { | ||
if (registers[i] & (1 << bit)) { | ||
int fault_code = offset + bit + 1; | ||
if (faults.count(fault_code)) { | ||
errors.push_back("F" + std::to_string(fault_code) + " " + faults.at(fault_code)); | ||
} else { | ||
errors.push_back("F" + std::to_string(fault_code)); | ||
} | ||
} | ||
} | ||
offset += 16; | ||
} | ||
std::string result; | ||
for (size_t i = 0; i < errors.size(); i++) { | ||
if (i > 0) result += ", "; | ||
result += errors[i]; | ||
} | ||
|
||
return errors.empty() ? "No Faults" : result; | ||
update_interval: 10s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove all of these Sensors after you Added them a few Commit earlier ?