Powercalc - Virtual power sensors

That’s strange. When you have autodiscovery disabled it should not create any sensors automatically. Did you happen to have that option enabled or not defined before? Btw the extra sensors are to get insights about the self usage of the shelly devices (as they don’t provide that in the own sensors).
About the duplicate power sensors that’s also a strange one. I would assume somehow you have defined configuration for it twice. You can enable debug logging which should hopefully provide more insights into why this happens.

When you are still struggling I suggest you to create an issue on github.

No, the first start was with the config above.

On the first start sensors appeared, when I added the integration and selected a column from the library, a second sensor was created, I tried removing both from core.entity_registry and restarting HA, but this does not help.

What’s the best way to do it? Just add debugging and restart HA? Or delete in core.entity_registry, and previously enabled debugging, restart HA?

Is there anything to measure the power of a 3D printer? I’d guess you can guesstimate power usage based on the temperature of the tool?

A question re ‘duplicate’ power sensors, ie the same sensor appearing in more than one group. Is that possible?
Let’s say a heater could be in group “Living Room” and in group “All Heaters” if you wanted to track all heaters?
Or should one rather create a template sensor and aggregate manually?

Interesting idea. I think it’s very plausible the 3d printer have a predictable power consumption. You’ll need to have a look into different states (bed warming, printing etc) and nozzle temp to see if you can see some pattern there.
Power sensor could be set up using any of the available strategies fixed with state power, linear strategy or maybe use a template when these strategies are not sufficient to map out the power.
I have an ender 3 pro, not planning into any printing this week, but when I do I will also have a look.

1 Like

Sure that’s one of the key points of powercalc that it supports grouping power and energy sensors, but also allows for sub/child groups and nesting, and adding a single sensor to more than one group.
When you setup your sensors using the GUI and also create the groups using GUI you can set a sub group:

In your case you don’t want to use subgroups (as that will also add all living room sensors to the all heaters group), but just add the powercalc sensor to both the Living room and All heaters group.

Also see Groups — Powercalc documentation for all group possibilities.

1 Like

@all Implemented a brand new feature which can be very useful which allows you to create a virtual power sensor with multiple underlying strategies. i.e mix both fixed and linear based on conditions.
This opens up a lot of new possibilities for configuration, and is highly flexible.

See here for more details: Composite — Powercalc documentation

It’s released in latest beta 1.8.0-beta.4 for next upcoming version.

Hope you like it.

3 Likes

I created a sensor through the GUI, now I need to change the associated “Source entity”.
By pressing “Configure” this field is not present.
I would like to change it through YAML files but I can’t find the file where the sensor configuration of “Powercalc” is saved

Has anyone had this problem before?

This might be a stupid question, but how do you setup up the option for auto discovery? I thought there used to be a setting cog on the integrations page.

It’s done on purpose, as I was not sure about all the side effects to allow this to be changed. Needs thorough testing, but it’s something I will have a look at to support.
You could try changing it in config/.storage/core.config_entries, but it’s on your own risk.

Auto discovery is enabled by default.
You can disable in YAML with:

powercalc:
    enable_autodiscovery: false

When you have enabled and not seeing entities you expect you’ll need to enable debug logs which gives insights.

https://homeassistant-powercalc.readthedocs.io/en/latest/troubleshooting/debug-logging.html

1 Like

If you say it is risky and can compromise other things, I prefer to delete the previously configured sensor and create a new one, even if the history is lost in this way. Thanks.

I just implemented to allow changing the entity. Will be in next release 1.8.1

Is there an easy way to use the calibrated model for the sonos speakers for a pair of speakers? I have a pair of play:1s, a pair of the symfonisk bookshelves, and a pair of a play one and a play one SL.

I’d say the power consumption would be twice the amount provided by the built-in profiles. As they were made by measuring a single speaker.
You could just set the multiply factor to 2 in this case.

Screenshot 2023-07-17 at 08.35.09

If you want to be 100% sure it is double the amount you’ll need to take measurements using the measure tool, which also have the possibility to measure the smart speakers.
https://homeassistant-powercalc.readthedocs.io/en/latest/contributing/measure.html

1 Like

Regarding the migration to the new yaml structure:

New configuration. Everything should move under the powercalc->sensors key, and platform needs to be removed.

Is it “tested and proven” :wink: that the sensors are not created again with perhaps _2 after restart with new structure? I’m really afraid to do this because of my lots of powercalc sensors, groups, …

The setup routine executed is exactly the same, so I’m 99.9% confident you won’t have any issues.
I also did not have issues on my test machine.
You could always try to migrate the config for one entity first. And when that is proven to work correctly migrate the rest.

Related to @arganto question above, can the new YAML structure stay in sensor.yaml, or does it need to move to configuration.yaml?

I’m trying to use the new composite feature. I’m trying to check the power usage of my inverter when there is no production.

  - platform: powercalc
    entity_id: sensor.status_solaredgeomvormer
    composite:  
      condition:
        condition: template
        value_template: "{{ is_state('sensor.current_solar_power_production', '0') }}"
      fixed:
        power: 2.5
    fixed:
      power: 0

But it’s not working, What am I doing wrong?

No I don’t think so as only entries falling directly under sensors: can be defined there.
You could however create a separate include for powercalc.
i.e.

powercalc: !include powercalc.yaml

Or use packages which is the beste way if you have a lot of YAML configuration and you’d like to split up.

1 Like