Setting up Automation to Control AC when Utility Prices are Low (Comed, Hourly Pricing)

Hi, looking for some assistance with this automation to change the thermostat temp based on hourly pricing.

Using Home Assistant Green, Ecobee thermostat, and ComEd five-minute pricing.

When I test the automations (Run Actions), the automation runs correctly. But it is not running on its own when the five minute price has been under 5 cents for more than the set period of time. This is the current automations.yaml I’m using:

  • id: ‘redacted’
    alias: Pre-cool when ComEd is cheap
    description: ‘’
    triggers:
    • entity_id: sensor.comed_five_minute_price
      below: 5
      for:
      minutes: 10
      trigger: numeric_state
      conditions:
      actions:
    • target:
      entity_id: climate.my_ecobee
      data:
      temperature: 68
      action: climate.set_temperature
    • action: notify.mobile_app_iphone_redacted
      metadata: {}
      data:
      message: ‘"Pre-cooling; price={{ states(’‘sensor.comed_five_minute_price’‘)
      }}"’
      mode: single
  • id: redacted
    alias: Restore temp when ComEd is expensive
    description: ‘’
    triggers:
    • entity_id: sensor.comed_five_minute_price
      above: 10
      for:
      minutes: 10
      trigger: numeric_state
      conditions:
      actions:
    • target:
      entity_id: climate.my_ecobee
      data:
      temperature: 72
      action: climate.set_temperature
    • action: notify.mobile_app_iphone_redacted
      metadata: {}
      data:
      message: ‘"Price is high, restoring temperature; price={{ states(’‘sensor.comed_five_minute_price’‘)
      }}"’
      mode: single

Update. It started working but tends to take a few hours to work again after updating the automation (and restarting yaml or HA).

Numeric State triggers are often misunderstood… there is an article in the Community Cookbook Index that you may find helpful:

Also, please follow Community Questions Guideline #11 by using the “Preformatted text” option on any code or configuration.

1 Like
- id: 'redacted'
  alias: Pre-cool when ComEd is cheap
  description: ''
  triggers:
  - entity_id: sensor.comed_five_minute_price
    below: 5
    for:
      minutes: 10
    trigger: numeric_state
  conditions: []
  actions:
  - target:
      entity_id: climate.my_ecobee
    data:
      temperature: 67
    action: climate.set_temperature
  - action: notify.mobile_app_iphone
    metadata: {}
    data:
      message: '"Pre-cooling; price={{ states(''sensor.comed_five_minute_price'')
        }}"'
  mode: single
- id: redacted
  alias: Restore temp when ComEd is expensive
  description: ''
  triggers:
  - entity_id:
    - sensor.comed_five_minute_price
    above: 10
    for:
      hours: 0
      minutes: 5
      seconds: 0
    trigger: numeric_state
  conditions: []
  actions:
  - target:
      entity_id: climate.my_ecobee
    data:
      temperature: 72
    action: climate.set_temperature
  - action: notify.mobile_app_iphone
    metadata: {}
    data:
      message: '"Price is high, restoring temperature; price={{ states(''sensor.comed_five_minute_price'')
        }}"'

Thanks for confirming the numeric state trigger as the likely cause. I’ll more into that.