Helper: Subtract/Add/divide/multiply two sensor values

First of all, I love the new Helpers in 2022.4! I was able to replace many template sensors because of it.

As an addition to these awsome new helpers, I would like to suggest (and request) a helper that can subtracts, add, multiply or device two sensor values.

My current template sensor:

 - sensor:
    - name: Afwijking Luchtvochtigheid Badkamer
      unit_of_measurement: "%"
      state: >-
        {% set TARGET = states('sensor.badkamer_luchtvochtigheid')|float %}
        {% set SOURCE = states('sensor.gemiddelde_luchtvochtigheid')|float %}
        {{ (TARGET - SOURCE) | round(2) }}
        target: "{{ states('sensor.badkamer_luchtvochtigheid') }}"
        source: "{{ states('sensor.gemiddelde_luchtvochtigheid') }}"

I totally agree !


Yes, it would make things much easier if this would be possible without the need of using YAML.
It would be even more useful if you could also calculate with static numbers, like (15 - sensorValue) / 100.

1 Like

Vote for it :slight_smile:


Same here!
I struggeling by checking if the outdoor temp is less then x °C over the dewpoint.
It be great if I could just subtrair the values and put this in a helper.

Is necessary. Would be wonderful.

1 Like

As a Home Assistant beginner I would like to be able to sum two sensors into one value an hope this will be added soon into the helper section. Adding it by using yaml code is so not very convenient. Please add this feature as I thing this should be a basic function.

1 Like


1 Like

How is this still not possible?


Would be very helpful

Any progress on this?

yes, there is an open PR:

This was merged three days ago into the codebase as part of the min/max/mean helper. I expect we’ll see this come out in stable sometime soon! :slight_smile:


Hi all, am I not mathematical enough, or is the subtract function not included ?

(Using 2022.12.0)

I don’t see subtract either.

I’m just coming back to confirm that SUM was released in stable in 2022.12. :+1:

Home Assistant Blog: Core Release 2022.12: Summing entities without templates

It’s working great! :grin: I’m using it to sum some WSDOT trip time measurements for the freeway routes between our company offices since they only provide the values on a per-segment basis, but I need it on a freeway exit-to-exit basis.

Like any other entity, it starts recording its historical data at the time you create the helper rather than just being a passthrough of the preexisting historical data from the entities that are being used for the sum. (That would have been amazingly neat, but I suspect it would be difficult to do efficiently.)


1 Like

Good job, but I don’t see subtract either.


No one is seeing subtract because it wasn’t … added.

(Couldn’t resist)


It would be nice to have subtract… or the ability to include any kind of manual/static values rather than only including references to entities. One could make a helper that contains a negative number and then include than as part of a sum. It’s a workaround, but that could probably work? (she says, not having tried it… :woman_shrugging:)

1 Like

I tried make helper with constant negative walue… wihtout success.
But I made some trick.
I made virtual mqtt sensor.
Usine MQTT Explorer i publish topic with negative value. (Remember topic must have Retain Flag).
Next, I made sum with my sensor.
It’s work but need a lot of work. Aubstract with constant value should be much simply