Energy Management in Home Assistant

Use a template sensor to add it all up for you but some people (like me) are having issues with what is displayed on the dashboard How should i use "Use an entity tracking the total costs"? (Currently comes through negative) - #4 by blalor

Can it be added a gauge card to the energy daskboard to report and track over days the offpeak usage ratio over total imported energy?
It has a lot of cost and energy saving benefits.
Cheers

Hi all,

Love the system and love the intergrations, dashboards and metric. Due to some failed messages my storage was full and my database corrupted.

After alot of work an effort i got bigger storage and running it again. But now i have the following problem:

21-01-2024 evertyhing is oke

22-01-2024 i get bad data

The insight of the bad data

Day after it keeps working like normal

Because of the faulty data of 22-01-2024 my yearly overview and monthly for januari is broken.

How can i fix this… or what are my options? im thinking of deleting everyting from 31-12-23:59:59 and just skip form those metric to the current p1 data. It should have the sum of all up untill now.

Is there a way to find this false data? and edit/remove/delete the specific data?

You should be able to find the faulty data in the statistics tab in the developer section.
Search for the sensor and finde the right timespan. Then you can edit the values.

The solar panels production (yellow) and gas usage (red) are both negative values. That per definition is not right. Why? I don’t know. But they have to be positive values.

edit:

Actually all your sensors have negative values…

They all should be positive:

afbeelding

i know, cause of this faulty data at this exact moment my overviews are bad. but 23-01-2024 it worked as it should.

So i need to get rid of the faulty data.

that did the trick, didn’t know you can do it within HA.

1 Like

Hey - that works perfectly - yiu just need to change your device-serialnumber…
Du you see a way to integrate the % of the battery charge into that view? Couldn’t find a variable to put the fill-state in…

how do you show the gauges on the right edge?

I used the volkszaehler project - especially the vzlogger: howto:getstarted [wiki.volkszaehler.org] for the powermeter:

but I grab the information via this config entry:

#Zählerstände
sensor:
  - platform: rest
    name: stromzaehler_gesamtverbrauch_vzlogger
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "Wh"
    scan_interval: 10
    resource: http://10.1.1.11:8081
    value_template: >
      {% for i in value_json.data %}
        {% if i.uuid == "xxxxxxx-9279-11eb-a1de-5d67173ee60e" %}
          {{ '%.2f'%(i.tuples[0][1]) | float }}
        {% endif %}
      {% endfor %}
    method: GET
  - platform: rest
    name: stromzaehler_gesamtleistung_vzlogger
    device_class: "power"
    state_class: "measurement"
    unit_of_measurement: "W"
    scan_interval: 10
    resource: http://10.1.1.11:8081
    value_template: >
      {% for i in value_json.data %}
        {% if i.uuid == "xxxxxxx-9277-11eb-9d38-c9a1400aa34d" %}
          {{ i.tuples[0][1]|round(0) / 1000 }}
        {% endif %}
      {% endfor %}
    method: GET
  - platform: rest
    name: stromzaehler_gesamteinspeisung_vzlogger
    device_class: "energy"
    state_class: "total_increasing"
    unit_of_measurement: "kWh"
    scan_interval: 10
    resource: http://10.1.1.11:8081
    value_template: >
      {% for i in value_json.data %}
        {% if i.uuid == "xxxxxxx-9279-11eb-9ebc-cfe38031abdb" %}
          {{ i.tuples[0][1]|round(0) / 1000 }}
        {% endif %}
      {% endfor %}
    method: GET

and the measuring of the gas meter is done via a reed contact reader on an esp01 with esphome:

esphome:
  name: esp01-2
  friendly_name: ESP01-2

esp8266:
  board: esp01_1m
  # Total Counter im Flash speichern
  restore_from_flash: true

preferences:
  flash_write_interval: 5min

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz="
  services:
    - service: update_counter_pulses
      variables:
        counter_pulses: int
      then:
        - globals.set:
            id: pulses_sum
            value: !lambda 'return counter_pulses;'

ota:
  password: "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Optional manual IP
  manual_ip:
    static_ip: 10.1.1.89
    gateway: 10.1.1.1
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp01-2 Fallback Hotspot"
    password: "zzzzzzzzzzzzzzzzzzzz"

web_server:
  port: 80
  auth:
    username: admin
    password: "zzzzzzzzzzzzzzzzzzz"

captive_portal:

# Gaszähler https://github.com/svenwal/gaszaehler-home-assistant-esphome

globals:
  - id: pulses_sum
    type: int
    restore_value: yes
    initial_value: '1473620'  # hier Gaszählerstand initialisieren, ohne Komma, mit Nachkommastellen
binary_sensor:
  - platform: gpio
    id: internal_pulse_counter
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
    name: "Live-Impuls"
    filters:
      - delayed_on: 100ms
    on_press:
      then:
#        - lambda: id(pulses_sum) += 1;
#        - output.turn_off: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
    on_release:
      then:
        - lambda: id(pulses_sum) += 1;
#        - output.turn_on: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
sensor:
  - platform: template
    name: "Gasverbrauch"
    device_class: gas
    unit_of_measurement: "m³"
    state_class: "total_increasing"
    icon: "mdi:fire"
    accuracy_decimals: 2
    lambda: |-
      return id(pulses_sum) * 0.01;
      
# Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird
#output:
#  - platform: gpio
#    pin: GPIO0
#    id: 'led'

More Details here:

Thanks but I was talking about these gauges

Any one else having trouble with Shelly EM?
I guess since i updated ESPHome yesterday, my Shelly EM is offline, but it keeps tracking usage?


Here you see a big gap.



And here it’s just tracking energy usage?
I don’t understand.
I have cut power from Shelly but it doesn’t solve it

Was a wifi issue, all fixed now.

Hi,

I am not sure if this a right place for this request.
But, there is a little issue, while configure the battery instance and the grid. The only two entities is involved, the ‘Grid Consumption’ and the ‘Home Consumption’. So, by configuring the Grid section with the ‘Grid Consumption’ entity and the battery section with both the entities, the Energy Dashboard does create two different grid consumptions. In this case there shouldn’t be a connection between grid and the house.

Please advise how to tell the Energy Dashboard that’s the same entities and it needs to be linked as a single one?

@fhopley Can you please share some code details on your dashboard?