Automation to set the export limit of a Solaredge solar inverter based on price

Hi,

I am new to Home Assistant, coding and YAML so have a lot to learn about the syntax - apologies if this is a simple oversight.

I’ve got a SolarEdge solar inverter and have connected it to Home Assistant using modbus.

I also have connected to the Amber Energy API (an energy retailer in Australia).

Amber is unique because it provides wholesale prices for your solar. However, this means that sometimes you actually get charged for exporting energy to the grid (the feed-in tariff becomes negative, e.g. -0.08c / kWh exported).

Because of this I want to create an automation that sets the export limit of my solar inverter (in Watts) to match my home’s electricity demand (also in Watts) when the feed-in tariff becomes negative but so far it hasn’t worked. I have managed to set up an automation that does the opposite (sets the entity solaredge_export_control_site_limit to 5000w when the feed-in tariff is positive) but that one is easy because I am inputting a number (5000) rather than taking the value from another sensor.

I am guessing I’ve made an obvious mistake in the YAML code so hoping someone can correct it for me. Here’s what I’ve been trying:

alias: Negative FiT
description: Sets export limit to match home consumption when the FiT is negative
trigger:
  - platform: numeric_state
    entity_id: sensor.amber_feed_in_price
    attribute: per_kwh
    below: 0
condition: []
action:
  - service: number.set_value
    data_template:
      entity_id: number.solaredge_export_control_site_limit
      value_template: "{{ states.number.solar_house_consumption_w.state }}" 

I’m unsure if I should be using “data_template” or just “data” and also “value_template” or just “value”. I’m also unsure about the syntax for getting the value from the solar_house_consumption_w entity.

Grateful for any help on this.

2 Likes

Can’t you set the export limit to 0w? You’ll still consume energy from the solar system.

Hi. You got it working ?

When you set export control, the value you set is actually the amount of exports, so in your case you would want to set this to 0W. In my case I set to 200W to allow my Powerwall notice if there is excess solar to charge the battery.

My automation looks like this:

I also have an automation to set production to 0W if the general price goes negative (which happens a couple of times a year).

alias: Zero Export Automation
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.amber_feed_in_price
    below: 0
  - platform: numeric_state
    entity_id: sensor.amber_feed_in_price
    above: 0
  - platform: numeric_state
    entity_id: sensor.amber_general_price
    above: 0
  - platform: numeric_state
    entity_id: sensor.amber_general_price
    below: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.amber_general_price
            above: 0
          - condition: numeric_state
            entity_id: sensor.amber_feed_in_price
            below: 0
        sequence:
          - device_id: 8e8f45345219e32b8a645ce8dfb767c3
            domain: select
            entity_id: select.solaredge_i1_limit_control_mode
            type: select_option
            option: Export Control (Export/Import Meter)
          - device_id: 8e8f45345219e32b8a645ce8dfb767c3
            domain: number
            entity_id: number.solaredge_i1_site_limit
            type: set_value
            value: 200
      - conditions:
          - condition: numeric_state
            entity_id: sensor.amber_general_price
            below: 0
        sequence:
          - device_id: 8e8f45345219e32b8a645ce8dfb767c3
            domain: select
            entity_id: select.solaredge_i1_limit_control_mode
            type: select_option
            option: Production Control
          - device_id: 8e8f45345219e32b8a645ce8dfb767c3
            domain: number
            entity_id: number.solaredge_i1_site_limit
            type: set_value
            value: 0
    default:
      - device_id: 8e8f45345219e32b8a645ce8dfb767c3
        domain: select
        entity_id: select.solaredge_i1_limit_control_mode
        type: select_option
        option: Disabled
mode: single
2 Likes

Hi Mark,

I’m a HA newbie and am trying to make a similar automation that you made. Only if I select the Solaredge modbus as an action, it remains greyed out. Do I need to configure anything extra with the Solaredge modbus?

Hope you can help me.

Greeting,

Wilmar

I am running the solaredge-modbus-multi integration from HACS, which seems to give more controls:

1 Like