-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
fix: connection_entity_id and add_entities/subtract_entities #199
fix: connection_entity_id and add_entities/subtract_entities #199
Conversation
If a connection_entity_id was specified, it was not added to the list of entities for which to retrieve the state. It seems that connection_entity_id only happened to work if that entity_id was also used elsewhere.
When converting energy units, all the conversions take place in energy.ts, and the results can be directly added together. However, when _getMemoizedState was adding the values of add_entities, it didn't realize that the entities to add were already the correct values, and it erroneously normalized them. Now, the same "this has already been converted" logic used for the main entity state is also used for the add_entity state.
The |
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.
Please explain where the conversion happens because I don't see it. Btw I want to remove this._getUnitOfMeasurement
and move this logic to energy.ts
so the unit and state that come into the chart are coupled. But I can do this refactoring later. For now I just need to understand the problem you found
I agree that The new problem I found is as follows. Assume the following configuration:
We want the bar to evaluate to $60. Instead, this happened:
|
I understand now. The problem is that we don't use What confused me is that you also changed |
Yes, that makes sense |
connection_entity_id
connection_entity_id
was specified, it was not added to the list of entities for which to retrieve the state. It seems thatconnection_entity_id
only happened to work if thatentity_id
was also used elsewhere.add_entities
/subtract_entities
normalization with unit conversionenergy.ts
, and the results can be directly added together. However, when_getMemoizedState
was adding the values ofadd_entities
, it didn't realize that the entities to add were already the correct values, and it erroneously normalized them. Now, the same "this has already been converted" logic used for the main entity state is also used for theadd_entity
state.