frontend
frontend copied to clipboard
Enable Statistics Graph card to integrate with Energy Dashboard
Proposed change
Adds boolean option energy_date_selection
to Statistics Graph card. If
true, the graph will set its time range to that specified by an Energy
Date Picker card on the same dashboard, similar to the plots on the
Energy Dashboard. Otherwise, days_to_show
will be used as before.
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (thank you!)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
Example configuration
- type: custom:energy-period-selector-plus
card_background: false
today_button: true
prev_next_buttons: true
compare_button_type: ''
today_button_type: text
period_buttons:
- day
- week
- month
- year
- custom
default_period: day
rolling_periods: true
- type: statistics-graph
chart_type: bar
period: hour
entities:
- sensor.main_123_1d
stat_types:
- change
days_to_show: 1
title: Statistics - Hourly
hide_legend: true
energy_date_selection: true
Additional information
-
This PR fixes or closes issue: N/A
-
This PR is related to issue or discussion:
- #20167
- #20876
- https://community.home-assistant.io/t/statistics-graph-card-following-energy-date-selection-card/357341
- https://community.home-assistant.io/t/link-date-picker-and-stat-graph/421378
- https://community.home-assistant.io/t/platform-statistics-selectable-period/602257
-
Link to documentation pull request:
Checklist
- [x] The code change is tested and works locally.
- [x] There is no commented out code in this PR.
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for www.home-assistant.io
Summary by CodeRabbit
-
New Features
- Enhanced the statistics graph card to support energy data handling and dynamic date selection.
- Added a new "energy_date_selection" option in the card configuration.
-
Bug Fixes
- Improved method signatures for better data handling within statistics graph cards.
-
Documentation
- Updated translation files to include new terms related to energy date selection.