Move to _data along with some misc clean-up.

This commit is contained in:
2022-04-03 09:29:13 -07:00
parent 1df0987e67
commit 042c9d6108
19 changed files with 259 additions and 30 deletions

51
_data/downlight_1.yaml Normal file
View File

@@ -0,0 +1,51 @@
esphome:
name: downlight01
platform: ESP8266
board: esp01_1m
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
my9231:
data_pin: GPIO13
clock_pin: GPIO15
num_channels: 4
num_chips: 1
output:
- platform: esp8266_pwm
pin: 14
id: output_blue
- platform: esp8266_pwm
pin: 12
id: output_green
- platform: esp8266_pwm
pin: 4
id: output_red
- platform: esp8266_pwm
pin: 5
id: output_coldwhite
- platform: esp8266_pwm
pin: 13
id: output_warmwhite
light:
- platform: rgbww
name: '${device_name} Light'
default_transition_length: 0s
red: output_red
green: output_green
blue: output_blue
cold_white: output_coldwhite
warm_white: output_warmwhite
cold_white_color_temperature: 6500 K
warm_white_color_temperature: 2700 K

54
_data/fountain_1.yaml Normal file
View File

@@ -0,0 +1,54 @@
esphome:
name: fountain_1
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.64
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "Fountain 1 button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "Fountain 1 relay"
pin: GPIO14
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
sensor:
- platform: wifi_signal
name: "Fountain 1 WiFi signal"
update_interval: 60s
- platform: uptime
name: "Fountain 1 uptime"
text_sensor:
- platform: version
name: "Fountain 1 ESPHome version"

View File

@@ -0,0 +1,55 @@
esphome:
name: fountain_1_light
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.66
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "Fountain 1 Light button"
on_press:
- switch.toggle: relay
switch:
- platform: gpio
name: "Fountain 1 Light relay"
pin: GPIO14
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
sensor:
- platform: wifi_signal
name: "Fountain 1 Light WiFi signal"
update_interval: 60s
- platform: uptime
name: "Fountain 1 Light uptime"
text_sensor:
- platform: version
name: "Fountain 1 Light ESPHome version"

143
_data/fountain_outside.yaml Normal file
View File

@@ -0,0 +1,143 @@
substitutions:
device_name: fountain_outside
device_description: Energy Monitoring Smart Plug with button, blue LED, and red LED.
friendly_name: Fountain Outside
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.72
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# Enable web server
# web_server:
# port: 80
# Enable time component for use by daily power sensor
time:
- platform: homeassistant
id: homeassistant_time
binary_sensor:
- platform: gpio
pin:
number: GPIO1
mode: INPUT_PULLUP
inverted: True
name: ${friendly_name} button
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Clicked"
- switch.toggle: relay2
- timing:
- ON for 1s to 2s
- OFF for at least 0.5s
then:
- logger.log: "Single Long Clicked"
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Short Clicked"
- switch.toggle: relay1
switch:
- platform: gpio
name: ${friendly_name} relay
pin: GPIO12
id: relay1
- platform: gpio
name: ${friendly_name} Light relay
pin: GPIO14
id: relay2
status_led:
pin:
number: GPIO3
# inverted: yes
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi signal
update_interval: 60s
- platform: uptime
name: ${friendly_name} uptime
# Reports the Current, Voltage, and Power used by the plugged-in device (not counting this plug's own usage of about 0.7W/0.02A, so subtract those when calibrating with this plugged into a Kill-A-Watt type meter)
- platform: hlw8012
sel_pin:
number: GPIO13
inverted: True
cf_pin: GPIO4
cf1_pin: GPIO5
current_resistor: 0.001 #The value of the shunt resistor for current measurement. Defaults to the Sonoff POWs value 0.001 ohm. Verified on https://fccid.io/2AKBP-X10S/Internal-Photos/X10S-Int-photo-4308983 that we use "R001" = 0.001 ohm
voltage_divider: 2351 #The value of the voltage divider on the board as (R_upstream + R_downstream) / R_downstream. Defaults to the Sonoff POWs value 2351. From the pic we use 2x "125" = 2x 1.2Mohm for R_upstream and "102" = 1kohm for R_downstream, so (1,200,000+1,200,000+1,000)/1,000 = 2401
# but those don't fix the measurement values, probably because we actually have a BL0937 chip instead of a HLW8012, (and part variance aswell) so we have to manually calibrate with a known load or a load and a Kill-A-Watt type meter. My values used below will only be +/-10% of yours I think.
# The comments about the voltage divider were taken from the AWP04L template. I was unable to verify the voltage divider in the Aoycocr X10S plug.
power:
name: ${friendly_name} Power
unit_of_measurement: W
id: wattage
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power
- 1379.1 -> 200.0 # Tested outdoor fountain pump via Kill-A-Watt
- 2816.9 -> 411.0 # Tested blow-dryer low via Kill-A-Watt
- 9250.6 -> 1341.0 # Tested water boiler via Kill-A-Watt
- 10736.7 -> 1562.0 # Tested blow-dryer high via Kill-A-Watt
current:
name: ${friendly_name} Current
unit_of_measurement: A
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.0 -> 0.0 #Need to keep 0 mapped to 0 for when connected device is not drawing any power
- 2.07 -> 1.67 # Tested outdoor fountain pump via Kill-A-Watt
- 4.18 -> 3.41 # Tested blow-dryer low via Kill-A-Watt
- 14.37 -> 11.64 # Tested water boiler via Kill-A-Watt
- 16.26 -> 13.12 # Tested blow-dryer high via Kill-A-Watt
voltage:
name: ${friendly_name} Voltage
unit_of_measurement: V
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 0.0 -> 0.0
- 355.9 -> 120.6 #Tested using a Kill-A-Watt meter, value while connected LED bulb was on
# change_mode_every: 3 # 1 - Skips first reading after each change, so this will double the update interval. Default 8
# update_interval: 3s # 10s - 20 second effective update rate for Power, 40 second for Current and Voltage. Default 60s
# Reports the total Power so-far each day, resets at midnight, see https://esphome.io/components/sensor/total_daily_energy.html
- platform: total_daily_energy
name: ${friendly_name} Total Daily Energy
power_id: wattage
filters:
- multiply: 0.001 ## convert Wh to kWh
unit_of_measurement: kWh
text_sensor:
- platform: version
name: "Fountain 1 ESPHome version"

