Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] add option to compute group energy #2155

Closed
3 tasks done
erkr opened this issue Mar 24, 2024 · 6 comments
Closed
3 tasks done

[FR] add option to compute group energy #2155

erkr opened this issue Mar 24, 2024 · 6 comments
Labels
enhancement New feature or request group

Comments

@erkr
Copy link

erkr commented Mar 24, 2024

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

My use case are lights, over 50 in my case, that all together contribute to less 5-10% of my energy use. So energy tracking per light is only hammering home assistant recorder database, without real use.

The good news is that the creation of energy sensors in Powercalc can be disabled (create_energy_sensor: false ).

So I that defined an all lights group with light subgroups per room in it (as show in the extensive manual), where, in my case, energy sensor creation is disabled:

sensors:
  - create_group: all lights
    create_energy_sensor: false
    entities:
    - create_group: woonkamer lights
      create_energy_sensor: false
      entities:
      - entity_id: light.tv_lamp
      - entity_id: light.leeslamp
      - ...

The next attempt, enabling only the top level energy sensor doesn't work:

sensors:
  - create_group: all lights
    create_energy_sensor: true
    entities:
    - create_group: woonkamer lights
      create_energy_sensor: false
      entities:
      - entity_id: light.tv_lamp
      - entity_id: light.leeslamp
      - ...

The reason (as explained by Bram) is that energy sensor for a group sensor will just sum all embedded energy entities. So as I disabled them, the all lights energy sensor state will remain unknown.

Describe the solution you'd like

Specific for the lights usecase, energy calculation based on the group power value ( in stead of summing embedded energy sensors) would be nice. That could be an extra group option like this:

sensors:
  - create_group: all lights
    create_energy_sensor:  true
    calculate_group_energy: true
    entities:
    - create_group: woonkamer lights
      ...

Or a variant like this:

sensors:
  - create_group: all lights
    create_energy_sensor:  true
    group_energy_method: power # or sum (the default)
    entities:
    - create_group: woonkamer lights 
   ...

Describe alternatives you've considered

The alternative is to define a Riemann integration sensor for the light group. I don’t like that solution because there is a bug in the Riemann integration, causing that Riemann sensors don’t update as long the source sensors are stable. So extra helper sensors are needed to simulate updates.
Additional advantage is that the configuration for these extra energy sensors is also part of Powercalc.
Energy sensors created by PowerCalc seem to work fine🫡

Additional context

N/A

@erkr erkr added the enhancement New feature or request label Mar 24, 2024
@bramstroker
Copy link
Owner

@erkr
Copy link
Author

erkr commented Mar 30, 2024

Wauw, that is really great 🥳
I'm very happy 😊

@erkr
Copy link
Author

erkr commented Apr 6, 2024

Hi @bramstroker
Today I installed the update and tried to use this new flag. But the new flag is not accepted

This is in my yaml:


enable_autodiscovery: false
create_energy_sensors: false
create_utility_meters: false

sensors:

  - create_group: all lights
    unique_id: powercalc_group_all_lights
    create_energy_sensor: true
    force_calculate_group_energy: true
    entities:
    

This is the warning (powercalc doesn't start as a result):
image

@bramstroker
Copy link
Owner

bramstroker commented Apr 6, 2024

It should be force_calculate_energy

However I see the documentation is not correct. force_calculate_group_energy seems to be better naming, so I might have to change the code.
What do you think?

@erkr
Copy link
Author

erkr commented Apr 6, 2024

I think the name in the documentation is better😊

@bramstroker
Copy link
Owner

I agree, will be fixed with #2189

@erkr erkr closed this as completed Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request group
Projects
None yet
Development

No branches or pull requests

2 participants