home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.81k stars 30.9k forks source link

wunderground shows only F or C, not both #10604

Closed arraylabs closed 5 years ago

arraylabs commented 7 years ago

Home Assistant release (hass --version): 0.57.3

Python release (python3 --version): latest docker version

Component/platform: official docker

Description of problem: wunderground component with monitored conditions of temp_c, temp_f, feelslike_c, feelslike_f always returns in units defined by HA config unit_system. So unit_system=imperial means the temp_c and feelslike_c are still returned (shown in sensors) in Fahrenheit. Vice versa if changed from imperial to metric.

Expected: Regardless of unit_system setting the temp_c and temp_f, feelslike, etc should return appropriately Celsius or Fahrenheit.

Problem-relevant configuration.yaml entries and steps to reproduce:

homeassistant:
  unit_system: imperial

sensor:
- platform: wunderground
    api_key: xxx
    monitored_conditions:
      - temp_f
      - temp_c
      - relative_humidity
      - feelslike_f
      - feelslike_c
      - precip_1d
      - precip_1d_in
      - wind_mph
      - wind_degrees
      - pressure_mb
      - weather

Traceback (if applicable):

Additional info:

partofthething commented 7 years ago

I looked through the code and can't find an obvious reason for this. Are the numeric values themselves wrong? Or just the unit label? Like if it's a nice summer day and you have units set to imperial, does temp_c show 24 F? Or would it show 75 F?

arraylabs commented 7 years ago

Thanks for taking a look. With imperial set I get 74 F for temp_c, feelslike_c. If set to metric or omitted completely I get 22 C for temp_f and feelslike_f.

cgtobi commented 6 years ago

The unit conversions are done automatically by home assistant. I think it does not make sense to have a distinction in the sensor anyway.

terrycarlin commented 6 years ago

One possible thing to do is to implement a setting that tells HA not to convert anything in a particular platform or sensor. Weather Underground is just one example. I might want to have my unit_system set to imperial for local weather but want the weather report for my cousins in Canada to report temps in C. It’s a matter of accommodating a mix of users and a mix of uses for an instance of HA.

On Nov 24, 2017, at 3:02 AM, cgtobi notifications@github.com wrote:

The unit conversions are done automatically by home assistant. I think it does not make sense to have a distinction in the sensor anyway.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/home-assistant/home-assistant/issues/10604#issuecomment-346790224, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1W1Ptc9NbQR2Txse0XB344eZIQf-wGks5s5pRFgaJpZM4QfTxj.

cgtobi commented 6 years ago

@terrycarlin you can always use custom template sensors to change things to your liking, but personally I don't see a reason to expose both metric and imperial units.

balloobbot commented 6 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

BioSehnsucht commented 6 years ago

I've just stumbled over this "feature" while trying to implement support in my Elk M1 integration to specify either C or F for a given sensor or thermostat. Banged my head against it in confusion for a while before discovering this ... it didn't help that the UI would actually reflect the unit_of_measurement being C or F but would still perform conversions based on imperal/metric setting (i.e., set climate device to report C but HASS to imperial, and expecting C set_temperature calls I'd end up with double conversions that threw everything way off), in complete disregard to whatever unit_of_measurement was being set.

It would be nice if there was a flag (perhaps feature flag? Or an anti-feature flag I suppose) that could be set to prevent automatic conversions and instead let my platform / component handle the conversion if any is desired.

hcooper commented 6 years ago

Think I've just come across the same issue. This screenshot sums up the confusion (the field is called "f" but returns "c").

selection_705

I might take a look at the source and see if something like this is possible:

madsensh commented 6 years ago

I've been having the same issue and so far have not found a solution. In my case the reason I would like two different units at the same time is because I manage weather-related items in F, but computer and electronics items in C due to most specs and discussion for electronic items happening in metric units. Maybe this will be helpful in understanding why someone might want both.

balloobbot commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

balloobbot commented 5 years ago

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