GithubHelp home page GithubHelp logo

Comments (2)

DavidFW1960 avatar DavidFW1960 commented on September 26, 2024

Yeah I have been seeing this for a while and have been ignoring it. Feel free to make a PR or suggest code to change it

from bom-weather-card.

simonjowett avatar simonjowett commented on September 26, 2024

I was finding it difficult to see the wood for the trees in the error log so I went looking for solutions and have managed to cull them back a bit!
It seems a recent HA update has caused a number of template sensor issues and this you-tuber provided a couple of solutions.
https://www.youtube.com/watch?v=7349L0CFi-M&t=713s

My crude way is to set a dummy numeric value of 0. This seems to work to get rid of the error but leaves the heat index as =0 when it would have been 'n/a'.

Also, doing this I don't think it would ever hit the 'Normal' tag... but then whats the difference between Normal and n/a!

# Heatindex
# https://en.wikipedia.org/wiki/Heat_index
      heatindex:
        unit_of_measurement: °C
        device_class: temperature
        value_template: >
            {%- if states('sensor.nowra_temp') | float(default=0) > 27 and states('sensor.nowra_humidity') | float(default=0) > 40 -%}
            {% set T = states('sensor.nowra_temp') | float(default='n/a') %}
            {% set R = states('sensor.nowra_humidity') | float(default='n/a') %}
            {% set c1 = -8.78469475556 %}
            {% set c2 = 1.61139411 %}
            {% set c3 = 2.33854883889 %}
            {% set c4 = -0.14611605 %}
            {% set c5 = -0.012308094 %}
            {% set c6 = -0.0164248277778 %}
            {% set c7 = 0.002211732 %}
            {% set c8 = 0.00072546 %}
            {% set c9 = -0.000003582 %}
            {% set HI = c1 + (c2 * T ) + (c3 * R) + ( c4 * T * R ) + ( c5 * T**2 ) + ( c6 * R**2 ) + ( c7 * T**2 * R ) + ( c8 * T * R**2 ) + ( c9 * T**2 * R**2 ) %} 
            {{ HI | round }}
            {%- else -%}
            0
            {%- endif -%}
      heatindexrating:
        value_template: >
            {%- if states('sensor.heatindex') == '0' -%}
            Out of range
            {%- elif states('sensor.heatindex') | float(default='n/a')  >= 54 -%}
            Extreme danger: heat stroke imminent
            {%- elif states('sensor.heatindex') | float(default='n/a')  >= 41 -%}
            Danger: cramps, exhaustion heat stroke probable
            {%- elif states('sensor.heatindex') | float(default='n/a')  >= 32 -%}
            Extreme caution: cramps and exhaustion possible
            {%- elif states('sensor.heatindex') | float(default='n/a')  >= 26 -%}
            Caution: fatigue possible
            {%- else -%}
            Normal
            {%- endif -%}

from bom-weather-card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.