Fix for issue 704: Accept negative values on individual devices #829
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: Allow negative values for primary individual entities (fix for issue 704)
This change introduces the
accept_negativeoption for primary individual device configurations.Previously, primary individual entities would always display the absolute power value. With this update:
IndividualDeviceTypenow includes anaccept_negativeboolean property with UI component added to enable this.accept_negative: trueis set in the card configuration for an individual device, the card will now display its actual state, including negative values.accept_negativeis false or not specified (defaulting to false), the card will continue to display the absolute value as before.This aligns the behavior of primary individual entities with secondary info entities regarding the handling of negative values.
Additionally fixed decimal handling to also work for negative values.
TO-DO: Fix logic for display zero not to consider negative numbers as zero.
This change is tested in Local js file in HASS - test results posted on the issue here:
#704