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.