The core mold sensor:
uses an outdoor temperature and a calibration factor to determine the temperature of a cold spot that may be subject to condensation. This method does not work well at all.
I placed a temperature sensor outdoors and on my cold aluminium framed single glazed window. I used a template sensor to calculate the calibration factor as per the documentation. I saw widely varying values from 2 to over 15 over a number of days.
I believe the issue is thermal inertia of the window during fast outdoor temperature changes.
As I now had an actual temperature sensor on the cold object I wanted to edit the source of this sensor and develop a local variant that uses a sensor rather than calculating the critical temperature for use in the calculation.
Unfortunately I failed. I’m just not that good at Python. (Someone competent please create a PR for this!)
So instead I developed this template sensor. Instead of using
- indoor temperature and humidity sensors
- outdoor temperature sensor and a calibration factor
it uses
- indoor temperature and humidity sensors
- a temperature sensor on the cold object
There are two places in the template (state and availability) where you must enter your own entity_ids for these three sensors:
template:
- sensor:
- name: Lounge Condensation Chance
unit_of_measurement: "%"
state_class: measurement # only include this if you want long term statistics
state: >
{# ### CHANGE THESE THREE SENSORS ### #}
{% set room_temp = states('sensor.lounge_room_temperature')|float(0) %}
{% set room_humid = states('sensor.lounge_room_humidity')|float(0) %}
{% set crit_temp = states('sensor.lounge_window_temperature')|float(0) %}
{# ### -------------------------- ### #}
{% set MK2 = 17.62 %}
{% set MK3 = 243.12 %}
{% set alpha = MK2 * room_temp / ( MK3 + room_temp ) %}
{% set beta = MK2 * MK3 / ( MK3 + room_temp ) %}
{% set dewpt = MK3 * ( alpha + log( room_humid / 100 ) ) / ( beta - log( room_humid / 100 ) ) %}
{% set alpha_crit = MK2 * crit_temp / ( MK3 + crit_temp ) %}
{% set beta_crit = MK2 * MK3 / ( MK3 + crit_temp) %}
{% set crit_humidity = e ** ( ( dewpt * beta_crit - MK3 * alpha_crit) / ( dewpt + MK3) ) * 100 %}
{{ ([0,crit_humidity,100]|sort)[1] }}
availability: >
{# ### CHANGE THESE THREE SENSORS ### #}
{{ has_value('sensor.lounge_room_temperature') and
has_value('sensor.lounge_room_humidity') and
has_value('sensor.lounge_window_temperature') }}
icon: >
{% if this.state|float(0) == 0 %}
mdi:water-alert-outline
{% elif this.state|float(0) > 70 %}
mdi:water-percent-alert
{% else %}
mdi:water-check-outline
{% endif %}
How well does it work?
I don’t know yet. It is summer here and too hot for condensation to form, but it should be better than the core sensor.
It operates the same way, sensor > 70% → condensation may form on the object being monitored.