Switching by ComEd kWh supply cost?

Been struggling with this for months.

I have this installed. It gives me the ComEd info. But I cannot, for the life of me, figure out how to make it turn off an appliance switch (Sonoff S31 Tazzed) when the price goes above a certain amount and turn it back on when it goes below that amount. Any help would be dearly appreciated.

What are the entities involved and what are your trigger prices?

666

just trying to get it to flip a switch on when over 7 cents and off when under.

Alright, so you can’t answer my question. I will assume your sensor is, say, sensor.comed_price and the switch you want to control is switch.controlled

Your automation will look like this:

trigger:
   - platform: numeric_state  
      entity_id:
         sensor.comed_price
         below: 0.07
action:
   - service: switch.turn_off
     target:
       entity_id: switch.controlled

Trying to answer…
I was thinking that the price was in cents format, so should be a whole number ‘7’, is that not the case ?
Changed it to your suggestion and we will see…

I can’t answer that as I don’t have access to your machine, but look at dev-tools/states.

Resolved: Had to change the Automation ‘Mode’ to ‘Restart’ from ‘Single’ and yes, it is measured in Whole cents, so ‘7’ is seven cents.

Hi, I’m having a similar issue and changing to “mode: restart” and whole cents didn’t help me. Any chance you know why? Or could share your YAML?

Has anyone figured out a working trigger for this integration? I was able to load it and can get the data onto a dashboard card, and it clearly has data if you open up the entity itself. However, I can not figure out how to get an automation to trigger using this data. Does anyone have a working example of an automation?

I tried using both states and numeric_state, and neither of them will ever trigger to fire an action. I have noticed that all the data appears with a “c”. So the data points are “5.5 c”, “4.7 c”, “5.1 c” etc. Does this “c” interfere with the ability to do a trigger if the price is above or below a certain price? Sort of like comparing numbers to a text string?

I just wanted post an update on the resolution. The integration does work. Follow the integration instructions and restart HA.

For trigger logic, you must use numeric_state and fill out both the above and below values. For example, if you want to do something if the price is above 20 cents, then you need to set your trigger for above 20 and below (a really large number) like 100,000. From my testing, there is a bug where if you only fill out above or below but not both, the trigger will never fire. Here is a sample yaml automation that works. Hopefully this helps someone.

 alias: ComEd - Price Above 10 Cents
description: >-
  Enter full self power mode when price is over 10 cents. Disable grid charging.
  Change battery reserve to 50% so there is battery space to discharge. 
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.comed_5_minute_price
    above: 10
    below: 100000000000000
condition: []
action:
  - device_id: xxxxxxxx
    domain: select
    entity_id: xxxxxx
    type: select_option
    option: Self-Powered  (Change powerwall to self powered, house is powered by powerwall and not grid) 
  - device_id: xxxxx
    domain: select
    entity_id: xxxxx
    type: select_option
    option: "No"   (Change grid charging to "no", so when we resume grid operation at 9 cents, the powerwalls don't charge immediately at 9 cents).   There is a separate HA at 1am to grid charge, usually around 0-3 cents.
  - device_id: xxxxxx
    domain: number
    entity_id: xxxxxxxx
    type: set_value
    value: 50   (Change powerwall backup reserve to 50, so 50% of the battery is available for home discharge right now, and 50% will be held for emergency backup.) 
  - service: notify.xxxxx
    data:
      message: >-
        The Tesla Powerwalls are now in Self Power mode, and you have been
        disconnected from the grid.
      title: ComEd Prices are Trending High!
mode: single