If you find this project useful, you can support me on Ko-fi 💙
A simple Lovelace custom card that shows a horizontally scrollable hourly price graph (bar chart) for a selected electricity price sensor, and can suggest/highlight the cheapest contiguous hours for your own “sections” (for example Dishwasher 3 hours).
The card is designed to be loaded as a standard Home Assistant JavaScript resource (no ESM imports).
- Hourly price graph as color-coded bars (low/mid/high) based on price tiers.
- Min / Now / Max shown above the graph.
- “Now” marker (vertical line + label) at the nearest hour.
- Tooltip on hover (shows time range + value + unit).
- Multi-day support:
- Typically combines today + tomorrow if the sensor provides both.
- Shows a date label at midnight and a separator line.
- “Cheapest times” sections:
- Create your own sections with a name and a duration (hours).
- The card finds the cheapest contiguous window (from “now” and forward) for each section.
- Click a section to highlight its cheapest window on the chart.
- Settings modal inside the card to add/remove sections.
- Stores sections per entity in browser localStorage (fast and without extra HA helpers).
- Editor with entity picker (pick sensor) + optional title.
If you have HACS installed, you can add this card directly from GitHub as a custom repository:
Tip: use the “My Home Assistant” button at the top of this README.
- Open HACS in Home Assistant.
- Click the three dots (top right) → Custom repositories.
- Paste the GitHub repository URL.
- Select Category: Plugin (Lovelace / Dashboard).
- Click Add.
- Find the newly added repository in HACS and click Download.
After downloading, add the card as a Lovelace resource:
- Settings → Dashboards → Resources
- Add:
- URL:
/hacsfiles/energy-graph-scheduler-card/energy-graph-scheduler-card.js - Type:
JavaScript ModuleorJavaScript
- URL:
Then refresh your browser.
- Place the file here in your HA config:
www/energy-graph-scheduler-card.js
- Add it as a resource in Home Assistant:
UI (recommended)
- Settings → Dashboards → Resources
- Add:
- URL:
/local/energy-graph-scheduler-card.js - Type:
JavaScript ModuleorJavaScript(depends on your HA version). The card is intended to work as a plainjavascriptresource.
- URL:
- Reload (refresh) your browser.
Minimal example:
type: custom:energy-graph-scheduler-card
entity: sensor.your_electricity_price_sensorWith a title:
type: custom:energy-graph-scheduler-card
title: Electricity price
entity: sensor.your_electricity_price_sensor- Open the card and click Settings.
- Under Add time section:
- Enter a name (e.g.
Dishwasher) - Choose
Duration(1–24 hours) - Click Add
- Enter a name (e.g.
- The card will now show a “Cheapest times” area with suggestions.
- Click a section to highlight its cheapest time window on the chart.
- Sections are stored in browser localStorage under a per-entity key.
- This usually means:
- Sections are per device/browser, not automatically shared between phone/PC.
- Clearing browser data may remove your sections.
The card tries to be robust across different electricity price integrations.
It looks for an array/list in the entity attributes under common keys such as:
raw_today,today,prices,price,data,values- and (if available)
raw_tomorrowortomorrow
Each item in the list can be:
- a number (price), or
- an object with a value in one of these keys:
value,price,val,v,amount,y
Timestamps are attempted from keys such as:
hour,start,start_time,startTime,from,time,date,datetime,begin,t
If no timestamps exist, the data is treated as sequential hourly values.
The unit is displayed from unit_of_measurement (or unit).
- “Cheapest times” is computed from now and forward (not historical hours).
- If some datapoints are missing (null/non-numeric), certain windows cannot be calculated.
- Sections are not synchronized via Home Assistant (localStorage only).
By default, sections are stored in browser localStorage (per device/browser).
If you want the card to share/sync your sections across devices and users in the same Home Assistant instance, install the companion sync integration:
After installing the sync integration, enable Sync in the card editor.
- Open your browser Developer Tools → Console, and look for:
ENERGY-GRAPH-SCHEDULER-CARD ...
- If the card doesn’t show up:
- Verify the resource URL is correct:
/local/energy-graph-scheduler-card.js - Hard refresh (Ctrl+F5) after updating the file.
- Verify the resource URL is correct:
The version is logged in the console and is defined in the code as EGS_CARD_VERSION.