Spray Painting Weather Conditions Template

I often find myself wanting to paint something at either high noon or near midnight. Before I get setup for the task, per Rust-Oleum’s recommendations; I will check that the outside temperature is between 50° F to 90° F (10° C to 32° C), and the humidity is below 65%.

I wanted to share the template I put together that will give me a basic Yes/No sensor to let me know if it’s okay to start painting. Drop the following in your configuration.yaml and change my lacrosse_tx141thbv2 sensor to your own temperature/humidity sensor.

I think it would be cool to also estimate how long suitable painting conditions will last based on a trend of the temperature and humidity sensors. I’m not sure if that is possible though. Any HASS geniuses out there?

template:
  - sensor:
      - name: "Painting Weather Conditions"
        state: >
          {% set temp = states('sensor.lacrosse_tx141thbv2_0_144_t')|float %}
          {% set humid = states('sensor.lacrosse_tx141thbv2_0_144_h')|float %}
          {% if is_number(temp) and is_number(humid) and temp | float > 50 and temp | float < 90 and humid | float < 65 %}
            Yes
          {% elif temp | float <= 50 or temp | float >= 90 or humid | float >= 65 %}
            No 
          {% else %}
            Unknown
          {% endif %}
        icon: >
          {% if is_state("sensor.painting_weather_conditions", "Yes")  %}
            mdi:spray
          {% else %}
            mdi:cancel
          {% endif %}


image

2 Likes

If you are interested, you can streamline the templates like this:

template:
  - sensor:
      - name: "Painting Weather Conditions"
        state: >
          {% set temp = states('sensor.lacrosse_tx141thbv2_0_144_t') | float(0) %}
          {% set humid = states('sensor.lacrosse_tx141thbv2_0_144_h') | float(0) %}
          {{ iif(50 < temp < 90 and humid < 65, 'Yes', 'No') }}
        icon: "mdi:{{ iif(is_state('sensor.painting_weather_conditions', 'Yes'), 'spray', 'cancel') }}"

Alternately, the icon template can be this:

        icon: "mdi:{{ iif(this.state == 'Yes', 'spray', 'cancel') }}"
1 Like

I ended up using this template to have a Google Home speaker start a routine when asked if it was okay to start painting. Then it was still the simple template for Yes/No and a readout of the current temperature and humidity.

Last weekend I wanted it to warn me if conditions were getting close to the recommended limits. Also wanted to know how far off the current conditions are away from the recommendations. And I wanted grammatically correct plurals as well.

No guarantees the if/else logic is perfect. I think it’s close though. I have the HASS script in a gist at github.

