Sum from value template displays as 'Unknown'

I’m trying to display the sum of two lux sensors in an Entities card. I’ve tried two different value templates to get the sum. Each generates the correct sum using the Developer Tools Template tab, but neither works in the UI. When I click on the card, the values for the underlying entities are displayed, just not the sum.

Here are my value_templates:

{{ expand('group.luminance_Sensors') | map(attribute='state') | map('int') | sum }}


{{(states('sensor.window_multi_sensor_illuminance') | float  +
        states('sensor.stairwell_sensor_illuminance_2') | float) )}}

All ideas appreciated.
Thanks

You can’t use templates in an Entities card. Create a template sensor and show that in the card.

Btw: Summing up to Lux values makes no sense (at least to me, as Lux is a logarithmic scale), consider using the Min/Max sensor and it’s “mean” value, if you want to get the average illuminance (or minimum or maximum).

First, I should apologize to all for my first post. I was not clear. When using this group entity, group.luminance_sensors, in an entity card, the sum is displayed as ‘unknown’, but the More Info displays the underlying entities and their lux values, but still ‘unknown’ for the sum.

When I use a sensor card and this template sensor:


- platform: template
  sensors:
    outside_luminance:
      value_template: >-
        {{ expand('group.luminance_sensors') | map(attribute='state') | map('int') | sum }}

The sensor card displays the correct sum, but not the values for the underlying entities when clicked. I know that I can add them as entities in a vertical stack with the sensor card, but I guess I’m looking for the best of both worlds:
A card that will display both the sum and the underlying entities (on click), without having to explicitly add them.
Is that possible?