Nordpool price cheap/expensive actions

This blueprint allows you to define the X cheapest hours of the day, and make actions based on this.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

blueprint:
    name: Nordpool price cheap expensive
    description: This blueprints uses the nordpool integration and lets you choose howe many hours you wil define as expesive, and make automations based on that information.
    domain: automation
    input: 
        grid_area:
            name: Grid area sensor
            description: This is your grid area sensor
            selector:
                entity:
                    domain: sensor
                    integration: nordpool
        expensive_hours:
          name: Expensive hours
          description: numbers of Expensive hours
          default: 12
          selector:
            number:
              min: 0.0
              max: 24
              mode: slider
              step: 1.0
        expensive:
          name: Expensive
          description: Action to run on expensive
          default: []
          selector:
            action: {}
        cheap:
          name: Cheap
          description: Action to run on cheap
          default: []
          selector:
            action: {}
variables:
  grid_area_var: !input 'grid_area'
  expensive_hours_var: !input 'expensive_hours'

trigger:
  - platform: state
    entity_id: !input 'grid_area'

action:
    - choose:
      - conditions:
          - condition: template
            value_template: >-
                {{ (state_attr(grid_area_var,'today')|sort)[24 - expensive_hours_var |int] > states(grid_area_var)|float }}
        sequence: !input 'cheap'
      - conditions:
          - condition: template
            value_template: >-
                {{ (state_attr(grid_area_var,'today')|sort)[24 - expensive_hours_var |int] < states(grid_area_var)|float }}
        sequence: !input 'expensive'
      default: []
6 Likes

Thanks for sharing this Blueprint. I am going to try and use this to optimally charge my Solar battery from the grid when electricity is cheap. I do believe there is some potential for improvment though, like defining a certain threshold on what “Cheap” actually is. So, essentially, instead of defining a fixed number of cheap hours, make sure the “Cheap” ones are actually xx% below the average or something like that? I hope that makes sense…

So my Automation based on this blueprint is running for the first time and I can already say it isn’t working as expected for me. It’s charging the battery now, at 23ct/kWh and the price is going to drop to 14ct/kWh within the next 2 hours so… back to the drawing board for me.

is this working from now-> rest of the day

or is it 00.00 to the next 00.00 ?

it seems like it trigger every hour. (setting is set to 3 hours.)

image

1 Like

This will sort out the x most expensive hours of the day. If you set the limit to 18, it will sort out the 6 cheapest hours. That is, events start at the sixth hour, even if 5 hours is cheaper.

2 Likes

The problem with using a percentage, as I see it, is that when the price is flat throughout the day, the automation will not run, since that price will never go below the percentage limit.
If, on the other hand, the price is very high in some hours, all the other hours will be below the percentage limit.

I have considered a solution where it is possible to choose a fixed price that will trump cheap. For example, if the price is under NOK 1, everything is cheap.

2 Likes

I also dont see it working?

Only start and stop manually

Is it possible to edit the blueprint so that you can add default atomizations so you don’t have to have both a blueprint and an automation for example.

alias: ohmonwifi Nordpool price cheap expensive
description: ""
use_blueprint:
  path: anhelgesen/Nordpool_price.yaml
  input:
    grid_area: sensor.nordpool_kwh_se3_sek_3_10_025
    expensive_hours: 6
    cheap:
      - service: automation.turn_on
        data: {}
        target:
          entity_id: automation.ohmonhass
      - service: number.set_value
        entity_id: number.ohmonwifihass_temperature
        data_template:
          value: "{{ states('sensor.gw2000a_outdoor_temperature') | float }}"
    expensive:
      - device_id: 9bfa8d157eea050e50a7da0aa8ad6fa1
        domain: number
        entity_id: 828e5035a0ad33bcf30c29023d332faa
        type: set_value
        value: 20
      - service: automation.turn_off
        data:
          stop_actions: true
        target:
          entity_id: automation.ohmonhass

For example, if you add these inputs but unfortunately cannot solve it in the automation.

  input:
    grid_area:
      name: Grid area sensor
      description: This is your grid area sensor
      selector:
        entity:
          domain:
            - sensor
          integration: nordpool
          multiple: false
    expensive_hours:
      name: Expensive hours
      description: numbers of Expensive hours to block
      default: 4
      selector:
        number:
          min: 0.0
          max: 24.0
          mode: slider
          step: 1.0
    temperature_sensor:
      name: Temperature sensor
      description: here you select your real outside temperature sensor
      selector:
        entity:
          domain:
            - sensor
          device_class:
            - temperature
          multiple: false
    controll_sensor:
      name: Controllable sensor
      description: your controllable sensor
      selector:
        entity:
          domain:
            - number
          integration: mqtt
          multiple: false
    virtual_temperature:
      name: Virtual block temp
      description: your selected virtual temperature to block your heater
      default: 18
      selector:
        number:
          min: 0.0
          max: 30
          mode: slider
          step: 1.0
          unit_of_measurement: °C

Does this trigger expensive once per hour and cheap once per hour? For example 16 times expensive and 8 times cheap/day?

What if cheapest hours are from 22:00-06:00?

For dere som er norske, sjekk ut min tilnærming til denne problemstillingen:

1 Like