Using A Helper As A Reimann Sum Input Fails Due To Wrong Domain?

I have a device that is controlled by HA (On/Off) and I know how much power it uses. I would like to add it to the energy monitor and for that I was going to use a Riemann Sum with a helper as the input. When the device is on, the helper is set to the known watt draw and to 0 when off. However I cannot get the Reimann Sum to accept a helper as an input and get a unexpected domain error.

User input malformed: Entity input_number.HELPER_NAME belongs to domain input_number, expected [‘sensor’] for dictionary value @ data[‘source’]

Is there a better way to do this or a way to use an input_number as the input_sensor to the Reimann Sum? I am not trying to monitor the energy usage live as I already know the draw.

Use a template sensor instead of the helper.

e.g.

template:
  - sensor:
      - name: My Device Power
        device_class: power
        state_class: measurement
        unit_of_measurement: W # or kW
        state: "{{ 42 if is_state('switch.my_switch','on') else 0 }}"

There’s also this that may be easier if you have a lot of these to do:

Ah that’s a good workaround to change from a helper to a sensor, thanks! I don’t expect to have many so for now I’ll keep it simple but I like the idea of the virtual power sensor, especially with lookup tables for dynamic calculation.

It’s not a “work-around” as such, it’s how to do it. The Riemann Sum integration only supports sensors as input, not number/inpiut_number helpers. You could open a feature request for this if you wish.

Note: For sharp transitions between power levels like this sensor will produce make sure to use method:left in your Riemann Sum config to minimise approximation errors.

+1 for Power calc. Couldn’t be easier to set things up to do what you want as it’s all through the GUI, and if you have any smart bulbs there’s a good chance it will automatically setup and calculate power draw for them as well. It did so for a number of mine, and the few it didn’t I ended up getting the data for and had added to the integration.