clock-weather-card icon indicating copy to clipboard operation
clock-weather-card copied to clipboard

Auto Conversion to C when set to F

Open BennyDaBee opened this issue 11 months ago • 17 comments

Checklist:

  • [X] I updated to the latest version available
  • [X] I cleared the cache of my browser
  • [X] 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 avatar Mar 19 '24 16:03 BennyDaBee

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

pkissling avatar Mar 19 '24 16:03 pkissling

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

BennyDaBee avatar Mar 19 '24 17:03 BennyDaBee

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

pkissling avatar Mar 20 '24 08:03 pkissling

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"

MackmeWill avatar May 11 '24 03:05 MackmeWill

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

pkissling avatar May 12 '24 14:05 pkissling

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

MackmeWill avatar May 12 '24 14:05 MackmeWill

@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?

pkissling avatar May 13 '24 10:05 pkissling

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

singletrackdev avatar May 29 '24 12:05 singletrackdev

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

pkissling avatar May 29 '24 13:05 pkissling

@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"

MackmeWill avatar Jun 10 '24 08:06 MackmeWill

@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?

pkissling avatar Jun 11 '24 12:06 pkissling

@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.

BennyDaBee avatar Jun 18 '24 17:06 BennyDaBee

@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

pkissling avatar Jun 20 '24 06:06 pkissling

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.

MackmeWill avatar Jun 20 '24 06:06 MackmeWill

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.

cornmacabre avatar Jul 13 '24 15:07 cornmacabre

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

rldaugherty avatar Aug 20 '24 01:08 rldaugherty

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.

rocketdyke avatar Sep 09 '24 08:09 rocketdyke