Yevgenium / weather-chart-card

Custom weather card with charts
MIT License
275 stars 81 forks source link

Dew point #71

Open jds11111 opened 3 years ago

jds11111 commented 3 years ago

Would it be possible to add dew point to the graph? This has a couple of big advantages: first, it is much more intuitive than relative humidity, and less coupled with temperature. Second, it has the same units as temperature, so might be easier to implement. I tried using the temp switch, but without luck.

Yevgenium commented 3 years ago

What integration provides this data?

jds11111 commented 3 years ago

Pirateweather does out of the box. Or you can use a script to convert temperature and relative humidity to dewpoint pretty easily, using the Antoine equation.

agios commented 2 years ago

Some other integrations also already provide it, eg OpenWeather gives sensor.openweathermap_dew_point

You can also approximate it from humidity and temperature using a template as per the below:

- platform: template
  sensors:
    dew_point:
      value_template: >-
        {%- set b = 17.625 %}
        {%- set c = 243.04 %}
        {%- set h = states('sensor.openweathermap_humidity') | float %}
        {%- set t = states('sensor.openweathermap_temperature') | float %}
        {{ ( c*(log(h/100)+((b*t)/(c+t))) / (b-log(h/100)-((b*4)/(c+4))) ) | round(1) }}
      unit_of_measurement: '°C'
      device_class: 'temperature'