Min_max platform --> Mean showing "unknown"

I have the following sensors in my config file:

  - platform: min_max
    name: "Basement Average Temperature"
    type: mean
    round_digits: 1
    entity_ids:
      - sensor.basement_temperature
      - sensor.basement_stairs_temperature

For some reason it is displaying as “unknown”:

Both sensors are showing up with valid values. Any ideas what the issue is?

I am still having this issue. Anyone have any ideas?

Hi Ron.

I also use average temperatures in my Home Assistant setup, but can’t duplicate your issue. I have the following in my configuration:

platform: min_max
type: mean
name: Average Indoor Temperature Zone A
entity_ids:
  - sensor.averys_room_temperature
  - sensor.guest_room_temperature
  - sensor.guest_bathroom_temperature
  - sensor.living_room_thermostat_temperature
  - sensor.master_bedroom_temperature

If I look at these in the states page of Home Assistant, I can see they all have matching unit_of_measure. It may also be relevant that most of these are from MQTT but the thermostat is from the Nest component and one of my other sensors is Z-Wave (part of Zone B though).

image

I know in the past I had sensors come in with only F as the unit of measurement. Can you help us with some more of your configuration? It would be helpful to see where both of those sensors you are using for the mean are coming from.

Things are working at the moment. I’ll keep an eye out and report back with more details if it happens again.

Ok, this has happened again and I have looked at more things. I think I see the issue, but I’m not sure why it is happening.

Here is the config entry:

  - platform: min_max
    name: "Shop Average Temperature"
    type: mean
    round_digits: 1
    entity_ids:
      - sensor.shop_multisensor_temperature
      - sensor.shop_cart_temperature
      - sensor.shop_entry_temperature
      - sensor.shop_finishing_room_temperature

Here is the history of the min_max sensor:
ShopClimatePlot

The temperature sensor individually:

The units of the unavailable sensor (it should be DegF, but it isn’t):

Once the sensor comes back, the units change back to DegF as expected:

I am not sure why the unit changes, but I am going to try adding this to my customize.yaml file to try and prevent the behavior. We’ll see if it works.

  sensor.shop_entry_temperature:
    unit_of_measurement: '°F'

Specifying the unit_of_measurement did not help. It just put a °F symbol next to °C numerical values. I then tried to specify the device_class as temperature and that didn’t help either. Same issue of the units changing from °F to °C when the sensor is ‘unknown’.

You could use a template sensor and template the value conversion from °C to °F. I know for my xiaomi sensors I had to translate their reported temperature (which was in Celsius) to Fahrenheit. Since I was getting the value from MQTT, I just modified the value_template for my MQTT sensor.

1 Like

That sounds like a viable work-around. I’ll give it a try. Thanks.