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
304 stars 65 forks source link

Auto Conversion to C when set to F #346

Open BennyDaBee opened 3 months ago

BennyDaBee commented 3 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 3 months ago

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

BennyDaBee commented 3 months ago

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

pkissling commented 3 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 1 month 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 1 month 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 1 month 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 1 month 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 1 month 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 1 month 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 3 weeks 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 3 weeks 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 2 weeks 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 2 weeks 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 2 weeks 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.