Replace Group On/Off status with calculated average value

I have 6 temperature sensors inside a group. It is shown below and has the value “unknown”:

ha_1

Instead of “Unknown” being displayed, I would like to show the average value of the 6 temperature sensors, which is shown in the line above in the picture. I already have a custom sensor that calculates and displays the average value. Here is the configuration.yaml code to get the average value:

      avg_house_temp:
        friendly_name: 'House Average Temperature'
        unit_of_measurement: '°F'
        value_template: >-
          {{ ((states('sensor.master_bedroom_temperature')|float + states('sensor.living_room_temperature')|float + states('sensor.hall_thermostat_temperature')|float + states('sensor.hannahs_room_temperature')|float + states('sensor.poop_closet_temperature')|float + states('sensor.craft_room_temperature')|float) / 6) | round(1) }}

The custom sensor displays the average temperature without any issues. The group of the 6 sensors is nice to have since when I click on it, it shows each individual sensor like this:

I would like to just have one item in the state card that shows the average value and when I click on it, it shows each sensor individually. If I could replace the “unknown” state value with the average temperature value, I would be all set.

Is there a way to do this?

You could do this with custom_ui.

Thanks for the tip, I’ll check that out. Do you know if that can be used on a single group or would the entire front end need to be defined this way? (Is in an all or nothing thing or can can the custom_ui be applied on an as needed basis?)

Yeah, you can just apply it to what you need.

I have my away and holiday mode booleans displaying as their state instead of a toggle, and I have the ‘all automations’ group on my front end, but instead of the toggle I’ve put 2 badges, one showing how many automations there are, and the other showing how many are actually switched on…

@anon43302295, can you share this theme?
Looks nice on mobile.
Thanks in advance!

The theme is called midnight, and it’s the first one in this file…

link removed

I didn’t come up with it, and I did have a Readme crediting the authors of both themes I use but I’ve just noticed it’s disappeared, so sorry to whoever the author is for not crediting you, and I’ll find that Readme and get it back up ASAP.

2 Likes