View File

@@ -0,0 +1,83 @@
substitutions:
device_name: "pj_3_duct_fan_pwr"
friendly_name: "Prj 3 Duct Fan Pwr"
esphome:
name: pj_3_duct_fan_pwr
platform: ESP8266
board: esp01_1m
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
fast_connect: true
manual_ip:
static_ip: 192.168.35.240
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pj 3 Duct Fan Pwr"
password: "ImgAxoEGSc90"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
binary_sensor:
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: "${friendly_name} Button"
id: "${device_name}_button"
on_press:
- switch.toggle: "${device_name}_relay"
- platform: status
name: "${friendly_name} Status"
id: "${device_name}_status"
switch:
- platform: gpio
name: "${friendly_name} Relay"
id: "${device_name}_relay"
pin: GPIO14
on_turn_on:
- output.turn_on: led
on_turn_off:
- output.turn_off: led
status_led:
pin:
number: GPIO12
inverted: yes
output:
- platform: gpio
pin: GPIO13
inverted: true
id: led
sensor:
- platform: wifi_signal
name: "${friendly_name} WiFi signal"
id: "${device_name}_wifi_signal"
update_interval: 60s
- platform: uptime
name: "${friendly_name} Uptime"
id: "${device_name}_uptime"
update_interval: 60s
text_sensor:
- platform: version
name: "${friendly_name} ESPHome Version"
id: "${device_name}_esphome_version"

215
_data/projector_3.yaml Normal file
View File

@@ -0,0 +1,215 @@
substitutions:
duct_fan_pin: GPIO14
duct_fan_spd_name: Prj3 Duct Fan Speed
duct_fan_target_spd_in_name: Prj3 Duct Fan Target Speed In
duct_fan_target_spd_prj_name: Prj3 Duct Fan Target Speed Prj
duct_fan_target_spd_out_name: Prj3 Duct Fan Target Speed Out
duct_fan_pwmfreq: 5000Hz
duct_fan_off_spd: "0.0"
duct_fan_lo_spd: "1.0"
duct_fan_vent_spd: "50.0"
duct_fan_hi_spd: "100.0"
prjpwr_pin: GPIO19
prjpwr_name: Prj3 Pwr
dallas_pin: GPIO32
dallas_in_addr: "0x1F3C01D0756F0928"
dallas_in_name: Prj3 Temp In
dallas_prj_addr: "0x873C01D0756D4B28"
dallas_prj_name: Prj3 Temp Prj
dallas_out_addr: "0xA901143295610E28"
dallas_out_name: Prj3 Temp Out
dallas_update_interval: 30s
globals:
- id: duct_fan_off_spd
type: float
initial_value: ${duct_fan_off_spd}
- id: duct_fan_lo_spd
type: float
initial_value: ${duct_fan_lo_spd}
- id: duct_fan_vent_spd
type: float
initial_value: ${duct_fan_vent_spd}
- id: duct_fan_hi_spd
type: float
initial_value: ${duct_fan_hi_spd}
esphome:
name: prj3
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: "kungle-oss"
password: "hcfU8@gG&8Hm"
fast_connect: true
manual_ip:
static_ip: 192.168.35.192
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Prj3 Fallback Hotspot"
password: "xfPfYSP3N0C3"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
switch:
- platform: template
name: Thermostat On
id: thermostat_on_id
optimistic: true
output:
- platform: ledc
pin: ${duct_fan_pin}
id: duct_fan_output_id
frequency: ${duct_fan_pwmfreq}
fan:
- platform: speed
id: duct_fan_spd_id
output: duct_fan_output_id
name: ${duct_fan_spd_name}
dallas:
- pin:
number: ${dallas_pin}
mode: INPUT_PULLUP
update_interval: ${dallas_update_interval}
sensor:
- platform: dallas
address: ${dallas_in_addr}
name: ${dallas_in_name}
id: dallas_in_id
- platform: dallas
address: ${dallas_prj_addr}
name: ${dallas_prj_name}
id: dallas_prj_id
- platform: dallas
address: ${dallas_out_addr}
name: ${dallas_out_name}
id: dallas_out_id
binary_sensor:
- platform: gpio
pin: ${prjpwr_pin}
name: ${prjpwr_name}
device_class: power
- platform: homeassistant
name: "Ventilate House"
entity_id: input_boolean.ventilate_house
id: ventilate_house
number:
- platform: template
id: duct_fan_target_spd_in
name: ${duct_fan_target_spd_in_name}
optimistic: true
min_value: ${duct_fan_lo_spd}
max_value: ${duct_fan_hi_spd}
step: 1
- platform: template
id: duct_fan_target_spd_prj
name: ${duct_fan_target_spd_prj_name}
min_value: ${duct_fan_off_spd}
max_value: ${duct_fan_hi_spd}
step: 1
set_action:
then:
lambda: |-
float lo_temp;
float hi_temp;
float curtemp;
float off_spd;
float lo_spd;
float vent_spd;
float hi_spd;
float newspd;
lo_temp = id(thermostat_prj_id).target_temperature_low;
hi_temp = id(thermostat_prj_id).target_temperature_high;
curtemp = id(dallas_prj_id).state;
off_spd = id(duct_fan_off_spd);
lo_spd = id(duct_fan_lo_spd);
vent_spd = id(duct_fan_vent_spd);
hi_spd = id(duct_fan_hi_spd);
ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state);
ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp);
ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state);
if ((id(ventilate_house).state == false) &&
((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) {
ESP_LOGD("fan_speed", "DEBUG turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
if (curtemp > hi_temp) {
ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp");
newspd = hi_spd;
} else {
// Set newspd to same linear proportion of spd range as current temp is of temp range
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
ESP_LOGD("fan_speed", "DEBUG New Speed set: %f", newspd);
}
if ((id(ventilate_house).state == true) && (newspd < vent_spd)) {
newspd = vent_spd;
ESP_LOGD("fan_speed", "DEBUG New Speed changed to Vent Speed: %f", newspd);
}
if (newspd < lo_spd) {
ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd);
auto call = id(duct_fan_spd_id).turn_on();
call.set_speed(newspd);
call.perform();
return newspd;
- platform: template
id: duct_fan_target_spd_out
name: ${duct_fan_target_spd_out_name}
optimistic: true
min_value: ${duct_fan_off_spd}
max_value: ${duct_fan_hi_spd}
step: 1
# Dual-point thermostat
climate:
- platform: thermostat
id: thermostat_prj_id
name: Prj3 Prj
sensor: dallas_prj_id
visual:
min_temperature: 60 °F
max_temperature: 160 °F
temperature_step: 1
default_mode: auto
default_target_temperature_low: 78 °F
default_target_temperature_high: 160 °F
min_cooling_off_time: 60s
min_cooling_run_time: 60s
min_heating_off_time: 60s
min_heating_run_time: 60s
min_idle_time: 60s
heat_action:
- logger.log: "Turning off Prj3 Thermostat"
- switch.turn_off: thermostat_on_id
idle_action:
- logger.log: "Turning on Prj3 Thermostat"
- switch.turn_on: thermostat_on_id
cool_action:
- logger.log: "WARNING: Prj3 Thermostat has hit high temp!"
- switch.turn_on: thermostat_on_id
#TODO - provide some kind of warning / action here

224
_data/rack_2.yaml Normal file
View File

@@ -0,0 +1,224 @@
substitutions:
duct_fan_pin: GPIO13
duct_fan_name: R2 Duct Fan Spd
duct_fan_tgt_spd_in_name: R2 DF Tgt Spd In
duct_fan_tgt_spd_out_name: R2 DF Tgt Spd Out
duct_fan_pwmfreq: 5000Hz
duct_fan_off_spd: "0.0"
duct_fan_lo_spd: "1.0"
duct_fan_vent_spd: "50.0"
duct_fan_hi_spd: "100.0"
wall_fan_pwr_pin: GPIO21
wall_fan_pwr_name: Rack 2 Wall Fan Power
wall_fan_spd_pin: GPIO22
wall_fan_spd_pwmfreq: 25000Hz
wall_fan_spd_name: Rack 2 Wall Fan Speed
wall_fan_tach_pin: GPIO23
wall_fan_tach_id: wall_fan_tach_id
wall_fan_tach_name: Rack 2 Wall Fan Tach
dallas_pin: GPIO32
dallas_in_addr: "0x1D02131D6063AA28"
dallas_in_name: Rack 2 Temp In
dallas_out_addr: "0x1D01143296570128"
dallas_out_name: Rack 2 Temp Out
dallas_update_interval: 30s
globals:
- id: duct_fan_off_spd
type: float
initial_value: ${duct_fan_off_spd}
- id: duct_fan_lo_spd
type: float
initial_value: ${duct_fan_lo_spd}
- id: duct_fan_vent_spd
type: float
initial_value: ${duct_fan_vent_spd}
- id: duct_fan_hi_spd
type: float
initial_value: ${duct_fan_hi_spd}
esphome:
name: rack_2
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: "kungle-ot"
password: "ThingsWelcomeToKungle"
manual_ip:
static_ip: 192.168.37.76
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Server 2 Fallback Hotspot"
password: "kRzC55vFjigT"
captive_portal:
# Enable logging
logger:
level: DEBUG
# Enable Home Assistant API
api:
ota:
switch:
- platform: gpio
pin: ${wall_fan_pwr_pin}
name: ${wall_fan_pwr_name}
- platform: template
name: Thermostat On
id: thermostat_on_id
optimistic: true
output:
- platform: ledc
pin: ${duct_fan_pin}
id: duct_fan_output_id
channel: 0
frequency: ${duct_fan_pwmfreq}
- platform: ledc
pin: ${wall_fan_spd_pin}
id: wall_fan_spd_id
channel: 2
frequency: ${wall_fan_spd_pwmfreq}
fan:
- platform: speed
id: duct_fan_spd_id
output: duct_fan_output_id
name: ${duct_fan_name}
- platform: speed
output: wall_fan_spd_id
name: ${wall_fan_spd_name}
dallas:
- pin:
number: ${dallas_pin}
mode: INPUT_PULLUP
update_interval: ${dallas_update_interval}
sensor:
- platform: pulse_counter
pin:
number: ${wall_fan_tach_pin}
mode: INPUT_PULLUP
unit_of_measurement: 'RPM'
name: ${wall_fan_tach_name}
update_interval: 10s
filters:
- multiply: 0.5
- platform: dallas
address: ${dallas_in_addr}
name: ${dallas_in_name}
- platform: dallas
address: ${dallas_out_addr}
name: ${dallas_out_name}
id: dallas_out_id
binary_sensor:
- platform: homeassistant
name: "Ventilate House"
entity_id: input_boolean.ventilate_house
id: ventilate_house
number:
- platform: template
id: duct_fan_tgt_spd_in
name: ${duct_fan_tgt_spd_in_name}
optimistic: true
min_value: ${duct_fan_lo_spd}
max_value: ${duct_fan_hi_spd}
step: 1
- platform: template
id: duct_fan_tgt_spd_out
name: ${duct_fan_tgt_spd_out_name}
min_value: ${duct_fan_off_spd}
max_value: ${duct_fan_hi_spd}
step: 1
set_action:
then:
lambda: |-
float lo_temp;
float hi_temp;
float curtemp;
float off_spd;
float lo_spd;
float vent_spd;
float hi_spd;
float newspd;
lo_temp = id(thermostat_out_id).target_temperature_low;
hi_temp = id(thermostat_out_id).target_temperature_high;
curtemp = id(dallas_out_id).state;
off_spd = id(duct_fan_off_spd);
lo_spd = id(duct_fan_lo_spd);
vent_spd = id(duct_fan_vent_spd);
hi_spd = id(duct_fan_hi_spd);
ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state);
ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp);
ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state);
if ((id(ventilate_house).state == false) &&
((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) {
ESP_LOGD("fan_speed", "DEBUG turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
if (curtemp > hi_temp) {
ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp");
newspd = hi_spd;
} else {
// Set newspd to same linear proportion of spd range as current temp is of temp range
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
ESP_LOGD("fan_speed", "DEBUG New Speed set: %f", newspd);
}
if ((id(ventilate_house).state == true) && (newspd < vent_spd)) {
newspd = vent_spd;
ESP_LOGD("fan_speed", "DEBUG New Speed changed to Vent Speed: %f", newspd);
}
if (newspd < lo_spd) {
ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd);
auto call = id(duct_fan_spd_id).turn_on();
call.set_speed(newspd);
call.perform();
return newspd;
# Dual-point thermostat
climate:
- platform: thermostat
id: thermostat_out_id
name: Rack2 Out
sensor: dallas_out_id
visual:
min_temperature: 60 °F
max_temperature: 100 °F
temperature_step: 1
default_mode: auto
default_target_temperature_low: 75 °F
default_target_temperature_high: 100 °F
min_cooling_off_time: 60s
min_cooling_run_time: 60s
min_heating_off_time: 60s
min_heating_run_time: 60s
min_idle_time: 60s
heat_action:
- logger.log: "Turning off Rack2 Thermostat"
- switch.turn_off: thermostat_on_id
idle_action:
- logger.log: "Turning on Rack2 Thermostat"
- switch.turn_on: thermostat_on_id
cool_action:
- logger.log: "WARNING: Rack2 Thermostat has hit high temp!"
- switch.turn_on: thermostat_on_id
#TODO - provide some kind of warning / action here

View File

@@ -0,0 +1,55 @@
esphome:
name: rack_2_duct_fan_pwr
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.70
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# binary_sensor:
# - platform: gpio
# pin:
# number: GPIO4
# mode: INPUT_PULLUP
# inverted: True
# name: "Rack 2 Duct Fan Power Button"
# on_press:
# - switch.toggle: relay
switch:
- platform: gpio
name: "Rack 2 Duct Fan Power Relay"
pin: GPIO14
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
# sensor:
# - platform: wifi_signal
# name: "Rack 2 Duct Fan Power WiFi Signal"
# update_interval: 60s
# - platform: uptime
# name: "Rack 2 Duct Fan Power uptime"
# text_sensor:
# - platform: version
# name: "Rack 2 Duct Fan Power ESPHome Version"

211
_data/rack_3.yaml Normal file
View File

@@ -0,0 +1,211 @@
substitutions:
duct_fan_pin: GPIO13
duct_fan_name: R3 Duct Fan Spd
duct_fan_tgt_spd_in_name: Rack 3 Duct Fan Target Spd In
duct_fan_tgt_spd_out_name: Rack 3 Duct Fan Target Spd Out
duct_fan_pwmfreq: 5000Hz
duct_fan_off_spd: "0.0"
duct_fan_lo_spd: "1.0"
duct_fan_vent_spd: "50.0"
duct_fan_amppwr_on_lo_spd: "20.0"
duct_fan_hi_spd: "100.0"
amppwr_pin: GPIO19
amppwr_name: "Denon Pwr"
dallas_pin: GPIO32
dallas_in_addr: "0x7F0114328974D728"
dallas_in_name: Rack 3 Temp In
dallas_out_addr: "0xB801143296ED7B28"
dallas_out_name: Rack 3 Temp Out
dallas_update_interval: 30s
globals:
- id: duct_fan_off_spd_id
type: float
initial_value: ${duct_fan_off_spd}
- id: duct_fan_lo_spd_id
type: float
initial_value: ${duct_fan_lo_spd}
- id: duct_fan_amppwr_on_lo_spd_id
type: float
initial_value: ${duct_fan_amppwr_on_lo_spd}
- id: duct_fan_vent_spd
type: float
initial_value: ${duct_fan_vent_spd}
- id: duct_fan_hi_spd_id
type: float
initial_value: ${duct_fan_hi_spd}
esphome:
name: rack_3
platform: ESP32
board: esp32doit-devkit-v1
wifi:
ssid: "kungle-ot"
password: "ThingsWelcomeToKungle"
manual_ip:
static_ip: 192.168.37.74
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rack 3 Fallback Hotspot"
password: "jj0CXEgu3Lzo"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
switch:
- platform: template
name: Thermostat On
id: thermostat_on_id
optimistic: true
output:
- platform: ledc
pin: ${duct_fan_pin}
id: duct_fan_output_id
frequency: ${duct_fan_pwmfreq}
fan:
- platform: speed
id: duct_fan_spd_id
output: duct_fan_output_id
name: ${duct_fan_name}
dallas:
- pin:
number: ${dallas_pin}
mode: INPUT_PULLUP
update_interval: ${dallas_update_interval}
sensor:
- platform: dallas
address: ${dallas_in_addr}
name: ${dallas_in_name}
- platform: dallas
address: ${dallas_out_addr}
name: ${dallas_out_name}
id: dallas_out_id
binary_sensor:
- platform: gpio
id: amppwr_id
pin: ${amppwr_pin}
name: ${amppwr_name}
device_class: power
- platform: homeassistant
name: "Ventilate House"
entity_id: input_boolean.ventilate_house
id: ventilate_house
number:
- platform: template
id: duct_fan_tgt_spd_in_id
name: ${duct_fan_tgt_spd_in_name}
optimistic: true
min_value: ${duct_fan_lo_spd}
max_value: ${duct_fan_hi_spd}
step: 1
- platform: template
id: duct_fan_tgt_spd_out_id
name: ${duct_fan_tgt_spd_out_name}
min_value: ${duct_fan_lo_spd}
max_value: ${duct_fan_hi_spd}
step: 1
set_action:
then:
lambda: |-
float lo_temp;
float hi_temp;
float curtemp;
float off_spd;
float lo_spd;
float vent_spd;
float hi_spd;
float newspd;
lo_temp = id(thermostat_out_id).target_temperature_low;
hi_temp = id(thermostat_out_id).target_temperature_high;
curtemp = id(dallas_out_id).state;
off_spd = id(duct_fan_off_spd_id);
lo_spd = id(duct_fan_lo_spd_id);
vent_spd = id(duct_fan_vent_spd);
hi_spd = id(duct_fan_hi_spd_id);
ESP_LOGD("fan_speed", "DEBUG Ventilate House: %d", id(ventilate_house).state);
ESP_LOGD("fan_speed", "DEBUG Amp Power: %d", id(amppwr_id).state);
ESP_LOGD("fan_speed", "DEBUG Current Temp: %f", curtemp);
ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state);
if (id(amppwr_id).state == true) {
// Amp is on, use that lo speed.
lo_spd = id(duct_fan_amppwr_on_lo_spd_id);
} else if ((id(ventilate_house).state == false) &&
((curtemp < lo_temp) || (id(thermostat_on_id).state == false))) {
// Amp is off and temp is lo or thermostat is off. Turn the fan off.
ESP_LOGD("fan_speed", "DEBUG turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
if (curtemp > hi_temp) {
ESP_LOGD("fan_speed", "DEBUG curtemp > hi_temp");
newspd = hi_spd;
} else if (curtemp < lo_temp) {
newspd = lo_spd;
} else {
// Set newspd to same linear proportion of spd range as current temp is of temp range
newspd = lo_spd + ((hi_spd - lo_spd) * (curtemp - lo_temp) / (hi_temp - lo_temp));
ESP_LOGD("fan_speed", "DEBUG New Speed set: %f", newspd);
}
if ((id(ventilate_house).state == true) && (newspd < vent_spd)) {
newspd = vent_spd;
ESP_LOGD("fan_speed", "DEBUG New Speed changed to Vent Speed: %f", newspd);
}
if (newspd < lo_spd) {
ESP_LOGD("fan_speed", "DEBUG New Speed under lo_spd, turning off");
auto call = id(duct_fan_spd_id).turn_off();
call.perform();
return off_spd;
}
ESP_LOGD("fan_speed", "DEBUG Setting fan to newspd: %f", newspd);
auto call = id(duct_fan_spd_id).turn_on();
call.set_speed(newspd);
call.perform();
return newspd;
# Dual-point thermostat
climate:
- platform: thermostat
id: thermostat_out_id
name: Rack3 Out
sensor: dallas_out_id
visual:
min_temperature: 60 °F
max_temperature: 100 °F
temperature_step: 1
default_mode: auto
default_target_temperature_low: 75 °F
default_target_temperature_high: 100 °F
min_cooling_off_time: 60s
min_cooling_run_time: 60s
min_heating_off_time: 60s
min_heating_run_time: 60s
min_idle_time: 60s
heat_action:
- logger.log: "Turning off Rack3 Thermostat"
- switch.turn_off: thermostat_on_id
idle_action:
- logger.log: "Turning on Rack3 Thermostat"
- switch.turn_on: thermostat_on_id
cool_action:
- logger.log: "WARNING: Rack3 Thermostat has hit high temp!"
- switch.turn_on: thermostat_on_id
#TODO - provide some kind of warning / action here

View File

@@ -0,0 +1,55 @@
esphome:
name: rack_3_duct_fan_pwr
platform: ESP8266
board: esp01_1m
wifi:
ssid: kungle-ot
password: ThingsWelcomeToKungle
manual_ip:
static_ip: 192.168.37.68
gateway: 192.168.37.1
subnet: 255.255.255.0
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# binary_sensor:
# - platform: gpio
# pin:
# number: GPIO4
# mode: INPUT_PULLUP
# inverted: True
# name: "Rack 3 Duct Fan Power Button"
# on_press:
# - switch.toggle: relay
switch:
- platform: gpio
name: "Rack 3 Duct Fan Power Relay"
pin: GPIO14
id: relay
status_led:
pin:
number: GPIO12
inverted: yes
# sensor:
# - platform: wifi_signal
# name: "Rack 3 Duct Fan Power WiFi Signal"
# update_interval: 60s
# - platform: uptime
# name: "Rack 3 Duct Fan Power uptime"
# text_sensor:
# - platform: version
# name: "Rack 3 Duct Fan Power ESPHome Version"

48
_data/weather-in-1.yaml Normal file
View File

@@ -0,0 +1,48 @@
esphome:
name: weather-in-1
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "38fdad38872738fe7c08f77643ed5d56"
wifi:
ssid: !secret wifi_oss_ssid
password: !secret wifi_oss_password
manual_ip:
static_ip: 192.168.35.246
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Weather-Out-S Fallback Hotspot"
password: "0xINHxW0IbSK"
captive_portal:
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
sensor:
- platform: bme280
temperature:
name: "TempIn1"
oversampling: 16x
pressure:
name: "PressIn1"
humidity:
name: "HumidityIn1"
address: 0x76
update_interval: 60s

48
_data/weather-out-n.yaml Normal file
View File

@@ -0,0 +1,48 @@
esphome:
name: weather-out-n
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "38fdad38872738fe7c08f77643ed5d56"
wifi:
ssid: !secret wifi_oss_ssid
password: !secret wifi_oss_password
manual_ip:
static_ip: 192.168.35.244
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Weather-Out-S Fallback Hotspot"
password: "0xINHxW0IbSK"
captive_portal:
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
sensor:
- platform: bme280
temperature:
name: "TempOutN"
oversampling: 16x
pressure:
name: "PressOutN"
humidity:
name: "HumidityOutN"
address: 0x76
update_interval: 60s

48
_data/weather-out-s.yaml Normal file
View File

@@ -0,0 +1,48 @@
esphome:
name: weather-out-s
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
# password: "38fdad38872738fe7c08f77643ed5d56"
wifi:
ssid: !secret wifi_oss_ssid
password: !secret wifi_oss_password
manual_ip:
static_ip: 192.168.35.242
gateway: 192.168.35.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Weather-Out-S Fallback Hotspot"
password: "0xINHxW0IbSK"
captive_portal:
i2c:
sda: 4
scl: 5
scan: true
id: bus_a
sensor:
- platform: bme280
temperature:
name: "TempOutS"
oversampling: 16x
pressure:
name: "PressOutS"
humidity:
name: "HumidityOutS"
address: 0x76
update_interval: 60s