Powercalc - Virtual power sensors

With the create_domain_groups only virtual power sensors created by powercalc are included.

You can create custom groups where you can also include the shelly dimmers with the GUI. Devices & Entitiies → Add Integration → Powercalc → Group. Add the shelly using Additional power/energy sensors option.
Or with YAML using the create_group option in combination with power_sensor_id and energy_sensor_id options.
See the readme for more info.

Hi Bram,

needed some extra template sensors again, so I tried:

sensor:


  - platform: powercalc
    entities:

      - create_group: All lights
        include:
          template: >
            {{expand('light.all_lights_only')|map(attribute='entity_id')|list}}

      - create_group: All switches
        include:
          template: >
            {{expand('group.all_switches')|map(attribute='entity_id')|list}}

      - entity_id: light.corridor_pool

ofc the templates are correct, and listing all entities in dev tools. All individual entities exist (and, already have individual powercalc sensors)

And yet, I get this error at startup:

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.powercalc.sensor
Source: custom_components/powercalc/sensor.py:238 
Integration: Powercalc (documentation, issues) 
First occurred: 11:21:12 (1 occurrences) 
Last logged: 11:21:12

Could not resolve any entities in group 'All lights'

and no sensors are created. the switch template does not show an error, but Powercalc does not create any sensors for that config either.

added to that, all other utility integration entities are now unavailable…

configuring the template entities individually like:

sensor:

  - platform: powercalc
    create_group: All lights
    include:
      template: >
        {{expand('light.all_lights_only')|map(attribute='entity_id')|list}}

  - platform: powercalc
    create_group: All switches
    include:
      template: >
        {{expand('group.all_switches')|map(attribute='entity_id')|list}}


  - platform: powercalc
    entities:

      - entity_id: light.corridor_pool
      - entity_id: etcetc
      - etcetc

does create the sensors.

is this a bug, or to be expected?

Could you create an issue on github please?

Hi there!! I want to ask you what kind of voltage have you used in your measurements for calculating wattage of each light? The reason I am asking is that the math for calculating Wattage includes voltage

Amps (A) x Volts (V) x Power Factor = Watts (W)

If you have used this equation then the output of the sensors created by Powercalc will work only for 120V or 230V depending where you are in the world.

Am I correct?

Depends on the voltage which the contributor used to measure the light. Pretty sure most have been done by europeans.
I believe most lights have another type number (model id) when they are for US market, so that would be a separate measurement/contribution.
But even when the model id’s are identical I assume the power reading would be pretty much similar, as the 120V version would just have a resistance to bring the A down to a similar Amperage as the 230V version (to have the same lumen output). So ultimately the power would also be more or less similar.

Also a question was raised about E26 bulbs vs E27. Not sure how we can be 100% sure and asume the power rating would be the same.
Hope someone else can join the conversion which has more in depth knowledge about this topic.

1 Like

Thank you for the answer, I work for an authorized dealer of the professional products from signify (Vari-Lite, Strand) so I could find a contact within signify to ask a few technical questions like the one above.

2 Likes

sure, consider that done: template group config not allowed under entities? · Issue #1421 · bramstroker/homeassistant-powercalc · GitHub

It is configured a s a light which is the default for shelly dimmers.

I have below errors in my log. They are new, nothing changed to my setup so maybe related to one of the later Powercalc releases? Only noticed now. Any idea what is causing these?

sensor.zigbee_washer_power: Cannot set device id on entity
sensor.zigbee_dryer_power: Cannot set device id on entity
sensor.zigbeeplug_couch_tv_room_power: Cannot set device id on entity
sensor.vloerverwarming_pomp_power: Cannot set device id on entity
sensor.zigbee_luuk_pc_power: Cannot set device id on entity
1 Like

Could be related to some last powercalc releases where I cleaned up the code a bit. Need to have a closer look. Could you please raise an issue on github?

Same issue. NB spare 1/2 are not connected but HE 3/4 are.

sensor.home_entertainment_3_consumption: Cannot set device id on entity
sensor.home_entertainment_4_consumption: Cannot set device id on entity
sensor.spare_1_consumption: Cannot set device id on entity
sensor.spare_2_consumption: Cannot set device id on entity
sensor.waterfall_consumption: Cannot set device id on entity

Please create issue on github as requested

Dear All,

I tried to find an answer on the thread and google but failed.
How to change the source entity for a created manual virtual sensor?
In configuration of the sensor there is not field i can modify this using GUI?
Is there any file which I can edit?

TIA

That’s not allowed to edit. You should create a new entry and delete old one when you want to have a virtual sensor for another source entity.

As another option to this I’d like to have visual dropdown to show states from group-members (sorted by the biggest user?)
Tried to use Thomas Loven’s fold-entity-row to unvail group members automatically, but it failed (propably cause the powercalc-group is a sensor?)
Is there any way to create a markdown that get a list of the group-members with their respective states? (would then create the ‘group-sensor’ and a dashboard showing ‘group-sensor’ with fold-down to see the markdown which would be populated with new group-members automagically)

… or even better, to get the group-entities from powercalc “de-foldable” within fold-entity-row?

and at last, thanks Bram for the exellent work :slight_smile:

1 Like

I have managed to make some configuration using auto-entities and fold-entity-row cards which should suite your needs.
My Powercalc power group entity is sensor.alle_verlichting_power

type: custom:fold-entity-row
head: sensor.alle_verlichting_power
entities:
  - type: custom:auto-entities
    card:
      type: entities
    filter:
      template: >
        {{state_attr("sensor.alle_verlichting_power", "entities") }}
    sort:
      method: state
      reverse: true
      numeric: true

Results in this:

1 Like

so wery wery spot on :slight_smile:

may I as why you are filtering out the unavailable ones? Is it not useful to see that a sensor is unavailable (asking just to increase my knowledge/understanding)

I actually had the similart setup with manually configured groups in lovelace (see the picture and the red square which is the manually configured one)
But with more and more devices enabled for control/summary, I was considering that two locations to maintain was enough for my ad-hoc-usage, so you solution is implemented on the green square, automagically showing details :slight_smile:

thanks for the great solution :clap: :clap: :clap:
(have been preaching to the HA-audience in Norway about it, and it is gaining momentum :+1:)

You can also show the unavailable ones, I had a problem with 4 of my Zwave sensors after power outage yesterday. So I had excluded them out to make the screenshot :wink: but forgot to remove that from the resulting YAML afterwards.

That’s cool.

I have been busy today reworking the powercalc documentation. Currently it’s one massive readme, so I decided to convert it to dedicated documentation site.
Readthedocs is used a lot for open source projects, so decided to go with that.

Current state is visible here here.
https://homeassistant-powercalc.readthedocs.io/en/latest/

Still some work to do but getting there.
As I am the developer and the documentation is user facing I am interested in any improvement/suggestions of the userbase.
Let me know if you have any additions or suggestions which can make the docs even more helpful.

3 Likes