subtract_entities
doesn't appear to correctly handle missing historical data. #191
Description
Hi MindFreeze,
Not 100% sure if this should actually be a feature request rather than a bug report.
I'm using the sankey chart subtract_entities
to separate out power delivered by some utility meter trackers. e.g.
- type: entity
name: Grid import
entity_id: sensor.my_grid_import
children:
- sensor.battery
- total
subtract_entities:
- sensor.offpeak_import
This all works great for current data.
For historic data; I've had sensor.my_grid_import
for years, but only been tracking sensor.offpeak_import
for a few weeks.
When i change the date range back before sensor.offpeak_import
existed, what i would expect to happen is the sensor.my_grid_import
shows in the sankey chart in full.
What actually happens in the sensor.my_grid_import
is treated as if its 0 (it reappears if i remove the subtract_entities
)
My guess would be something in the math is unhappy its getting an energy reading back from HA of null/unknown or something of that variety, and just 0ing out the whole line.
Anyway, if its not to hard to fix, it'd be great to have better support for historic data when using the subtract_entities
Cheers,
Carl
Checklist:
- I updated to the latest version available
- I cleared the cache of my browser
Release with the issue:
3.0.0 (Issue was present in previous versions too)
Last working release (if known):
I'm not aware this has ever been supported.
Browser and Operating System:
Issuer occurs in all browsers. Checked in Chrome (124.0.6367.119), Edge and firefox just for completeness. All done on Windows.
Description of problem:
When using the sankey chart linked to the energy dashboard date picker, subtract_entities
has unexpected behaviour when being asked to subtract a value that does not exist for a given date.
The result is that the entity being subtracted from appears to be treated as 0.
- type: entity
name: Grid import
entity_id: sensor.my_grid_import
children:
- sensor.battery
- total
subtract_entities:
- sensor.offpeak_import
The expected result in my view is the subtracting entity sensor.offpeak_import
should be treated as 0 in this case, and thus not effect the main entity sensor.my_grid_import
's value.
Javascript errors shown in the web inspector (if applicable):
No JS errors.
Additional information: