Automatically create helpers for entities with specific combination of integration and entity class

For devices that expose accurate power measurement, it would be helpful if HA could automatically convert that power measurement to energy usage. While this could be done at a component level, I suspect some may want to avoid the appearance that the monitored device is producing bad data. I think it would be helpful if HA could optionally allow creation of calculated “usage” sensors for each “power” sensor.

This would need to be optional for the component, so that component maintainers could opt-in if they knew the monitored device would produce an effective data set for conversion to usage.

Once the component maintainer modified the component to opt-in, HA would include options on the device allowing configuration of auto-generated consumption entities. Config options would be similar/same as the Riemann sum integral sensor integration options.

Adding this to core would allow for consistent or predictable conversion, and would open up possibilities for the energy dashboard related to consumption.

How would your proposal be different from what we have now?

You can opt in by adding this helper (from the UI) for your power sensors.

It’s in the core and has what you requested.

on top of that: Every sensor behaves differently, based on device, communication tech, and integration. It is simply not possible to define a generalized approach for “power to energy conversion” (technically speaking “conversion” is the wrong term here).

@benhanson I think you were too ambitious with your ticket. Many integrations offer a power and energy entities for their devices, with the underlying knowledge needed to compute energy from power for the specific device. I suspect that you are working with an integration that does not or can not do so. In this case it’s up to you to use the riemann integration component or you could open a discussion for your specific integration and ask for the addition of energy entities.

I attempted this method before posting, and I think what threw me off was that the calculated sensor was not available as a device immediately in the Energy Dashboard setup. I now understand that the Riemann Sum Integral integration is not energy specific (I thought it was a specialized formula rather than a generic mathematical equation), so I can understand why devices wouldn’t be available until data is collected.

After re-evaluating the Riemann Sum Integral integration, I can see that more of the solution is already present in HA. Thinking about what I was trying to achieve from a procedural design standpoint, I am looking for a way to either automate creation of helpers when a specific integration has a specific class of entity created, or a way to batch create helpers with a filtered input of entities.