ESPHome-Devices/devices/garage_fridge.yaml
ChNussbaum 13f3977342 Everything uses packages
Finish folder re-org
README updates
2020-10-07 17:21:38 -05:00

106 lines
2.9 KiB
YAML

substitutions:
device_id: garage_fridge
device_name: Garage Fridge
platform: ESP8266
board: nodemcuv2
ip_address: !secret garage_fridge_ip
ota_pwd: !secret garage_fridge_ota_pwd
api_pwd: !secret garage_fridge_api_pwd
ap_wifi_pwd: !secret garage_fridge_ap_wifi_pwd
packages:
device_base: !include ../packages/device_base.yaml
binary_sensor:
- platform: template
id: fridge_heater
name: "Garage Fridge Heater"
lambda: return id(fridge_heater_switch).state;
- platform: template
id: compressor_heater
name: "Garage Fridge Compressor Heater"
lambda: return id(compressor_heater_switch).state;
dallas:
- pin: D2
script:
- id: fridge_heater_control
then:
- lambda: |-
if (!id(fridge_heater_switch).state) {
if (id(fridge_temp_avg).state < 33.5) {
id(fridge_heater_switch).turn_on();
} else if (id(freezer_temp).state > 22 && id(fridge_temp).state < 36) {
id(fridge_heater_switch).turn_on();
}
} else if (id(fridge_heater_switch).state) {
if (id(fridge_temp_avg).state > 34 && id(freezer_temp).state < 20) {
id(fridge_heater_switch).turn_off();
}
else if (id(fridge_temp_avg).state > 38) {
id(fridge_heater_switch).turn_off();
}
}
sensor:
- platform: dallas
id: fridge_temp
name: "Garage Fridge Temperature"
unit_of_measurement: "°F"
accuracy_decimals: 1
address: 0x6E01142F5AA82D28
filters:
- lambda: return x * (9.0/5.0) + 32.0;
- platform: dallas
id: freezer_temp
name: "Garage Freezer Temperature"
unit_of_measurement: "°F"
accuracy_decimals: 1
address: 0xEF01142F57328028
filters:
- lambda: return x * (9.0/5.0) + 32.0;
on_value:
then:
- script.execute: fridge_heater_control
- platform: dallas
id: comp_temp
name: "Garage Fridge Compressor Temperature"
unit_of_measurement: "°F"
accuracy_decimals: 1
address: 0x3F02099245F52528
filters:
- lambda: return x * (9.0/5.0) + 32.0;
on_value:
then:
- lambda: |-
if (x < 43 && !id(compressor_heater_switch).state) {
id(compressor_heater_switch).turn_on();
} else if (x > 45 && id(compressor_heater_switch).state) {
id(compressor_heater_switch).turn_off();
}
- platform: template
id: fridge_temp_avg
name: "Garage Fridge Rolling Average Temperature"
unit_of_measurement: "°F"
accuracy_decimals: 1
update_interval: 15s
lambda: return id(fridge_temp).state;
filters:
- sliding_window_moving_average:
window_size: 60
send_every: 1
on_value:
then:
- script.execute: fridge_heater_control
switch:
- platform: gpio
id: fridge_heater_switch
pin: D0
inverted: true
- platform: gpio
id: compressor_heater_switch
pin: D1
inverted: true