Install
openclaw skills install grid-aware-energy-load-shifterGrid-aware energy load shifter for Home Assistant. Reads real-time electricity prices (TOU, time-of-use, dynamic pricing), solar production forecasts, batter...
openclaw skills install grid-aware-energy-load-shifterShift heavy residential loads to the cheapest electricity hours using Home Assistant energy data.
# Find all energy-related entities in HA
python3 {baseDir}/scripts/ha_bridge.py discover
# Get a full energy dashboard snapshot (prices, solar, consumption, batteries)
python3 {baseDir}/scripts/ha_bridge.py energy-summary
# Turn on the EV charger
python3 {baseDir}/scripts/ha_bridge.py call-service switch/turn_on --entity-id switch.ev_charger
Two paths to reach Home Assistant:
mcporter call homeassistant.<tool> directly.python3 {baseDir}/scripts/ha_bridge.py. Requires HA_URL and HA_TOKEN environment variables.Required credentials:
| Variable | Description |
|---|---|
HA_URL | Home Assistant base URL (e.g. http://homeassistant.local:8123) |
HA_TOKEN | Home Assistant Long-Lived Access Token |
Least-privilege recommendations:
openclaw-energy)discover, energy-summary) before enabling device controlDomain allowlist: The call-service command restricts actions to energy-related domains only: switch, automation, script, climate, water_heater, input_boolean, input_number, number. All other domains (e.g. lock, alarm_control_panel) are blocked with exit code 2.
| Command | What it does | Example |
|---|---|---|
discover | List all energy entities | ha_bridge.py discover |
energy-summary | One-shot dashboard (prices + consumption + solar + storage) | ha_bridge.py energy-summary |
status <entity> | Read a single entity's state and attributes | ha_bridge.py status sensor.electricity_price |
call-service <d/s> | Call an energy-related HA service (restricted to allowed domains) | ha_bridge.py call-service switch/turn_on --entity-id switch.ev_charger |
history <entity> | Get state changes over last N hours | ha_bridge.py history sensor.grid_import --hours 24 |
All commands output JSON to stdout.
Follow these steps when asked about energy optimization:
discover or energy-summarytoday / tomorrow / prices_today / rates attributesprice_level attribute (CHEAP / NORMAL / EXPENSIVE)switch.* entities for schedulable devices (EV charger, pool pump, dishwasher, washer/dryer, water heater)switch/turn_on at the optimal time, or automation/trigger if the user has an existing automationDifferent integrations expose prices differently:
today/tomorrow attributes → find cheapest hoursprice_level → act when CHEAP or VERY_CHEAPsensor.*_peak vs sensor.*_offpeak → user's HA automations switch tariffs at configured timescurrent_price attribute → compare against historical averageWhen recommending a shift, show estimated savings:
savings = (current_rate - cheapest_rate) × device_power_kw × run_duration_hours
If solar sensors exist, align loads with peak production:
sensor.forecast_solar_* or sensor.solcast_* for today's forecastHVAC is the largest residential load (40-50% of electricity). Pre-cool or pre-heat during cheap/solar hours so the home coasts through expensive peak periods:
climate.* entities for current HVAC mode and setpointElectric water heaters (4.5 kW typical) are ideal deferrable loads:
switch.water_heater or water_heater.* entitiesIf home battery entities exist (sensor.battery_soc, sensor.powerwall_*, sensor.enphase_*):
For homes enrolled in utility demand response or virtual power plant programs:
For detailed entity patterns across providers, read: energy_entities.md