question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(Nested) groups: Energy way too high (especially after restart of HA)

See original GitHub issue

I have nested groups configured like this (shortened):

powercalc:
  enable_autodiscovery: false
  scan_interval: 00:10:00
  create_energy_sensors: true
  create_utility_meters: true

sensor:
  # actual total consumption
  - platform: powercalc
    entity_id: switch.shelly_3em
    power_sensor_id: sensor.shelly_3em_power_total
    energy_sensor_id: sensor.shelly_3em_energy_total

  - platform: powercalc
    create_group: Haus
    entities:

      - create_group: Wohnzimmer
        entities:
          # ...

      - create_group: Küche
        entities:
          # ...

      - create_group: Badezimmer
        entities:
          # ...

      - create_group: Schlafzimmer
        entities:
          # ...

      - create_group: Arbeitszimmer
        entities:
          # ...

      - create_group: Flur
        entities:
          # ...

Power and energy sensors for the single devices are working as expected but something is wrong with the group sensors: Power seems to be OK but the group energy sensors are way too high. Especially a restart of HA makes things worse:

Before restart: powercalc_before

After restart: powercalc_after

“Shelly 3EM” is the actual total consumption of my home. “Tuya Server” and “Kaffeemaschine” are two of my single devices.

Already checking debug logs but can’t find anything suspicious.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
bramstrokercommented, May 20, 2022

With your latest changes to master I have only one entry for sensor.flur_energy: grafik

Perfect, that’s as expected

Utility meters also look good now! 😃

Nice

Regarding warnings I see a lot of State value of grouped energy sensor may never be lower than last value, skipping. [...]

Only after restart right? Than you can safely ignore this warning.

Thanks for your work and enjoy the coffee!! 😉

Thanks

0reactions
chbartschcommented, Jul 5, 2022

So I think the current approach for the group energy sensor is error prone and should be changed. The right approach would be to let powercalc just create an riemann integral sensor for the sensor.group_power which will just integrate the group total power to kWh over time. This would be a big change/refactor so I first need to know if this solves the issue for you guys. You can try this yourself by creating this sensor from the GUI. “Configuration” -> “Devices & Services” -> “Helpers” and than select the option as indicated in the screenshot below.

After that you can also create a utility meter for this energy sensor from the same screen. Leave it running for a few days and lets see if this improves things.

Hey, I was on vacation and lost track of this topic…

I have your suggested “manual” energy and utility meter sensors up and running for a few days now and results are looking good. Even on reboot and stuff. 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

2022.4: Groups! Groups! Groups! - Home Assistant
Welcoming new helpers to the UI, including groups! Helpers for switches with an identity crisis, updates, backups, performance improvements, ...
Read more >
Solved: Nested DRS clusters with a single HA cluster? (AMD...
I have to manually initiate a shutdown of the VM. Sit there watching it, waiting for the shutdown. And then boot it up...
Read more >
Any other users have large amounts of groups/nested groups ...
This turns out to be a horrific idea because of how NPM queries things... It doesn't play nicely with nested groups (causing these...
Read more >
Nested groups does not work (include and exclude mode)
With an excluded nested group : the machines are not excluded. It worked fine before with patch for server version. Expand Post.
Read more >
Suicide and Antidepressants: What Current Evidence Indicates
Across the globe, ADs, especially SSRIs, are among the most commonly ... it is possible that suicidal impulses as well as the energy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found