Powercalc - Virtual power sensors

Okay, thanks, Fibaro have the posssibility to include.
Assume then I should ignore the “new device” to avoid double recording of consumption

Yes correct, than you should ignore to avoid duplicate recording.

Fantastic tool! Unfortunately I have run into an annoying bug regarding the create_group function.

I’m trying to figure out what has changed since version 0.26.1 as that’s the last version working, for me, regarding create_group. All versions after that, betas etc, end up with no group sensors created - that is, the sensor.xxx_energy and sensor.xxx_power are all missing for each create_group entry.
I’m using the EXACT same syntax in the yaml between the versions and it is clear that what works in version 0.26.1 will not work in the versions after that, including the newly released 1.0.

Here is an extract from my sensors.yaml:

Could you please create an issue on Github, and include error logs if any. When there is nothing in the error logs please enable debug logging (see the readme) and include that.

I had an issue where some of my Ikea sensors + a group stopped showing too.
Fixed it by powering off HA for 30 mins then it seemed to find and re-allocate everything as before.

Worth a try?

(addendum. My power sensors were not missing, but “unavailable”)

Hi !

I make one senor for my bulb, this working good:

- platform: template
  sensors:
    nappalicsillar:
      friendly_name: Nappali csillár
      value_template: >-
        {% if is_state('light.izzo', 'on') %}
          on
        {% elif is_state('light.izzo', 'off') %}
          off
        {% else %}
          darkness
        {% endif %} 

And this for powercalc:

        - entity_id: sensor.nappalicsillar
          name: Nappali lámpa
          fixed:
            states_power:
              off: 16
              on: 24
              darkness: 0



What I’m doing wrong ? Thanks for the help !

Not sure why you are adding a template sensor in the first place?
Which states are you trying to map to “darkness”. Because there are not really other states than on and off for lights. Maybe unavailable or unknown
And a light which uses 16 watt when off? I don’t understand…

off is a special case in powercalc. It will consider the standby_power in this case.

I think you want something like this:

- entity_id: light.izzo
  name: Nappali lámpa
  standby_power: 16 # Power when the light is off, but 16?? that can't be correct.
  ignore_unavailable_state: true # Power sensor will not be unavailable when the light is unavailable
  unavailable_power: 0 # Power when the light is unavailable
  fixed:
    power: 24 # Power when the light is on
1 Like

You are right, the first sensor template is unnecessary.

This is a 3-bulb chandelier that I turn up or down with a normal switch. One of the 3 bulbs is smart.
If I switch off the chandelier, the status is UNAVAILABLE (0w). If ON, 3 bulbs (24w) light up. If it is OFF, only 2 bulbs (16w) light up.

What you wrote works perfectly!! Thank you very much for your help !

1 Like

Using energy entities supplying Wh in PowerCalc GUI (or configuration.yaml), PowerCalc want kWh

Firstly - a great integration that will be giving me plenty of insight into what is going and impacting the electricity bill.

I considered replacing my home-brewed cumulating sensors with ones managed by PowerCalC, but run into problem as in one case the entities are natavely measuring Wh.
It would be nice if the templating from Wh → kWh could be done within the PowerCalc setup.

This is the legacy sensor:

  - sensor:
      - name: "BVP Energy"
        unique_id: bvp_energy
        state: "{{ ( ( states('sensor.bvp_l1_energy')|float(0) + states('sensor.bvp_l2_energy_2')|float(0) + states('sensor.bvp_l3_energy_2')|float(0) )/1000 )|round(3) }}"
        availability: >
          {{ states('sensor.bvp_l1_energy') not in ['unavailable', 'unknown', 'none'] and
             states('sensor.bvp_l2_energy_2') not in ['unavailable', 'unknown', 'none'] and
             states('sensor.bvp_l3_energy_2') not in ['unavailable', 'unknown', 'none'] }}
        unit_of_measurement: "kWh"
        device_class: energy
        state_class: total_increasing

which I intended to replace with

Any luck here?

Yes should be possible to facilitate this. I have started working on this, see this Pull Request

EDIT
Just released v1.0.5 which contains the unit conversion feature. You should have at least 2022.10.0 for it to work, as I rely on unit conversion utilities which were only added in this version of HA.
Let me know if this works for you.

Worked even better than anticipated as I expected to enter a factor, now it just worked automgically after adding the energy-sensors from the PZEM’s

:pray:

1 Like

With the last few updates I saw mention of Sonos devices being added. I already have most of my Sonos devices added manually (using a powermeter doing some very rough estimations what it takes on standby and playing on default volume). Should I remove these and let PowerCalc discover them or what is the best course?

I stay with my manual ones, because my own measurements for e.g. One differs a lot from the now inbuild figures.

1 Like

Would be a good idea to explain how you measured as to why it differs a lot from the built in figures.
The goal is to have an estimation as good as possible, It will never be perfect though, especially with devices which have a high amplification. The Google Homes I measured should be really accurate as I was able to get very consistent readings with different kind of music.
We can change the instructions how to measure and you can also contribute to make things better.
Currently we are taking averages for 60 seconds on each volume level (with steps of 10 in between), but the thing is should we take a song to get some measurements or just noise. I am not sure yet what would be the best to get a rough estimation for any played music / genre.
Any ideas / suggestions would really help.

1 Like

If you did this, it for sure is better then my ‘measure standby’ and ‘measure play’ and that’s it. How would I change them? Simply remove the Sonos device I manually added before these updates and it will be discovered?

Yes I think that should work, because the discovery routine checks if you manually configured the same entity. When this is the case it skips the entity from the discovert. After removing and reboot they should be discovered hopefully ;-).

1 Like

I’d like to receive some feedback from you guys to help me steer my development efforts in the future. I’m interested to know which aspects of powercalc are used. Made a google form for that with 6 multiple choice questions. Only takes less than one minute of your time to reply. Would really appreciate it.

1 Like

I measured with a HomematicIP plug. Is known as +/- correct.

I measured over some days standby and it was 3,23 instead of 2,4. BUT it was for two One`s in stereo connection, so 3,23 instead of 4,8. Of course “a lot” is relativ, but this is 50 % divfference.

Same for 5,7 in play state (in my play volume). Sum of both. Differs a lot from 4.5*2=9.

Second problem with this discovery are stereo groups (as here). The integration is most probably not able to detect if they are stereo grouped or single devices. And then the figures are of course even more wrong.

I’d like to receive some feedback from you guys to help me steer my development efforts in the future.

A really good inititative!

However, as I just recently have discoverd Powercalc I’m in the beginning of my journey, and thus interested to influence the future, but will at the same time contribute with the opposite as the responses are based on my/everones current situation, rather than what long term targets are.

Example - I am currently not using groups extensively (I have one for learning/testing purpose), but considering my objective to measure different aspects of power consumption the groups will certainly be part of my plan, I’m just not there yet…
So, I’m lacking the look-ahead completary questions related to the current ones.

Hi, i’d like to report a bug, and maybe a feature request. Is it possible to add “Hide sensors” button that would open up a list of all of the powercalc sensors with checkboxes on the side of them, where you would be able to hide them all / some / individually?
The thing is, i have a lot of powercalc sensors, and i’ve hidden them almost all but i had to do it one by one.
Then, a few days later, they all showed up on lovelace, and were unhidden.
I hid them again, and a week later, they again showed up, and unhid themselves.
Is this something that’s known and i’m just missing a setting somewhere? Can it be fixed somehow?