Powercalc - Virtual power sensors

Hi @bramski I’m starting with powercalc. First of all, thank you for the great work.
I’m trying to create a custom model for sonoff ZBMINIL2. I have 60+ devices and don’t want to create it manually in home assistant.
I create a model.json (/config/custom_components/powercalc/power_profile/sonoff/ZBMINIL2/model.json).

This is the content:

{
  "measure_description": "Measured manually",
  "measure_method": "manual",
  "measure_device": "Minipa ET-3811",
  "name": "ZBMINIL2",
  "standby_power": 0.01,
  "standby_power_on": 0.49,
  "sensor_config": {
    "power_sensor_naming": "{} Device Power",
    "energy_sensor_naming": "{} Device Energy"
  },
  "device_type": "smart_switch",
  "calculation_strategy": "fixed",
  "only_self_usage": false,
  "aliases": [
    "Zigbee smart switch (no neutral) (ZBMINIL2)",
    "ZBMINIL2"
  ],
  "created_at": "2025-05-31T08:19:10",
  "author": "Luiz Machado"
}

Should I do something else to get the automatic discovery working ?

Thx

Please see these resources:
https://docs.powercalc.nl/library/discovery/
https://docs.powercalc.nl/library/library/#custom-models

Should provide all the info you need. The directory you have put it in is not right.
After restart or calling service powercalc.update_library discoveries should appear.

Also consider submitting the profile to github so it is part of the Powercalc library.

That being said, 0.01W for standby power cannot be correct as the power needed to supply the chip and zigbee radio will be more than that.

i have multiple Miele devices, such as refrigerator, freezer, washing machine, oven etc… Unfortunately they are currently not supported… Is there a way to integrate them ?

without further info on the power entities you have on those, its hard to tell…

are you using the CC for Miele and do they provide power entities?
or, are you using smart power plugs on the devices

in any case, if you have power entities, just include those in the powercalc config like any other

considering the enormous variability of power consumption during operation of these devices, it seems the only way to do reliably.

this.
PowerCalc is dedicated to add constant, or deterministically changing power draw to devices. Deterministically means based on some sensors (it light state, intensity, color, switch state etc).

It’s not applicable to devices that change the power draw in unpredictable way (ie freezer starts compressor any time it needs, it can modulate its intensity etc.)

Your best choice is to add measuring devices to the chain, like smart sockets, or measurement devices like shelly mini PM. then besides they measure draw of connected appliances, you can use PowerCalc to add self-consumption of those small devices.

Hi there, all my existing sensors have broken since i updated ha. i get this message

I also cant add new sensor via “add entry”. it just doesnt respond.

i add a new entry via the integration path but the sensor that it create is literally not working.

Many thanks

Hi there, all my existing sensors have broken since i updated ha. i get this message

That’s strange. Anything in the error logs?

I also cant add new sensor via “add entry”. it just doesnt respond.

This is a known issue for a few weeks now, see It is not possible to add a new entry · Issue #3417 · bramstroker/homeassistant-powercalc · GitHub
It’s very strange as I can’t reproduce it at all on several HA instances, so not sure how to proceed fixing it. Please see my latest comment with a question, would be nice if you can answer that.

Hi Bram,

I just deleted the PowerCalc folder in custom components and also removed all the entities - reinstalled and its started working

1 Like

hi - i have a house full of athom eps8266 rgbww bulbs which aren’t detected by powercalc. well, it’s detected 3 of them but not the other 80. any super easy tips as to how i can get the other ones recognised and added?

Are there exactly the same lights as the ones which are detected?
How are they identified in HA when looking in the device page?

New to powercalc, seems promoising, but why would i add shelly plug s for instance?
the plug itsself has energy monitoring, is it to “break out” the plug itself as a power consumer?
br

Yes, it’s to get their self consumption, as that’s not included in the power sensor of Shelly itself.
When you have a lot of them it will add up.
If you are not interested in having that insight you can just ignore the discoveries.

Hi @bramski - yes they are exactly the same as the ones already detected. Here’s a screenshot of the device page:

actually, @bramski doing this discipline has made me relook at the athom bulbs that HAVE shown up and i can see that they are on earlier versions of the firmware and earlier versions of the esphome framework:

Any updates with that?

Could you please make an issue on github?

No, not yet.

done, many thanks for looking at it when you get there. let me know if you need any more info

I get new errors like

Could not convert power value 52,7 to decimal

Can I see, which entity? And any way to solve this or a new gap/bug in the integration? Didn’t see it before. Started recently. But as I don’t know from which entity it is, I cannot say, if this is perhaps a new one, not measured before.

Hi Bram,

the new update options, are they also to ‘reduce’ the amount of updating? As the title of the PR suggests that Implement throttle for power sensor updates (1 sec) by bramstroker · Pull Request #3532 · bramstroker/homeassistant-powercalc · GitHub Implement throttle for power sensor updates (1 sec)

I can only find an option in the documentation

force_update_frequency: Interval at which the sensor state is updated, even when the power value stays the same

and

group_update_interval: Throttle state changes of group energy sensor to only once every x seconds, default= 60

so these seem to not be about the new option?

Id like to test that, because currently they update like crazy, mostly because of being triggered by my smart meter entities that can be way more than once a second…