Median temperature on a floor

From here I am trying to remove some room.
eg, I have ground floor with garage and a winter garden.

I managed to remove single entities from the calculation like this:

{{ floor_areas("Rez") 
| map('area_entities')  
| sum(start=[]) 
| select('is_state_attr', 'device_class', 'temperature')
| reject('eq', 'sensor.rez_verranda_th_temperature')
| map('states') 
| select('is_number') 
| map('float') 
| average }}

But to be more robust I would like to do it per room and I am stuck here:

{{ floor_areas("Rez") 
| map('area_entities')  
| sum(start=[]) 
| select('is_state_attr', 'device_class', 'temperature')
| reject('entity_id', 'in', area_entities('veranda') + area_entities('garage') )
| map('states') 
| select('is_number') 
| map('float') 
| average }}

Inspired from this topic: