From 414acf54cba4ae0cbd9c1fe9353fda02d63c37df Mon Sep 17 00:00:00 2001 From: ChNussbaum Date: Mon, 30 Dec 2019 20:26:12 -0600 Subject: [PATCH] Add garage_fridge Add patio_lights Add Feit dimmer common files Add office_light --- .standard.yaml | 2 +- .standard_tuya_feit_dimmer.yaml | 29 +++++ coffee_maker.yaml | 2 +- common/common_tuya_feit_dimmer.yaml | 11 ++ common/light/tuya_feit_dimmer.yaml | 7 ++ common/{ => logger}/logger.yaml | 0 common/logger/logger_tuya.yaml | 3 + .../logger_tuya_no_log.yaml} | 0 common/uart/tuya_feit_dimmer.yaml | 3 + garage_fridge.yaml | 116 ++++++++++++++++++ master_bed.yaml | 2 +- office_light.yaml | 29 +++++ patio_lights.yaml | 35 ++++++ 13 files changed, 236 insertions(+), 3 deletions(-) create mode 100644 .standard_tuya_feit_dimmer.yaml create mode 100644 common/common_tuya_feit_dimmer.yaml create mode 100644 common/light/tuya_feit_dimmer.yaml rename common/{ => logger}/logger.yaml (100%) create mode 100644 common/logger/logger_tuya.yaml rename common/{logger_tuya.yaml => logger/logger_tuya_no_log.yaml} (100%) create mode 100644 common/uart/tuya_feit_dimmer.yaml create mode 100644 garage_fridge.yaml create mode 100644 office_light.yaml create mode 100644 patio_lights.yaml diff --git a/.standard.yaml b/.standard.yaml index 4741f25..6dc4b8b 100644 --- a/.standard.yaml +++ b/.standard.yaml @@ -12,7 +12,7 @@ esphome: <<: !include common/esphome.yaml <<: !include common/common.yaml -<<: !include common/logger.yaml +<<: !include common/logger/logger.yaml binary_sensor: - !include common/binary_sensor/status.yaml diff --git a/.standard_tuya_feit_dimmer.yaml b/.standard_tuya_feit_dimmer.yaml new file mode 100644 index 0000000..73f99a7 --- /dev/null +++ b/.standard_tuya_feit_dimmer.yaml @@ -0,0 +1,29 @@ +substitutions: + device_id: + device_name: + platform: ESP8266 + board: esp01_1m + ip_address: !secret _ip + ota_pwd: !secret _ota_pwd + api_pwd: !secret _api_pwd + ap_wifi_pwd: !secret _ap_wifi_pwd + +esphome: + <<: !include common/esphome.yaml + +<<: !include common/common_tuya_feit_dimmer.yaml +<<: !include common/logger/logger_tuya_no_log.yaml + +binary_sensor: + - !include common/binary_sensor/status.yaml + +sensor: + - !include common/sensor/uptime.yaml + - !include common/sensor/wifi.yaml + +switch: + - !include common/switch/restart.yaml + +text_sensor: + - !include common/text_sensor/version.yaml + - !include common/text_sensor/wifi.yaml \ No newline at end of file diff --git a/coffee_maker.yaml b/coffee_maker.yaml index 6d4dc7d..e259065 100644 --- a/coffee_maker.yaml +++ b/coffee_maker.yaml @@ -12,7 +12,7 @@ esphome: <<: !include common/esphome.yaml <<: !include common/common.yaml -<<: !include common/logger.yaml +<<: !include common/logger/logger.yaml binary_sensor: - !include common/binary_sensor/status.yaml diff --git a/common/common_tuya_feit_dimmer.yaml b/common/common_tuya_feit_dimmer.yaml new file mode 100644 index 0000000..b7e5b35 --- /dev/null +++ b/common/common_tuya_feit_dimmer.yaml @@ -0,0 +1,11 @@ +<<: !include wifi.yaml +<<: !include api.yaml +<<: !include ota.yaml + +tuya: + +uart: + - !include uart/tuya_feit_dimmer.yaml + +light: + - !include light/tuya_feit_dimmer.yaml \ No newline at end of file diff --git a/common/light/tuya_feit_dimmer.yaml b/common/light/tuya_feit_dimmer.yaml new file mode 100644 index 0000000..e170f16 --- /dev/null +++ b/common/light/tuya_feit_dimmer.yaml @@ -0,0 +1,7 @@ +platform: "tuya" +id: tuya_light +name: ${device_name} +dimmer_datapoint: 2 +switch_datapoint: 1 +min_value: 0 +max_value: 1000 diff --git a/common/logger.yaml b/common/logger/logger.yaml similarity index 100% rename from common/logger.yaml rename to common/logger/logger.yaml diff --git a/common/logger/logger_tuya.yaml b/common/logger/logger_tuya.yaml new file mode 100644 index 0000000..81bed9f --- /dev/null +++ b/common/logger/logger_tuya.yaml @@ -0,0 +1,3 @@ +logger: + level: DEBUG + baud_rate: 0 \ No newline at end of file diff --git a/common/logger_tuya.yaml b/common/logger/logger_tuya_no_log.yaml similarity index 100% rename from common/logger_tuya.yaml rename to common/logger/logger_tuya_no_log.yaml diff --git a/common/uart/tuya_feit_dimmer.yaml b/common/uart/tuya_feit_dimmer.yaml new file mode 100644 index 0000000..ad78c6f --- /dev/null +++ b/common/uart/tuya_feit_dimmer.yaml @@ -0,0 +1,3 @@ +rx_pin: GPIO3 +tx_pin: GPIO1 +baud_rate: 9600 diff --git a/garage_fridge.yaml b/garage_fridge.yaml new file mode 100644 index 0000000..03aa7eb --- /dev/null +++ b/garage_fridge.yaml @@ -0,0 +1,116 @@ +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 + +esphome: + <<: !include common/esphome.yaml + +<<: !include common/common.yaml +<<: !include common/logger/logger.yaml + +binary_sensor: + - !include common/binary_sensor/status.yaml + - 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: + - !include common/sensor/uptime.yaml + - !include common/sensor/wifi.yaml + - 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: + - !include common/switch/restart.yaml + - platform: gpio + id: fridge_heater_switch + pin: D0 + inverted: true + - platform: gpio + id: compressor_heater_switch + pin: D1 + inverted: true + +text_sensor: + - !include common/text_sensor/version.yaml + - !include common/text_sensor/wifi.yaml \ No newline at end of file diff --git a/master_bed.yaml b/master_bed.yaml index f61c43a..ff52ca4 100644 --- a/master_bed.yaml +++ b/master_bed.yaml @@ -14,7 +14,7 @@ esphome: - bed_sensor.h <<: !include common/common.yaml -<<: !include common/logger.yaml +<<: !include common/logger/logger.yaml binary_sensor: - !include common/binary_sensor/status.yaml diff --git a/office_light.yaml b/office_light.yaml new file mode 100644 index 0000000..1615c15 --- /dev/null +++ b/office_light.yaml @@ -0,0 +1,29 @@ +substitutions: + device_id: office_light + device_name: Office Light + platform: ESP8266 + board: esp01_1m + ip_address: !secret office_light_ip + ota_pwd: !secret office_light_ota_pwd + api_pwd: !secret office_light_api_pwd + ap_wifi_pwd: !secret office_light_ap_wifi_pwd + +esphome: + <<: !include common/esphome.yaml + +<<: !include common/common_tuya_feit_dimmer.yaml +<<: !include common/logger/logger_tuya_no_log.yaml + +binary_sensor: + - !include common/binary_sensor/status.yaml + +sensor: + - !include common/sensor/uptime.yaml + - !include common/sensor/wifi.yaml + +switch: + - !include common/switch/restart.yaml + +text_sensor: + - !include common/text_sensor/version.yaml + - !include common/text_sensor/wifi.yaml \ No newline at end of file diff --git a/patio_lights.yaml b/patio_lights.yaml new file mode 100644 index 0000000..929a28e --- /dev/null +++ b/patio_lights.yaml @@ -0,0 +1,35 @@ +substitutions: + device_id: patio_lights + device_name: Patio Lights + platform: ESP8266 + board: d1_mini + ip_address: !secret patio_lights_ip + ota_pwd: !secret patio_lights_ota_pwd + api_pwd: !secret patio_lights_api_pwd + ap_wifi_pwd: !secret patio_lights_ap_wifi_pwd + +esphome: + <<: !include common/esphome.yaml + +<<: !include common/common.yaml +<<: !include common/logger/logger.yaml + +binary_sensor: + - !include common/binary_sensor/status.yaml + +sensor: + - !include common/sensor/uptime.yaml + - !include common/sensor/wifi.yaml + +switch: + - !include common/switch/restart.yaml + - platform: gpio + id: patio_lights + name: "Patio Lights" + icon: mdi:lightbulb + pin: D1 + inverted: false + +text_sensor: + - !include common/text_sensor/version.yaml + - !include common/text_sensor/wifi.yaml \ No newline at end of file