Powercalc - Virtual power sensors

Just a headsup. I have added the possibility to set more “advanced” settings in the GUI. This also contains the ignore_unavailable_state setting.
This is included in the latest v1.0.0 beta. Release v1.0.0-beta.13 🌈 · bramstroker/homeassistant-powercalc · GitHub

Many thanks for the beta update. That works very nicely.

I am using groups and utility meters in the GUI, but I would like to add Peak and Off Peak tariffs. I have done this in configuration.yaml for another sensor, which works OK. Is it possible to add a list of tariffs to the GUI, or can I ‘append’ to the GUIs created meters with the required sub sensors?

#### Utility Meters #####
utility_meter:
  ashp_daily_energy:
    unique_id: ashp_daily_energy
    source: sensor.shellyem3_485519c9a766_channel_a_energy
    cycle: daily
    tariffs:
      - peak
      - offpeak

somehow I missed a lot of updates! was still on beta 3, and now see this…

anyways, nice to have google home minis available, Ill add mu measurements for google hub and maybe even apple iPod :wink:

on the ignore_unavailable_state, Id really love to see that on the globe config, so all of groups (hue lights switched off from actual power) wouldn’t need that individually.
Would you accept a FR for the GitHub - bramstroker/homeassistant-powercalc: Custom component to calculate estimated power consumption of lights and other appliances on that option?

You can set in YAML on global level:

powercalc:
    utility_meter_tariffs:
        - peak
        - offpeak

This will also apply to all powercalc configurations made with the GUI.

Yes, you can make a FR.

Instructions how to measure smart speakers are here. See Measure smart speakers

1.5 year ago I started prototyping based on some ideas and discussions in this topic. This quickly grew into a working integration which I added to HACS. Got more and more traction in the community and lots of people joined in to provide measurements to the device library or contribute in other ways. More and more features have been added along the way.
Today we are finally ready for a V1.0 release which should be available in HACS now.
Thanks everyone who has contributed (over 85 people now), you are amazing!

11 Likes

Hi,

I suddenly have negative values for some of my daily energy sensors

I have updated today to the most recent version but I can’t tell if that was before I have update as well. Was some time that I have checked these sensors.

Any advice what the reason could be?

Thank you!

Could you please create an issue on github?

Ok, will do that. Thank you.

Whats the reason for including Fibaro / Qubino Wall plug / smart plug which already have power metering?

To get insights into the self usage of the smart plug / wall switch. Most of these plugs have no option to include that but only return the power of the connected device.

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?