[BUG] Reports a negative entity in an individual device as positive
Opened this issue · 2 comments
To Reproduce
Steps to reproduce the behavior:
- Set up an individual device that tracks a sensor that can report a negative value
- Check the power flow card when it should be negative. It is positive.
Expected behavior
I would like the number reported as negative
Screenshots
Attached showing the entity and the card.
Desktop (please complete the following information):
- iOS 18, Chrome, Safari
Smartphone (please complete the following information):
- Any device
Please make sure all of this applies and check the checkboxes, by writing "X" inside of them.
-
[ X I understand that this is a channel for reporting bugs, not a support forum (If you need help configuring the card, go to: Discussions).
-
I have the latest version of the card installed.
-
I have cleared my browser cache after installing, updating and configuring the card.
-
The issue is not related to the UI-Editor not being rendered: "s.entries is not a function". This is a known bug, and is caused by Card Mod. Check the warning this readme section for more information on how to fix it.
Seeing a similar issue with a secondary battery that I've added as an individual device. Regardless of whether the battery is charging or discharging, it shows the same direction:
The I/O alpha
value on the right is the raw sensor value, and the purple device labelled alpha
is the corresponding representation. It has been set to "Invert Animation".
So the bidirectional feature was added before v0.2.0 and it looks like the issue was introduced during the refactor?
The InvidualObject
has a property called isStateNegative
defined at
This is set based on the value retrieved by getIndividualState()
at
But getIndividualState()
returns the absolute value and so will never be negative
That's the cause, but I'm not sure if it's safe to simply return the original value since it may have an unintended consequence elsewhere if that value is negative.