Add up helper states "unknown"

Hi, I’m using an add up helper for several entities. If only one of these entities is out of service, the helper’s output is “unknown”.
Is there a setting, that the helper adds up the remaining entities (without these out of service entities) and shows a valid number?

You would have to create a template sensor instead.

template:
  - sensor:
      - name: Total
        unit_of_measurement: "W"
        state: "{{ states('sensor.one')|float(0) + states('sensor.two')|float(0) + states('sensor.three')|float(0) }}"

The float filter default (0) replaces unavailable entities with zero.

If you are going to add a sensor, you could as well:

    - name: "Unknown entities count"
      state: >
        {{ states.sensor
          |selectattr('state', 'eq', 'unknown')
          |list|count }}

Hi, thank you!
For >80 sensors this seems to be not an appropriate way… Any other solutions?

Something like this:

Or this:

I missed the point, didn’t I :wink:
This sums all sensors not unknown or unavailable and having “temp” in their object_id (the part ofter sensor. )

{{ states.sensor
          |rejectattr('state', 'eq', 'unknown')
          |rejectattr('state', 'eq', 'unavailable')
          |selectattr('object_id', 'search', 'temp')
          |map(attribute='state')
          |map('float')
          |sum
        }}