Here’s the updated jinja template for painting weather conditions TTS:


        {% set temp = states("sensor.lacrosse_tx141thbv2_0_144_t")|float|round
        %}

        {% set humid = states("sensor.lacrosse_tx141thbv2_0_144_h")|float|round
        %}

        {% if temp >=50 and temp <= 90 and humid <= 65 and (50 - temp)|abs <= 10
        and (temp - 90) <= 10 or temp >=50 and temp <= 90 and humid <= 65 and
        (65 - humid)|abs <= 10 %}

        Yes, the current weather condition is within the recommended limits for
        painting. The temperature is currently {{ temp }} degrees fahrenheit {%
        if (50 - temp)|abs <= 20 %}which is {{ (50 - temp)|abs }} degree{% if
        (50 - temp)|abs != 1 %}s{% endif %} above the recommended minimum.{%
        elif (temp - 90)|abs < 20 %}which is {{ (temp - 90)|abs }} degree{% if
        (temp - 90)|abs > 1 %}s{% endif %} within the recommended maximum.{%
        endif %} The humidity is {{ humid }} percent which is {{ (65 -
        humid)|abs }} percent below the recommended maximum. Proceed with
        caution as the conditions are close to the recommended limits.
        Temperature should be between 50 and 90 degrees fahrenheit. The humidity
        should be under 65 percent.

        {% elif temp < 50 and humid > 65  %}

        Sorry, no, it is not a good time to start painting. Both the temperature
        and humidity are beyond manufacturer recommendations. The temperature is
        currently {{ temp }} degree{% if temp|abs > 1 %}s{% endif %} fahrenheit,
        which is {{ (50 - temp)|abs }} degree{% if (50 - temp)|abs != 1 %}s{%
        endif %} below the recommended minimum of 50 degrees fahrenheit. The
        humidity is {{humid}} percent, which is {{ (65 - humid)|abs }} percent
        above the recommended maximum of 65 percent. Painting is not
        recommended.

        {% elif temp > 90 and humid > 65 %}

        Sorry, no, it is not a good time to start painting. Both the temperature
        and humidty are beyond manufacturer recommendations. The temperature is
        currently {{ temp }} degrees fahrenheit, which is {{ (temp - 90) }}
        degree{% if (90 - temp)|abs != 1 %}s{% endif %} above the recommended
        maximum of 90 degrees fahrenheit. The humidity is {{humid}} percent. The
        humidity is {{ (65 - humid)|abs }} percent above the recommended maximum
        of 65 percent. Painting is not recommended.

        {% elif temp < 50 and humid <= 65 %}

        Sorry, no, it is not a good time to start painting. The temperature is
        beyond manufacturer recommendations. The temperature is currently {{
        temp }} degree{% if temp|abs > 1 %}s{% endif %} fahrenheit, which is {{
        (50 - temp)|abs }} degree{% if (50 - temp)|abs != 1 %}s{% endif %} below
        the recommended minimum. The humidity is currently {{ humid }} percent{%
        if (65 - humid)|abs <= 10 %}. The humidity is {{ (65 - humid)|abs }}
        percent below the recommended maximum of 65 percent{% endif %}. Painting
        is not recommended.

        {% elif temp > 90 and humid <= 65 %}

        Sorry, no, it is not a good time to start painting. The temperature is
        beyond manufacturer recommendations. The temperature is currently {{
        temp }} degrees fahrenheit, which is {{ (temp - 90) }} degree{% if (temp
        - 90)> 1 %}s{% endif %} above the recommended maximum of 90 degrees
        fahrenheit. The humidity is currently {{ humid }} percent{% if (65 -
        humid)|abs <= 10 %} which is {{ (65 - humid)|abs }} percent below the
        recommended maximum of 65 percent{% endif %}.vv

        {% elif temp >= 50 and temp <= 90 and humid > 65 %}

        Sorry, no, it is not a good time to start painting. The humidity is
        beyond manufacturer recommendations. The humidity is currently {{ humid
        }} percent which is {{ (65 - humid)|abs }} percent above the recommended
        maximum of 65 percent. The temperature is currently {{ temp }} degrees
        fahrenheit {% if (50 - temp)|abs <= 20 %}which is {{ (50 - temp)|abs }}
        degree{% if (50 - temp)|abs != 1 %}s{% endif %} above the recommended
        minimum of 50 degrees fahrenheit.{% elif (temp - 90)|abs < 20 %}which is
        {{ (temp - 90)|abs }} degree{% if (temp - 90)|abs > 1 %}s{% endif %}
        within the recommended maximum of 90 degrees fahrenheit.{% endif %}

        {% else %}

        Sorry, I have not been programmed with logic statements to handle this
        situation. I show a temperature reading of {{ temp }} degree{% if
        temp|abs > 1 %}s{% endif %} fahrenheit. The humidity is showing a value
        of {{ humid }} percent.

        {% if temp >= 50 %} The temperature is {{ (50 - temp)|abs }} degree{% if
        (50 - temp)|abs != 1 %}s{% endif %} above recommended minimum of 50
        degrees fahrenheit.{% endif %} {% if temp <= 90 %} The temperature is {{
        (90 - temp)|abs }} degree{% if (90 - temp)|abs != 1 %}s{% endif %} below
        recommended maximum of 90 degrees fahrenheit.{% endif %} {% if temp <=
        50 %} The temperature is {{ (50 - temp)|abs }} degree{% if (50 -
        temp)|abs != 1 %}s{% endif %} below recommended minimum of 50 degrees
        fahrenheit.{% endif %} {% if temp >= 90 %} The temperature is {{ (90 -
        temp)|abs }} degree{% if (90 - temp)|abs != 1 %}s{% endif %} above
        recommended maximum of 90 degrees fahrenheit.{% endif %} {% if humid >=
        65 %} The humidity is {{ (65 - humid)|abs }} percent above recommended
        maximum of 65 percent.{% endif %} {% if humid < 65 %} The humidity is {{
        (65 - humid)|abs }} percent below recommended maximum of 65 percent.{%
        endif %} {% endif %}