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

Auto Conversion to C when set to F #346

Open
3 tasks done
BennyDaBee opened this issue Mar 19, 2024 · 17 comments
Open
3 tasks done

Auto Conversion to C when set to F #346

BennyDaBee opened this issue Mar 19, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@BennyDaBee
Copy link

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser
  • I read the FAQ and the issue I'm having was not mentioned there.

Release with the issue: 2.3.0

Last working release (if known): Previous

Browser and Operating System: Vivaldi - Windows and iPhone App

Description of problem: Weather data is being converted from F to C, and putting F for unit, does not change. Putting C then converts it to C again.

Javascript errors shown in the web inspector (if applicable): N/A


Additional information:
image

@BennyDaBee BennyDaBee added the bug Something isn't working label Mar 19, 2024
@pkissling
Copy link
Owner

pkissling commented Mar 19, 2024

clock-weather-card will calculate and display the temperatures based on the unit you select in your HA instance.
image

@BennyDaBee
Copy link
Author

I do have it set to F in my system settings.
image

@pkissling
Copy link
Owner

ah, i see. the temperatures are converted to C, but still show as F in the card. i'll have a look

@MackmeWill
Copy link

MackmeWill commented May 11, 2024

I had the same problem but the other way around.

Outside temperature sensor reporting as C (even in the state it was C, home settings C as well)

When using this sensor, clock weather card would convert it to F. Tried another temperature sensor and clock weather card would report it as C..... weird.

Solution:

Created a sensor only for clock weather card in sensor.yaml that converted the sensor degrees C (as if it was F) back to C and it worked. I had to fiddle with the computations but I eventually got it displaying correctly.

see below:

  • platform: template
    sensors:
    es_vin_temp:
    friendly_name: " Outside Temp for Clock Card "
    value_template: "{{ states('sensor.your_Temperature_sensor') | float * 9/5 + 32 | round(1) }}"
    unit_of_measurement: "C"

@pkissling
Copy link
Owner

pkissling commented May 12, 2024

what weather service are you using? i tried to reproduce the problem, but every weather provider i am using delivers temperatures in °C - even for National Weather Service

@MackmeWill
Copy link

Hi,

I am using a Ruuvi sensor which is connected to a Cerbo GX via Bluetooth. The cerbo is connected to Home assistant via MQTT.

If I use this sensor as a guage or entity or I check the entity state it reports the correct value but if I use it with clock card we have a problem.

If I use another temperature sensor in clock card (like you) then I do not have this problem.

cheers

@pkissling
Copy link
Owner

@MackmeWill can you please post the state of your sensor (Developer tools, like the state below) , so that i try to reproduce it with the delivered by your sensor.

state_class: measurement
time: 2024-05-13T10:34:51.630Z
setting: 0
unit_of_measurement: °C
device_class: temperature
friendly_name: -

@BennyDaBee, what weather provider are you using?

@singletrackdev
Copy link

I have an observation that may explain this. A temperature sensor with a measurement unit including the degree symbol works correctly in clock weather card, and other HA cards:

unit_of_measurement: °C

If the degree symbol is omitted, the sensor shows correctly in HA developer tools and other cards I've tested, but is converted to F in clock weather card:

unit_of_measurement: C

Hope that helps

@pkissling
Copy link
Owner

I have an observation that may explain this. A temperature sensor with a measurement unit including the degree symbol works correctly in clock weather card, and other HA cards:

unit_of_measurement: °C

If the degree symbol is omitted, the sensor shows correctly in HA developer tools and other cards I've tested, but is converted to F in clock weather card:

unit_of_measurement: C

Hope that helps

hi @singletrackdev,

thanks for pointing this out. i did not realise that the degree symbol was missing. will have a look

@MackmeWill
Copy link

MackmeWill commented Jun 10, 2024

@MackmeWill can you please post the state of your sensor (Developer tools, like the state below) , so that i try to reproduce it with the delivered by your sensor.

state_class: measurement
time: 2024-05-13T10:34:51.630Z
setting: 0
unit_of_measurement: °C
device_class: temperature
friendly_name: -

@BennyDaBee, what weather provider are you using?

