Compare commits
3 commits
e6df71f10b
...
4c9a8aede1
Author | SHA1 | Date | |
---|---|---|---|
4c9a8aede1 | |||
a51de212db | |||
9b1314a1e9 |
2 changed files with 23 additions and 20 deletions
|
@ -2,6 +2,15 @@
|
||||||
//
|
//
|
||||||
// Example:
|
// 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",
|
"label": "esphome run wifi",
|
||||||
"command": "podman run --rm -it -v .:/config ghcr.io/esphome/esphome run dewpoint.yaml",
|
"command": "podman run --rm -it -v .:/config ghcr.io/esphome/esphome run dewpoint.yaml",
|
||||||
|
|
|
@ -21,6 +21,7 @@ ota:
|
||||||
wifi:
|
wifi:
|
||||||
ssid: !secret wifi_ssid
|
ssid: !secret wifi_ssid
|
||||||
password: !secret wifi_password
|
password: !secret wifi_password
|
||||||
|
use_address: dewpointfan.fd
|
||||||
|
|
||||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
ap:
|
ap:
|
||||||
|
@ -71,35 +72,28 @@ sensor:
|
||||||
update_interval: 10s
|
update_interval: 10s
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Inner Dew Point"
|
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
|
unit_of_measurement: °C
|
||||||
id: inner_dew_point
|
id: inner_dew_point
|
||||||
update_interval: 30s
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Outer Dew Point"
|
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
|
unit_of_measurement: °C
|
||||||
id: outer_dew_point
|
id: outer_dew_point
|
||||||
update_interval: 30s
|
|
||||||
icon: "mdi:thermometer-water"
|
|
||||||
- platform: template
|
- platform: template
|
||||||
id: fan_state_temp
|
id: fan_state_temp
|
||||||
name: "Fan state"
|
name: "Fan state"
|
||||||
lambda: |-
|
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;
|
uint8_t fan_state = id(fan_state_temp).state;
|
||||||
float deltadp = id(inner_dew_point).state - id(outer_dew_point).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;
|
||||||
if (deltadp > 6.0) {
|
if (deltadp > 6.0) {
|
||||||
fan_state = 1;
|
fan_state = 1;
|
||||||
}
|
}
|
||||||
|
@ -122,8 +116,8 @@ sensor:
|
||||||
root["inner_humidity"] = id(inner_humidity).state;
|
root["inner_humidity"] = id(inner_humidity).state;
|
||||||
root["outer_temp"] = id(outer_temperature).state;
|
root["outer_temp"] = id(outer_temperature).state;
|
||||||
root["outer_humidity"] = id(outer_humidity).state;
|
root["outer_humidity"] = id(outer_humidity).state;
|
||||||
root["inner_dewpoint"] = id(inner_dew_point).state;
|
root["inner_dewpoint"] = inner_dewpoint;
|
||||||
root["outer_dewpoint"] = id(outer_dew_point).state;
|
root["outer_dewpoint"] = outer_dewpoint;
|
||||||
root["fan_state"] = id(fan_relay).state;
|
root["fan_state"] = id(fan_relay).state;
|
||||||
});
|
});
|
||||||
return fan_state;
|
return fan_state;
|
||||||
|
|
Loading…
Add table
Reference in a new issue