Powercalc - Virtual power sensors

Dont worry, this solved itself during the day!

Hi,
having a question regarding “sensor.dummy”

I have tried something like this

- entity_id: sensor.dummy
  name: FritzBox Plug
  fixed:
     power: 8.4

and thought I would get an power and energy sensor but it didn’t show up.
Did I do something wrong?

Thank you!

Where is the platform in this case/example?

It is only a part of my configuration. the configuration it self works where I great groups and other stuff

it is something like that (in short)

- platform: powercalc
  create_group: Gruppe 
  entities:
    - entity_id: sensor.dummy
      name: FritzBox Plug
      fixed:
         power: 8.4

This is not helpful. With your typos, wrong intentions, etc. of your problems here in this thread in the past, it is not that unlikely, that it is again such a problem. So if you then show only parts or look a like code and not your real ones, which is not working, how can someone help you?

In short: Your “something like that” code above is working and is creating what you are asking for.

I just installed Powercalc and two of my lights were not supported and I wonder what I can do about it?

9290022944 (LTE002)
8718696695203 (LTW012)

Both are identified by the long number but checking Z2M I did find the zigbee model.

These may be added as model aliases. I have done so for these models, see this Pull Request.
Will be in next version.

1 Like

Awesome! Thanks a bunch!

This might be a little off topic but does any of you use the data you get from powercalc to run some form of report?

Like “this months top energy users”, “TV energy spent went down 12% from last month” or any good way of present the data so that one can make qualified decisions on how to lower energy usage.

I’m struggle making a really useful and easy to read dashboard with the data that actually matters. Just curious to see if anyone of you made progress with this.

After updating to the latest 9.7 version of HA I noticed the following in the log, suppose it has been there longer. I’m using the latest version of Powercalc according to HACS.

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:520
Integration: Sensor (documentation, issues)
First occurred: 15:18:35 (46 occurrences)
Last logged: 15:18:35

Platform powercalc does not generate unique IDs. ID 80533186-7d8f-4adb-9584-e012d63b2514_energy is already used by sensor.signal_sphere_energy - ignoring sensor.signal_sphere_energy
Platform powercalc does not generate unique IDs. ID 05b39b53-8889-424f-8c02-ca9c5c8f81d8 is already used by sensor.hall_stairs_power - ignoring sensor.hall_stairs_power
Platform powercalc does not generate unique IDs. ID 05b39b53-8889-424f-8c02-ca9c5c8f81d8_energy is already used by sensor.hall_stairs_energy - ignoring sensor.hall_stairs_energy
Platform powercalc does not generate unique IDs. ID d5699406-9f90-4485-ac5c-0f196aef0fde is already used by sensor.bathroom_strip_power - ignoring sensor.bathroom_strip_power
Platform powercalc does not generate unique IDs. ID d5699406-9f90-4485-ac5c-0f196aef0fde_energy is already used by sensor.bathroom_strip_energy - ignoring sensor.bathroom_strip_energy

Anything I can do about this ?

Which version of powercalc do you run? When you don’t run 1.0.0 beta yet I would suggest to try installing that one. When you still have this error please create an issue on github.

HA energy dashboard could give you some insights. You can view by day / week / year and browse periods. And also compare.
Just add all the powercalc energy sensors in “individual devices” section.
It’s not perfect but it will definitely help.

You could also do a lot of graphing with grafana. You can install this as addon on HA and also write the data to influxDB.

I brought my kWh per year down from 5200 to 2900 per year, just by replacing my espresso machine by a more economical one, killing power of tv, pc, etc at night and when I’m away with smart plugs etc. etc.

1 Like

Feature request: It would be awesome if when in a group, entities would have an attribute with how much % of the group it’s energy consumption is.

For example id you have a group with the total, and a subgroup with entities in it. The entities gets attribute with its % against the total and the subgroup.

It’s pretty easy to set up with template sensors but it would be neat if it was automated. And it would be easy visualize what devices is the uses the most energy.

Another thing I setup manually on my devices that uses state or active power measurement is tracking how much a device is on/off so that one could easily identify what a devise uses when it’s both in an active state and standby.

Everything here is just nice to have’s, nothing really important.

The idea is cool, but I don’t think I will add this feature, because I need to update state attributes of all underlying child sensors. This will cause a lot of state changes when you have groups with a lot of entities. Will quickly increase DB size for users, and can also slow down the system.
This disadvantage overweights the advantage this feature adds for me.