I have an observation that may explain this. A temperature sensor with a measurement unit including the degree symbol works correctly in clock weather card, and other HA cards:
unit_of_measurement: °C
If the degree symbol is omitted, the sensor shows correctly in HA developer tools and other cards I've tested, but is converted to F in clock weather card:
unit_of_measurement: C
Hope that helps

hi @singletrackdev,

thanks for pointing this out. i did not realise that the degree symbol was missing. will have a look

Hi, sorry for the late reply.

The °C (without the degrees symbol) was the problem, thanks @singletrackdev,

I went into the state in developer tools and saw that the temperature was being reported as "C"

I tried to set the state to "°C" but when I restarted home assistant it was back to "C"

So I modified my sensor.yaml to report in "°C" and took out my conversion calculation from the post above and now it is ok.

Code below:

  • platform: template
    sensors:
    es_vin_temp:
    friendly_name: " Modified temp for Clock Card "
    value_template: "{{ states('sensor.your_outside_temperature') | round(1)}}"
    unit_of_measurement: "°C"

@pkissling
Copy link
Owner

@MackmeWill can you please post the state of your sensor (Developer tools, like the state below) , so that i try to reproduce it with the delivered by your sensor.

state_class: measurement
time: 2024-05-13T10:34:51.630Z
setting: 0
unit_of_measurement: °C
device_class: temperature
friendly_name: -

@BennyDaBee, what weather provider are you using?

I have an observation that may explain this. A temperature sensor with a measurement unit including the degree symbol works correctly in clock weather card, and other HA cards:
unit_of_measurement: °C
If the degree symbol is omitted, the sensor shows correctly in HA developer tools and other cards I've tested, but is converted to F in clock weather card:
unit_of_measurement: C
Hope that helps

hi @singletrackdev,
thanks for pointing this out. i did not realise that the degree symbol was missing. will have a look

Hi, sorry for the late reply.

The °C (without the degrees symbol) was the problem, thanks @singletrackdev,

I went into the state in developer tools and saw that the temperature was being reported as "C"

I tried to set the state to "°C" but when I restarted home assistant it was back to "C"

So I modified my sensor.yaml to report in "°C" and took out my conversion calculation from the post above and now it is ok.

Code below:

  • platform: template
    sensors:
    es_vin_temp:
    friendly_name: " Modified temp for Clock Card "
    value_template: "{{ states('sensor.your_outside_temperature') | round(1)}}"
    unit_of_measurement: "°C"

thanks for the heads-up @MackmeWill. does this also solve the problem for you, @BennyDaBee?

@BennyDaBee
Copy link
Author

@pkissling unfortunately no. My unit of measurement is already reporting as °F and it does appear to be happening again today. I am using the weather channel integration through HACS.

@pkissling
Copy link
Owner

@pkissling unfortunately no. My unit of measurement is already reporting as °F and it does appear to be happening again today. I am using the weather channel integration through HACS.

can you please post a dump of the data you are getting from weather channel integration? either through service call weather.get_forecast or, if exists, a screenshot from the weather entity via developer tools -> states

@MackmeWill
Copy link

Hi.

I am having a problem where it will report correctly in degrees C but every few days it reverts back to F.
I have to restart HA for it to go back to reporting C again.

@cornmacabre
Copy link

I've also got a similar issue. The temperature metrics intermittently switches to C while suffixed with "F" (F is default in HA, and when it decides to work will correctly show the right metrics). A restart doesn't resolve, and more often than not will actually default to C before resolving back to F throughout the day. Bizarrely, it will occasionally resolve itself but at this point it's difficult to replicate the issue or "force fix it."

I've tested with two different weather sources and the intermittent temperature swap issue seems persistent between sources.

Let me know if there's additional info I can provide to debug.

@rldaugherty
Copy link

Any additional info on this? Reporting the same issue where the values are in C, but the suffix is the letter "F".

@rocketdyke
Copy link

I have the same issue of it intermittently reporting temperature in degrees C, but with the F label, my system is set to degrees F.

However, it seems to only happen with the NWS weather station I am using goes offline. (Sadly, both NWS stations near my home seem to be intermittent, currently using the former downtown Los Angeles station that has been changed to Dodger Stadium, FHMC1) It reports the cached forecast from FHMC1, only converts to C. Very odd.

If I change to another weather service, it reports the correct format, but sadly, not as accurate as the NWS numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants