Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit of measurement lost when "stacking" average sensors #143

Open
StefanDorschu opened this issue Jun 19, 2022 · 4 comments
Open

Unit of measurement lost when "stacking" average sensors #143

StefanDorschu opened this issue Jun 19, 2022 · 4 comments
Assignees
Labels
bug Something isn't working. waiting for feedback Further information is requested.

Comments

@StefanDorschu
Copy link

StefanDorschu commented Jun 19, 2022

Describe the bug

I'm using this sensor to average my temperatures. E.g. i have several sensors in my living room which are averaged to a single value. This value (sensor) is used as an input to calculate (average again) the temperature of the first floor. When i do so, the sensor of the averaged temp in the first floor has no unit of measurement.

Configuration.yaml

- platform: average
  name: "Wohnzimmer - Temperatur"
  unique_id: "wohnzimmer_temperatur"
  precision: 0
  entities:
    - sensor.wohnzimmer_sensor_glastaster_flugeltur_temperatur
    - sensor.wohnzimmer_sensor_glastaster_linke_hebeschiebeanlage_temperatur
    - sensor.wohnzimmer_sensor_glastaster_eingangstur_temperatur

- platform: average
  name: "Allgemein.Wohnräume.Erdgeschoss - Temperatur"
  unique_id: "allgemein_wohnraume_erdgeschoss_temperatur"
  precision: 1
  entities:
    - sensor.flur_eingang_temperatur
    - sensor.flur_technik_temperatur
    - sensor.kuche_temperatur
    - sensor.waschkuche_temperatur
    - sensor.alte_kuche_temperatur
    - sensor.wohnzimmer_temperatur

Expected behavior

Keep the unit of measurement.

@StefanDorschu StefanDorschu added the bug Something isn't working. label Jun 19, 2022
@Limych Limych self-assigned this Jun 19, 2022
@Limych Limych added the waiting for feedback Further information is requested. label Jun 19, 2022
@Limych
Copy link
Owner

Limych commented Jun 19, 2022

I could not repeat your bug: everything works correctly with your config. Tested on the latest version of HA.

Screenshot2

Please check that your source sensors are working correctly. Perhaps, to identify the cause of the error, the enabled debugging mode is useful: https://github.com/Limych/ha-average#troubleshooting

If you find an error in my code, please post logs with this error here.

@StefanDorschu
Copy link
Author

Thanks for your quick reply. I activated the logs and see some "strange" behaviour.

Here and there i get the "error" that some value is not a temperature although the sensors are temperature sensors.
Bildschirmfoto 2022-06-20 um 05 52 51
Bildschirmfoto 2022-06-20 um 05 56 21

Bildschirmfoto 2022-06-20 um 05 53 07

Bildschirmfoto 2022-06-20 um 05 55 57

Beside that i have no clue whats wrong (everything is updated to the newest versions).

@prj
Copy link

prj commented Jul 7, 2022

For me it gets lost even without any stacking.

I have a value coming from node-red with unit EUR/MWh, and then randomly the EUR/MWh unit is lost.
Then to restore this, I have to erase the history for the whole entity, only then does the unit come back.

This happens after every restart of HA. Seems like if there is even one value where it receives "0" or "unavailable" then the unit is just deleted.

How about just adding a setting to the sensor where it is possible to specify the unit???
Every other sensor has this possibility but not this one.

Anyway, for now I am doing the average calculation in Node RED, so that I can specify the units.

@StefanDorschu
Copy link
Author

@ Limych Any ideas?

Limych added a commit that referenced this issue Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. waiting for feedback Further information is requested.
Projects
None yet
Development

No branches or pull requests

3 participants