If you have a new account but are having problems posting or verifying your account, please email us on [email protected] for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact [email protected]

Eliminating electricity returned from Energy usage in HA

  • 02-03-2023 4:52pm
    Registered Users Posts: 394 ✭✭


    Is there a way to remove electricity (negative values) from the Energy charts in HA?

    My Setup is as follows:

    1. Solis & Sofar inverters with two strings on each. I created a Sensor in HA to combine both systems such that the Solar Production graphs are accurate
    2. My Grid usage is from a myenergy Harvi CT1 Grid clamp

    I would like to eliminate the negative values, as I do script the kWh cost based on my tariff.

    Is this possible?


  • Registered Users Posts: 1,053 ✭✭✭silver_sky

    You could add the myenergi grid import entity only and leave out the grid export entity.

  • Registered Users Posts: 394 ✭✭jasgrif11

    Thanks, @silver_sky that looks better.

  • Registered Users Posts: 2,109 ✭✭✭SD_DRACULA

    Well you need to set up two different sensors in the different import/export sections of the dashboard settings, the import one under Grid consumption and the export one under Return to Grid

  • Registered Users Posts: 1,406 ✭✭✭Big Lar

    I found this solution the easiest for Peak and Off Peak rates

    If anyone has a suggestion to include the daily standing charge that would make life easy for me as I am not there yet.

  • Registered Users Posts: 2,109 ✭✭✭SD_DRACULA

    Yeah I never bothered with the charges either just added the unit rates and left it at that.

    Post here if you find a clean way to add those in as well.

  • Advertisement
  • Registered Users Posts: 394 ✭✭jasgrif11

    So I scripted my Energia rates and limits


    friendly_name: "Tariff Price"

    unit_of_measurement: EUR/kWh

    value_template: >

    {% if is_state('select.bimonthly_energy', 'peak') %}

    {% if states('sensor.bimonthly_energy_peak')|int < 3000 %}

    {{ 0.4777 }}

    {% elif states('sensor.bimonthly_energy_peak')|int > 3000 %}

    {{ 0.5297 }}

    {% endif %}

    {% elif is_state('select.bimonthly_energy', 'offpeak') %}

    {% if states('sensor.bimonthly_energy_peak')|int < 2000 %}

    {{ 0.1375 }}

    {% elif states('sensor.bimonthly_energy_peak')|int > 2000 %}

    {{ 0.2580 }}

    {% endif %}

    {% endif %}

    Points to note:

    1. I haven't integrated a tariff (minus) for the Solar. I was thinking of adding this just to highlight for myself how much I'm saving by my own generation.
    2. I have peak and off-peak rates for the Grid Input as well as Max units for night-rate of 2000kWh before jump in rate and similar for day rate
    3. Car charge is directly from Zappi
    4. Other appliances all have Shelly devices attached to them (but they all role up to the total Main Electricity Grid Input"
    Post edited by jasgrif11 on

  • Registered Users Posts: 1,406 ✭✭✭Big Lar

    Got the code from here

    It goes into configuration.yaml under templates, edit the date to the date of install, charge will show the following day

    I have unit price as €1033/kWh on the energy dashboard as the code adds 1W per day

  • Registered Users Posts: 2,109 ✭✭✭SD_DRACULA

    Did they bump up the standing charge or rural etc?

    Feb bill.

  • Moderators, Home & Garden Moderators Posts: 5,460 Mod ✭✭✭✭graememk

    Look back on your bills.

    Im Rural, though.

    up until june 21 it was 0.76/day

    from june 21 to oct 21 0.79/day

    after oct its been 0.94/day. I'm not due a bill until march though.

  • Registered Users Posts: 1,406 ✭✭✭Big Lar

    €377 a year here

  • Advertisement
  • Registered Users Posts: 394 ✭✭jasgrif11

    @Big Lar how did you script in the cut off of 3000 units /2000 units for the different peak and offpeak limits?

  • Registered Users Posts: 1,406 ✭✭✭Big Lar

    Have not done that bit yet.

    But I figure that an automation should do it - Here are my thoughts, would love some input on this.

    • Rather than using a static electricity price on the energy dashboard I will create two new entities with the price - peak and off-peak
    • An automation will run daily and count the units used, then as soon as they are over 3000/2000 the automation should change the price to the new rate
    • On the date the new bill is issued then the automation will reset the units an start counting again.

    Problem is that as I am new to energia that I dont know what the reset date will be.