Calculate energy exported (solar/battery) between certain timeframes?

My Home-assistant is as follows:

Home Assistant 2023.10.1
Supervisor 2023.10.0
Operating System 10.5
Frontend 20231005.0 - latest

We have solar as well as a home battery, and we are on an energy plan where we only get a feed in tariff for energy exported between 2pm and 8pm (If anybody is curious, Company is Energy Locals VPP, Aus, on the Tesla Energy VPP Plan).

Ive just set up home-assistant a few days ago and I’ve been reading about helpers and integrations but I cant seem to think about how I’d display how much energy we export between these time periods. Ive tried looking it up but I couldnt find any similar topics.

Any help or guidance or links to RTFM would be appreciated!

Call the two tariffs whatever you want. Switch between tariffs at 2pm and 8m with an automation.

1 Like

Ive followed the link but I’m not sure I configured the tariff switching properly. I used the Ada lovelace GUI as opposed to YAML:

This is what the entity looks like, it charts the power exports before 2pm:

These are the Helper-utilities that I created as described by the link:

These are my automations (as YAML):

alias: Tariff  - Peak
description: "Switch Tariff to Peak : 2pm --> 8pm"
trigger:
  - platform: time
    at: "14:00:00"
condition: []
action:
  - condition: state
    entity_id: sensor.grid_export_peak
    attribute: tariff
    state: "On"
mode: single
alias: Tariff Offpeak
description: "Switch Tariff to Off-Peak : 8pm --> 2pm"
trigger:
  - platform: time
    at: "20:00:00"
condition: []
action:
  - condition: state
    entity_id: sensor.grid_export_offpeak
    attribute: tariff
    state: "Off"
mode: single

I’ve made some progress but I have no idea what I’m doing wrong?

Your triggers are correct. Your actions are not. You need to change the tariff by changing the utility meter select option. This entity was also created when you added tariffs and is what enables you to switch between them. e.g.:

alias: Tariff  - Peak
description: "Switch Tariff to Peak : 2pm --> 8pm"
trigger:
  - platform: time
    at: "14:00:00"
condition: []
action:
  - service: select.select_option
    target:
      entity_id: select.grid_export
    data:
      option: Peak
mode: single
alias: Tariff Offpeak
description: "Switch Tariff to Off-Peak : 8pm --> 2pm"
trigger:
  - platform: time
    at: "20:00:00"
condition: []
action:
  - service: select.select_option
    target:
      entity_id: select.grid_export
    data:
      option: OffPeak
mode: single

Double check that the select entity id is correct, and that the selected options are correct. They must match the tariffs you specified exactly (including upper/lower case letters and spacing).

1 Like

Hey mate, thanks so much, your advice worked perfectly. I replaced the ID and it now reports as expected.