pkissling / clock-weather-card

A Home Assistant Card indicating today's date/time, along with an iOS inspired weather forecast for the next days with animated icons
Other
437 stars 79 forks source link

Auto Conversion to C when set to F #346

Open BennyDaBee opened 8 months ago

BennyDaBee commented 8 months ago

Checklist:

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

pkissling commented 8 months ago

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

BennyDaBee commented 8 months ago

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

pkissling commented 8 months ago

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

MackmeWill commented 6 months ago

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:

pkissling commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

@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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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

pkissling commented 5 months ago

@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 commented 5 months ago

@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 commented 4 months ago

@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 commented 4 months ago

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 commented 4 months ago

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 commented 2 months ago

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

rocketdyke commented 2 months ago

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.