Compare commits

..

No commits in common. "4c9a8aede1c0b030db48fd8bd3dace8f09db8d03" and "e6df71f10b100c802f9ca6c72b256338bd464baf" have entirely different histories.

2 changed files with 20 additions and 23 deletions

View file

@ -2,15 +2,6 @@
//
// Example:
[
{
"label": "esphome build",
"command": "podman run --rm -it -v .:/config ghcr.io/esphome/esphome compile dewpoint.yaml",
"use_new_terminal": false,
"allow_concurrent_runs": false,
"reveal": "always",
"hide": "never",
"shell": "system"
},
{
"label": "esphome run wifi",
"command": "podman run --rm -it -v .:/config ghcr.io/esphome/esphome run dewpoint.yaml",

View file

@ -21,7 +21,6 @@ ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: dewpointfan.fd
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
@ -72,28 +71,35 @@ sensor:
update_interval: 10s
- platform: template
name: "Inner Dew Point"
lambda: |-
float A = 17.27;
float B = 237.7;
float temp = id(inner_temperature).state;
float humidity = id(inner_humidity).state;
float alpha = ((A * temp) / (B + temp)) + log(humidity / 100.0);
return (B * alpha) / (A - alpha);
unit_of_measurement: °C
id: inner_dew_point
update_interval: 30s
- platform: template
name: "Outer Dew Point"
lambda: |-
float A = 17.27;
float B = 237.7;
float temp = id(outer_temperature).state;
float humidity = id(outer_humidity).state;
float alpha = ((A * temp) / (B + temp)) + log(humidity / 100.0);
return (B * alpha) / (A - alpha);
unit_of_measurement: °C
id: outer_dew_point
update_interval: 30s
icon: "mdi:thermometer-water"
- platform: template
id: fan_state_temp
name: "Fan state"
lambda: |-
auto calc_dewpoint = [](float temp, float humidity) {
float A = 17.27;
float B = 237.7;
float alpha = ((A * temp) / (B + temp)) + log(humidity / 100.0);
return (B * alpha) / (A - alpha);
};
uint8_t fan_state = id(fan_state_temp).state;
float inner_dewpoint = calc_dewpoint(id(inner_temperature).state, id(inner_humidity).state);
float outer_dewpoint = calc_dewpoint(id(outer_temperature).state, id(outer_humidity).state);
id(inner_dew_point).publish_state(inner_dewpoint);
id(outer_dew_point).publish_state(outer_dewpoint);
float deltadp = inner_dewpoint - outer_dewpoint;
float deltadp = id(inner_dew_point).state - id(outer_dew_point).state;
if (deltadp > 6.0) {
fan_state = 1;
}
@ -116,8 +122,8 @@ sensor:
root["inner_humidity"] = id(inner_humidity).state;
root["outer_temp"] = id(outer_temperature).state;
root["outer_humidity"] = id(outer_humidity).state;
root["inner_dewpoint"] = inner_dewpoint;
root["outer_dewpoint"] = outer_dewpoint;
root["inner_dewpoint"] = id(inner_dew_point).state;
root["outer_dewpoint"] = id(outer_dew_point).state;
root["fan_state"] = id(fan_relay).state;
});
return fan_state;