Energy Management in Home Assistant

Hi @slovenc,
I used a simple Node Red automation to toggle the state of two input booleans at specific times and created a template sensor in the configuration:

- platform: template
  sensors:
    energy_price:
      friendly_name: "Energy Price"
      unit_of_measurement: 'Eur/kWh'
      value_template: >
        {% if is_state('input_boolean.horario_vazio','on') %}
          0.110577
        {% elif is_state('input_boolean.horario_fora_vazio','on') %}
          0.237636
        {% else %}
          0
        {% endif %}

Hope it helps.

1 Like

Hi Frenck, I also have a solar edge converter but I can get the integration working. After entering the site id and api key I get an unknown error.
I did use the integration in the past, maybe that causing the issue. Could you please help?

My apologies if this is answered… I searched and then read through, but I didn’t see this anywhere.

My rate structure for consumption is:

BASIC RATE PER MONTH
$14.20 * for the first 50 kWh or less
$0.093655 per kWh for all kWh in excess of above

How do I account for that in my tariff setup?

I’m interested in the 3 tariffs. I posted my code in the following post but couldn’t get it to work. Energy Management in Home Assistant - #383 by kinteseay

Got it fixed. In the core.config_entries file there was an old SolarEdge section. After removing it and a HAS reboot I managed to install and configure the SolarEdge extension.

Example of how I got 3 tariffs working:


template:
  - sensor:
      - name: Tariff Price
        state: >
            {% if is_state('utility_meter.daily_energy', 'peak') %}
                {{ 0.541145 * 0.75 }}
            {% elif is_state('utility_meter.daily_energy', 'shoulder') %}
                {{ 0.277145 * 0.75 }}
            {% else %}
                {{ 0.177045 * 0.75 }}
            {% endif %}

See this link for full details

Hi,
I tried many options, but I am not getting my entities visible in Grid consumption list.
Can you notice any failure…

Below are my sensors:

- platform: mqtt
  name : "MQTT House Meter Reading"
  unit_of_measurement: "kWh"
  device_class: energy
  state_topic: "vzlogger/data/chn2/agg"
  expire_after: 3600
  force_update: true

- platform: template
  sensors:
    electric_meter:
      friendly_name : "Electricity Meter Reading"
      unit_of_measurement: "kWh"
      # device_class: power
      device_class: energy
      value_template: "{{ (states('sensor.mqtt_house_meter_reading') | float / 1000) | round(3) }}"
1 Like

Thanks Hamish. When I set up as you have the “energy distribution” is not accurate - I am pulling about 1kw at the moment (it’s the middle of the night and the kids heater is on) but it says 3.3kw. In fronius app it shows 1kw. Any clues on what’s happening here?

Hi! Could homeone point me to the right direction how to purge energy usage history? I had a faulty config in my home assistant glow and now it says that I have used a months worth of energy in the last couple of days. I tried recorder purge for the glow-device and it’s entities but it didn’t help.

You are missen the ‘h’ in the round images. I think it is correct. The value in the circle is the cumulative value of the day. 3.3 is the sum of the bars of the day.
kW is the actual consumpion per second. W= Joule/second.

kWh is consumption over a timespan of an hour.

You can use 100kW for one second, and 0 for the other 3599 seconds and still end up with low kWh value.

You see in the y axis of the bars, the kWh is about 0,8 per bar. 800W. That looks correct

1 Like

Thanks , I see how it works now. Those kinds of graphics usually show real-time, updated every few seconds so that (and the animations!) threw me a little but now I notice the “h” you are right.

Would love to see a real-time version of this visual too.

1 Like

Set as source of solar production total production of device (lifetime energy), not daily production and You will stop getting negative value

I am having trouble getting energy costs to show up. I am using a zwave energy meter with the following configuration:

The energy consumption shows up correctly but no cost.

Any ideas?

The price seems to start accumulating when you add it, but doesn’t apply to past data. If you wait a while I think you will see it.

I would like to be able to feed in power sensors as well as energy as that would help with making it real time, but anyone who is getting data from their energy distributor’s meter probably won’t have that.

Before the new energy dashboard there was the power-wheel-card which displays a similar graphic. You can configure it for power or energy or both depending on what sensors you have.

I am seeing good output on developer tools but on the consumption page I get no export showing.

On Consumption page I get

Not sure what I am getting wrong, I used all of your first post details just with updated serial for my envoy.

Thanks

Here is my export Power sensor in W

Here is my export Energy Sensor which has takes the data from sensor.grid_export_power and then converts into Energy as kWh

It would appear that you have not correctly setup the integration sensor. This is what you have to do. This needs to be created outside of the template area of configuration.yaml

sensor:
  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    unit_prefix: k
    unit_time: h

I have waited 3 days now and nothing.

this is my full code in configuration.yaml, maybe I have bad formatting?

template:

  - sensor:
      name: Grid Export Energy
      state_class: measurement
      icon: mdi:solar-panel
      unit_of_measurement: W
      device_class: power
      state: >
        {{ [0, states('sensor.envoy_serialnumber_current_power_production') | int - states('sensor.envoy_serialnumber_current_power_consumption') | int ] | max }}

  - sensor:
      name: Grid Import Energy
      state_class: measurement
      icon: mdi:transmission-tower
      unit_of_measurement: W
      device_class: power
      state: >
        {{ [0, states('sensor.envoy_serialnumber_current_power_consumption') | int - states('sensor.envoy_serialnumber_current_power_production') | int ] | max }}

sensor:
  - platform: integration
    name: Grid Export Energy
    source: sensor.grid_export_power
    unit_prefix: k
    unit_time: h

  - platform: integration
    name: Grid Import Energy
    source: sensor.grid_import_power
    unit_prefix: k
    unit_time: h