Closed Pho3niX90 closed 3 months ago
Suggest the following changes but you will need to test.
to
let gridVoltage = !stateGridVoltage.isNaN() ? stateGridVoltage.toNum(0) : null;
let batteryCurrentDirection = !stateBatteryCurrentDirection.isNaN() ? stateBatteryCurrentDirection.toNum(0) : null;
and
to
if (batteryCurrentDirection != null) {
if (inverterModel == InverterModel.Solis && batteryCurrentDirection === 0) {
batteryPower = -batteryPower;
}
}
so the issue is actually related to the isNaN function in the custom card, and the logical or (||), when it's false, it uses the right hand operator which is true. So changing this to the null coalescing fixes it, but introduces an issue regarding the toString on the inverterStatus
Is there an existing issue for this?
Current Behavior
Currently in the latest version the battery direction seems broken. It uses both the battery power and direction sensor since the power alone is unsigned.
I am out most of the day, so this is just a reminder.
Steps To Reproduce
N/A
Expected behaviour
Should use both sensors for direction.
Card Version
4.24.4
Home Assistant Version
2024.3.2
Configuration
Relevant log output