Closed Pho3niX90 closed 3 months ago
I'm getting this error
Edit found the problem
@slipx06 should be fixed now, was because toNum()
was called on the state, and since state was of type any
, it didn't throw type safety errors.
I have fixed the state, by changing it to back to string (HassEntity type).
The last update broke battery energy. Its a problem with state_battery_rated_capacity
I think this is good to merge now.
Is there a better way to handle this error. Happens when you set battery_energy: null
That should fix it. The optional chaining operator fixes these issues ?
, it will then only call toString() if the object is not null.
The new CustomEntity interface allows for streamlined handling of state-related tasks and boilerplate code reduction. Additionally, the full battery capacity computation logic is now encapsulated within the
getBatteryCapacity
method. This promotes better organization and clarity throughout the codebase.I added the co-authored tag. Although I "think" I got all the logic, I might not have understood the intent at all of the calculations, so just need another pair of eyes.