EnergyKit
Use grid cleanliness and cost guidance to shift or reduce managed-device load. For managed-device insights, submit the device's real load events promptly.
Beta-sensitive. Core EnergyKit ships in iOS/iPadOS 26. The iOS/iPadOS 27
ElectricalLoadDeviceand Home-facing LoadEvents experience are beta; re-check current Apple documentation before relying on those APIs.
Contents
- Setup
- Core Concepts
- Querying Electricity Guidance
- Working with Guidance Values
- Energy Venues
- Submitting Load Events
- Electricity Insights
- Common Mistakes
- Review Checklist
- References
Setup
Entitlements and Version Split
All EnergyKit use requires com.apple.developer.energykit; enable the EnergyKit
capability on the app target. On iOS/iPadOS 27+, add the EnergyKit LoadEvents
capability (com.apple.developer.energykit.loadevents-experience) only when the
app needs device names, energy context, activity logs, historical charts, or
trend notifications in the Home app. That Home experience requires both
capabilities. Missing permission can surface as EnergyKitError.permissionDenied.
Import
Platform availability: Core EnergyKit APIs are iOS/iPadOS 26.0+. Some
insight breakdown APIs, including grid cleanliness categories, are 26.1+ and
need availability guards. Apple currently documents electricity guidance only
for the contiguous United States; handle EnergyKitError.unsupportedRegion.
Core Concepts
EnergyKit provides two main capabilities:
- Electricity Guidance -- time-weighted forecasts telling apps when electricity is cleaner and, when rate data is available, less expensive
- Load Events -- telemetry from managed devices (EV chargers, HVAC) submitted by the same device/app that requested guidance so EnergyKit can generate insights
Key Types
Suggested Actions
Querying Electricity Guidance
Use ElectricityGuidance.Service to get a forecast stream for a venue.
Working with Guidance Values
Each ElectricityGuidance.Value contains a time interval and a rating
from 0.0 to 1.0. Lower ratings indicate better times to use electricity.
Displaying Guidance in SwiftUI
Energy Venues
An EnergyVenue represents a physical location registered for energy management.
Venue Properties
Submitting Load Events
Report device consumption data back to the system. This helps the system generate electricity insights. The same EnergyKit-capable device/app that requested electricity guidance must submit the corresponding load events, using the guidance token returned by EnergyKit. Do not invent a token.
EV Charger Load Events
HVAC Load Events
Session States
Preserve .begin → .active → .end and submit events promptly rather than
holding long batches. For EV charging, submit .begin with zero power and
energy, .active about every 15 minutes plus significant changes, and .end
with zero power and cumulative energy. Retain unacknowledged events and retry
EnergyKitError.rateLimitExceeded with bounded backoff. Load the
EV session manager [blocked]
or HVAC session manager [blocked]
for device-specific lifecycle handling.
Only promise Home app device names, energy context, activity logs, charts, and trend notifications on iOS/iPadOS 27+ when both the base EnergyKit and EnergyKit LoadEvents capabilities are present.
Electricity Insights
Query historical energy and runtime data for devices using
ElectricityInsightService. An empty ElectricityInsightQuery.Options option
set returns totals only; it does not populate cleanliness or tariff breakdowns.
Request .cleanliness and/or .tariff only when the UI needs those breakdowns.
Do not substitute MetricKit app power metrics for EnergyKit insights; EnergyKit
insights depend on EnergyKit load events submitted for the managed device.
Choose insight granularity from the requested range. For a seven-day view,
query .hourly; use .daily only when the query covers at least a calendar
month.
Use runtimeInsights(forDeviceID:using:atVenue:) for runtime data instead
of energy. Granularity options: .hourly, .daily, .weekly, .monthly,
.yearly. Choose a range that matches Apple's minimum aggregation windows:
hourly for at least a calendar week, daily for at least a calendar month,
weekly for at least six months, and monthly or yearly for at least a calendar
year. See references/energykit-patterns.md [blocked] for full insight examples.
Common Mistakes
Review Checklist
- Base EnergyKit capability is present; iOS/iPadOS 27+ Home integration also has EnergyKit LoadEvents
- Region, permission, venue discovery, unavailable guidance, and service errors are handled
- Real guidance tokens stay with the requesting device/app and its submitted load events
- iOS/iPadOS 27+ uses
ElectricalLoadDevice/device:;deviceID:is isolated to 26.x compatibility -
.begin → .active → .endevents follow device cadence, submit promptly, survive failure, and retry rate limits with bounded backoff - Ratings/actions are interpreted correctly; insight options, availability, granularity, and minimum ranges match the UI
- MetricKit telemetry is not substituted for EnergyKit load events or insights
References
- Extended workflows for app architecture, EV/HVAC session cadence, dashboard presentation, insights, errors, and venue discovery: references/energykit-patterns.md [blocked]
- EnergyKit framework
- ElectricityGuidance
- ElectricityGuidance.Service
- ElectricityGuidance.Query
- ElectricityGuidance.Value
- EnergyVenue
- ElectricalLoadDevice
- ElectricVehicleLoadEvent
- ElectricHVACLoadEvent
- ElectricityInsightService
- ElectricityInsightRecord
- ElectricityInsightQuery
- EnergyKitError
- EnergyKit entitlement
- EnergyKit LoadEvents entitlement
- Providing charging history for electric vehicles
- Optimizing home electricity usage
