Fix gas energy graph units if stats added by external source#11892
Fix gas energy graph units if stats added by external source#11892balloob merged 3 commits intohome-assistant:devfrom pszafer:dev
Conversation
|
I think it's correct to only check the statistic meta data, instead of checking the state first and falling back to statistic meta data: while the unit is allowed to change in the state, the unit in the statistics meta data is locked. Also, |
|
About correct way for filter out entities I can remove this if there is no reason to fetch units from entity itself. |
emontnemery
left a comment
There was a problem hiding this comment.
Looks good to me.
This should be followed up with another PR replacing existing calls to history/list_statistic_ids with recorder/get_statistics_metadata.
Proposed change
By default Energy dashboard get units from entity.
If stats for gas are added by
async_add_external_statisticsthen entity don't exists, so energy dashboard is falling back to m³ units.This PR fixes this issue and get unit from statistic_meta if entity doesn't exists.
Depends on core PR home-assistant/core#68471
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: