[SOLVED] Arithmetic mean wrong

Hi, I have a helper set as Arithmetic mean of two sensors.

It is almost always wrong.

As of right now, Entity 1 is 23.9C, Entity 2 is 29.6, yet the mean is… 29.6.

The original entities are set correctly. Restart didn’t help. HA 2024.7.4, nothing related in log.

Wth? Any ideas? Thanks.




Which helper are you using?

“Combine the state of several input sensors” with Arithmetic mean preset.

So the Min/Max helper.

There are no open issues:

I just created a test sensor.

Temp Sensor 1: 18.4°C
Temp Sensor 2: 18.1°C
Mean from helper: 18.25°C

So it is working as expected for me.

Do both your source sensors have the exact same unit of measurement?

Look very closely at the ° symbol. There are a number of similar symbols that will prevent your sensors being combined.

No Min/max helper in my install (HAOS VM on Proxmox, everything up to date). Yes, both are °C, with one decimal.

Thanks!


Please post the output of Settings → System → Repairs → (top right) → System Information

System Information

version core-2024.7.4
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.33-haos
arch x86_64
timezone Europe/Prague
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.34.0
Stage running
Available Repositories 1396
Downloaded Repositories 63
HACS Data ok
Home Assistant Cloud
logged_in true
subscription_expiration August 18, 2024 at 02:00
relayer_connected true
relayer_region eu-central-1
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled false
remote_server eu-central-1-2.ui.nabu.casa
certificate_status ready
instance_id a6ad286ce20544a5ada8094149250224
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.4
update_channel beta
supervisor_version supervisor-2024.07.0
agent_version 1.6.0
docker_version 26.1.4
disk_total 34.7 GB
disk_used 13.4 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization kvm
board ova
supervisor_api ok
version_api ok
installed_addons MariaDB (2.7.1), Mosquitto broker (6.4.1), Terminal & SSH (9.14.0), ESPHome (2024.7.2), Home Assistant Google Drive Backup (0.112.1), Tailscale (0.21.0), Zigbee2MQTT (1.39.0-1), File editor (5.8.0), Auto Guest Login (1.4.0), Filebrowser (2.23.0_14), Qbittorrent (4.6.2_43), ZigStar TI CC2652P/P7 FW Flasher (0.4.0), Samba Backup (5.2.0), Vaultwarden (Bitwarden) (0.22.0), Mealie (v1.10.2), Zigbee2MQTT Edge (edge), InfluxDB (5.0.0), Grafana (10.0.0)
Dashboards
dashboards 1
resources 37
views 7
mode storage
NextDNS
can_reach_server ok
Recorder
oldest_recorder_run June 27, 2024 at 10:23
current_recorder_run July 30, 2024 at 20:07
estimated_db_size 1613.62 MiB
database_engine mysql
database_version 10.11.6
Spotify
api_endpoint_reachable ok

Sorry, typical user error, I changed weather provider and didn’t update the helper for new entity. It would be nice if there was like a red badge or an exclamation mark in the helper setup UI if the entity is invalid.

Sorry for wasting your time.

The differently named Min/max helper type is weird though :slight_smile:

Look into the Spook integration.
It has a bit of that functionality.

1 Like

Spook does warn about invalid entities in scripts and things like that but it didn’t catch this one. Thanks!

I think I just worked out why our helpers are named differently too.

I use the min/max integration in YAML. That probably has something to do with it.

sensor:
  - platform: min_max
    unique_id: ff0dc72e-c9c0-4b95-8fc2-f6d7b2d57009
    type: mean
    round_digits: 0
    name: Average Upstairs Humidity
    entity_ids:
      - sensor.bathroom_humidity
      - sensor.ensuite_humidity
      - sensor.dining_room_humidity
      - sensor.lounge_room_humidity
      - sensor.master_bedroom_humidity
      - sensor.spare_bedroom_humidity

It’s the same underlying helper though as you only use the UI yours is called “Combine the state…etc”.

1 Like

Good. I gave some average sensors in YAML as well.

All is well, thank you guys!