Also a power sensor can be part of multiple groups, so technically it’s also difficult to implement the way you proposed.

1 Like

Fair points!

In general is extra attribute state updates bad for performance even as they don’t store history data in the db? Most of my less important template sensors I use a fixed state and then the attributes is where I put the data to be tracked. It’s good when having fast updating sensors where history is not important at all.

Great project, this is what I have been looking for :slight_smile:

I have created individual sensors for the different parts on my Spa, but now I would like to group the consumption. I can not get the group to work, everything else works fine.

Can you guys see what’s wrong?

In the log i get:
.powercalc.sensor] Could not resolve any entities in group 'Spa Group'

powercalc:
  create_utility_meters: true

sensor:
  - platform: powercalc
    create_group: Spa Group
    entities:
        - entity_id: climate.my_spa_heater
        - entity_id: binary_sensor.my_spa_circulating_pump
        - entity_id: fan.my_spa_pump_1
        - entity_id: fan.my_spa_pump_2
  - platform: powercalc
    entity_id: climate.my_spa_heater
    fixed:
      states_power:
        hvac_action|cooling: 0
        hvac_action|heating: 2750
        hvac_action|idle: 0
  - platform: powercalc
    entity_id: binary_sensor.my_spa_circulating_pump
    fixed:
      power: 210
  - platform: powercalc
    entity_id: fan.my_spa_pump_1
    fixed:
      power: 2183
  - platform: powercalc
    entity_id: fan.my_spa_pump_2
    fixed:
      power: 2183

You have to define inside the group and not to reference outside defined ones.

See example in docs here

sensor:
  - platform: powercalc
    create_group: All hallway lights
    entities:
      -  entity_id: light.hallway
      -  entity_id: light.living_room
         linear:
           min_power: 0.5
           max_power: 8

Or e.g. one of mine

  - platform: powercalc
    create_group: iRobot
    unique_id: unique_id_powercalc_irobot
    entities:
      - entity_id: vacuum.roomba
        ignore_unavailable_state: true
        standby_power: 2
        fixed:
          power: 0.5
          states_power:
            docked: >
              {% if states('sensor.roomba_ladestatus') == 'absaugen' %}
                1000
              {% elif states('sensor.roomba_ladestatus') == 'laden' %}
                29
              {% else %}
                2
              {% endif %}
            cleaning: 0.5
            paused: 0.5
            idle: 0.5
            returning: 0.5
            error: 0.5
      - entity_id: vacuum.braava
        ignore_unavailable_state: true
        standby_power: 2
        fixed:
          power: 0.5
          states_power:
            docked: >
              {% if states('sensor.braava_ladestatus') == 'laden' %}
                {% if states('sensor.braava_battery_level')|int(default=0) < 90 %}
                  17
                {% else %}
                  9
                {% endif %}
              {% else %}
                2
              {% endif %}
            cleaning: 0.5
            paused: 0.5
            idle: 0.5
            returning: 0.5
            error: 0.5  

.

2 Likes

Thank you, will give it a try :slight_smile:

Is anyone able to see what on earth is going wrong with my setup.

I’m trying to get Powercalc to work with my smart plugs via the Local Tuya integration.

The Local Tuya device provides attributes for volts/amps/current, although looking at the entities i only get volts and amps. Not to worry, i create a power sensor with the following:

  - platform: powercalc
    entity_id: switch.fridge_freezer_plug
    power_sensor_id: sensor.fridge_freezer_plug_watts

Upon reloading the config changes, Powercalc creates an energy sensor as you’d expect, with the following attributes:

Source entity
switch.fridge_freezer_plug
Source domain
switch
Source
sensor.fridge_freezer_plug_watts

Although i’m not 100% sure if the energy sensor is working - i still have historical data stored that makes it hard to confirm.

The problem is that the entity sensor.fridge_freezer_plug_watts does not appear to exist in my list of entities. Which means when i try to create a powercalc sensor i don’t have anything to input in the power sensor field - this entity doesn’t appear.

Edit:
I’ve also tried this a different way to by deleting the manual power sensor, and pulling the watts attribute using a template sensor.

This obviously means i now have a power sensor that powercalc is happy to use as the input for the power sensor field, however it doesn’t create an energy sensor based on this power sensor.

Can you explain, what you want to acieve? The power_sensor_id is not for creating an entity with this name, but to the use an existing power entitiy as source for this integration. See docs. So if it not available before setting up this powercalc entity, it won’t be there afterwards.

1 Like