A custom Home Assistant integration to track real-time energy costs with time-of-use and seasonal pricing support for Consumers Energy customers (and others with similar rate structures).
- Sensor Aggregation: Combine multiple power sensors (watts) into total power monitoring
- Energy Calculation: Accurate kWh calculation using trapezoidal integration
- Time-of-Use Pricing: Automatic rate switching based on time of day
- Seasonal Pricing: Different rates for summer (Jun-Sep) and winter (Oct-May) periods
- Real-time Cost Tracking: See your current cost per hour
- Period Accumulators: Track energy and costs for today, this week, this month, and this year
- Preset Rate Plans: Three Consumers Energy rate plan templates included
- Custom Rate Configuration: Configure your own rate structure
- Energy Dashboard Integration: Full compatibility with Home Assistant's Energy Dashboard
- Summer (June-September):
- On-Peak: $0.23/kWh (weekdays 2-7pm)
- Off-Peak: $0.178/kWh (all other times)
- Winter (October-May): Flat rate $0.164/kWh
- Peak pricing weekdays 2-7pm year-round
- Off-peak all other times
- Requires manual rate entry (only differentials published by Consumers Energy)
- Summer:
- Super Off-Peak: $0.133/kWh (12am-6am, 11pm-12am)
- Off-Peak: $0.173/kWh (6am-2pm, 7pm-11pm)
- On-Peak: $0.212/kWh (2pm-7pm)
- Winter:
- Super Off-Peak: $0.141/kWh (12am-6am, 11pm-12am)
- Off-Peak: $0.168/kWh (6am-2pm, 7pm-11pm)
- On-Peak: $0.169/kWh (2pm-7pm)
- Weekends: All super off-peak pricing
- Copy the
custom_components/consumers_energy_costfolder to your Home Assistantconfig/custom_components/directory - Restart Home Assistant
- Go to Settings > Devices & Services > Add Integration
- Search for "Consumers Energy Cost Tracker"
- Open HACS in Home Assistant
- Go to Integrations
- Click the three dots menu and select "Custom repositories"
- Add this repository URL with category "Integration"
- Click "Install" on the Consumers Energy Cost Tracker card
- Restart Home Assistant
- Go to Settings > Devices & Services > Add Integration
- Search for "Consumers Energy Cost Tracker"
- Select all power sensors you want to monitor
- These should be sensors with
device_class: powerand units in watts (W) - Examples: Smart plugs, individual circuit monitors, whole-home energy monitors
- These should be sensors with
Choose whether to use a preset rate plan or configure custom rates.
Select your Consumers Energy rate plan from the dropdown:
- Summer Time-of-Use (Rate 1001) - Most common residential plan
- Smart Hours (Rate 1040) - Advanced TOU plan
- Nighttime Savers (Rate 1050) - Three-tier overnight discount plan
Enter your own rates:
- Summer Peak Rate (Jun-Sep, weekdays 2-7pm)
- Summer Off-Peak Rate (all other summer times)
- Winter Rate (Oct-May, flat rate)
The integration will create 12 sensors:
Power & Rate Sensors:
sensor.consumers_energy_total_power- Current total power (W)sensor.consumers_energy_current_rate- Current electricity rate ($/kWh)sensor.consumers_energy_cost_rate- Current cost rate ($/hour)sensor.consumers_energy_rate_period- Current rate period (e.g., "Summer On-Peak")
Daily Tracking:
sensor.consumers_energy_energy_today- Energy consumed today (kWh)sensor.consumers_energy_cost_today- Cost today ($)
Weekly Tracking:
sensor.consumers_energy_energy_week- Energy this week (kWh)sensor.consumers_energy_cost_week- Cost this week ($)
Monthly Tracking:
sensor.consumers_energy_energy_month- Energy this month (kWh)sensor.consumers_energy_cost_month- Cost this month ($)
Yearly Tracking:
sensor.consumers_energy_energy_year- Energy this year (kWh)sensor.consumers_energy_cost_year- Cost this year ($)
type: entities
title: Energy Cost Tracker
entities:
- entity: sensor.consumers_energy_total_power
name: Current Power
- entity: sensor.consumers_energy_current_rate
name: Current Rate
- entity: sensor.consumers_energy_cost_rate
name: Cost Per Hour
- entity: sensor.consumers_energy_rate_period
name: Rate Period
- type: divider
- entity: sensor.consumers_energy_cost_today
name: Cost Today
- entity: sensor.consumers_energy_cost_week
name: Cost This Week
- entity: sensor.consumers_energy_cost_month
name: Cost This MonthInstall the ApexCharts card via HACS, then add:
type: custom:apexcharts-card
header:
show: true
title: Power Usage & Cost Today
show_states: true
graph_span: 24h
span:
start: day
series:
- entity: sensor.consumers_energy_total_power
name: Power
stroke_width: 2
type: line
yaxis_id: power
color: '#2196F3'
- entity: sensor.consumers_energy_cost_today
name: Cost Today
stroke_width: 2
type: line
yaxis_id: cost
color: '#4CAF50'
yaxis:
- id: power
opposite: false
decimals: 0
apex_config:
title:
text: Power (W)
- id: cost
opposite: true
decimals: 2
apex_config:
title:
text: Cost ($)type: custom:apexcharts-card
header:
show: true
title: Electricity Rate Periods
graph_span: 24h
span:
start: day
series:
- entity: sensor.consumers_energy_current_rate
name: Rate
stroke_width: 3
type: line
color: '#FF9800'
yaxis:
- decimals: 3
apex_config:
title:
text: Rate ($/kWh)type: gauge
entity: sensor.consumers_energy_total_power
name: Current Power Usage
unit: W
min: 0
max: 5000
needle: true
segments:
- from: 0
color: '#4CAF50'
- from: 1500
color: '#FF9800'
- from: 3000
color: '#F44336'type: statistic
entity: sensor.consumers_energy_cost_month
period:
calendar:
period: month
stat_type: change
name: Monthly Cost TrendThe integration automatically integrates with Home Assistant's Energy Dashboard:
- Go to Settings > Dashboards > Energy
- Click "Add Consumption"
- Select
sensor.consumers_energy_energy_todayor any of the energy sensors - The cost sensors will automatically be associated with their energy counterparts
The integration uses trapezoidal integration for accurate energy calculation:
energy_kwh = ((previous_power_w + current_power_w) / 2) * time_hours / 1000
This method accounts for power variations between readings, providing higher accuracy than assuming constant power.
Sensors update every 30 seconds by default. This provides:
- Real-time responsiveness in the UI
- Accurate cost tracking during rate transitions
- Smooth graphs and visualizations
Accumulators automatically reset at period boundaries:
- Daily: Midnight local time
- Weekly: Monday 00:00:00 local time
- Monthly: 1st of month 00:00:00 local time
- Yearly: January 1st 00:00:00 local time
- Short-term data stored in coordinator state (survives updates)
- Long-term data stored in Home Assistant database (survives restarts)
- Period accumulators reset at boundaries but maintain running totals
- Check that your power sensors are reporting valid numeric values
- Verify sensor entity IDs are correct in integration config
- Check Home Assistant logs for errors: Settings > System > Logs
- Verify your rate plan is correct for your utility account
- Check that rate period changes at expected times (use Rate Period sensor)
- Compare daily totals with your utility's online usage data
- Ensure power sensors are measuring the circuits you expect
- Period accumulators only track data while Home Assistant is running
- If HA was offline, energy during that time won't be counted
- Consider using the Energy Dashboard for long-term statistics (doesn't reset)
- Ensure energy sensors have correct
device_class: energyandstate_class: total - Wait a few hours for data to accumulate
- Check that sensors are actually updating (watch for state changes)
To update rates without losing historical data:
- Go to Settings > Devices & Services
- Find "Consumers Energy Cost Tracker"
- Click "Configure"
- Update power sensors (this won't affect rate configuration)
To change rate plans:
- Remove the integration
- Re-add with new rate configuration
- Historical data will be lost, but new tracking begins immediately
You can install the integration multiple times to track different rate scenarios:
- Use different power sensor sets for each instance
- Compare costs across different rate plans
- Track specific circuits separately from whole-home
For issues, feature requests, or questions:
- GitHub Issues: Report a bug or request a feature
Developed for Consumers Energy customers and Home Assistant enthusiasts who want accurate, real-time energy cost tracking.
This integration is provided as-is for personal use. Consumers Energy rate data is sourced from public rate schedules and may change. Always verify rates with your utility.
Disclaimer: This is an unofficial integration and is not affiliated with or endorsed by Consumers Energy. Rate information is provided for convenience and may not reflect current rates. Always verify costs with your utility bill.