From 08d3547a4490651f1afdeaa73c143e0d1c28a642 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Fri, 12 May 2023 11:55:51 -0600 Subject: [PATCH] Initial commit --- .gitignore | 10 +++ basement.yaml | 51 +++++++++++++ bedroom-lightstrips.yaml | 61 +++++++++++++++ garage.yaml | 158 +++++++++++++++++++++++++++++++++++++++ houseplant.yaml | 40 ++++++++++ laundry.yaml | 127 +++++++++++++++++++++++++++++++ 6 files changed, 447 insertions(+) create mode 100644 .gitignore create mode 100644 basement.yaml create mode 100644 bedroom-lightstrips.yaml create mode 100644 garage.yaml create mode 100644 houseplant.yaml create mode 100644 laundry.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bbf89c --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Gitignore settings for ESPHome +# This is an example and may include too much for your use-case. +# You can modify this file to suit your needs. +/.esphome/ +**/.pioenvs/ +**/.piolibdeps/ +**/lib/ +**/src/ +**/platformio.ini +/secrets.yaml diff --git a/basement.yaml b/basement.yaml new file mode 100644 index 0000000..b2d42c3 --- /dev/null +++ b/basement.yaml @@ -0,0 +1,51 @@ +esphome: + name: basement + platform: ESP8266 + board: nodemcuv2 + +logger: + level: INFO + +ota: + password: "872a00fc1540e5da2bde65034519d736" + +wifi: + ssid: !secret ssid + password: !secret pass + fast_connect: true + +mqtt: + broker: henry.int.jnf.me + username: esphome + password: esphome + topic_prefix: esphome/basement + +dallas: + - pin: D1 + +sensor: + - platform: dallas + address: 0xB20114310AB9F728 + name: "Furnace Room" + +binary_sensor: + - platform: gpio + pin: D6 + name: "Doorbell" + device_class: sound + filters: + - delayed_off: 5s + - platform: gpio + pin: D7 + name: "Hot Water Tank" + device_class: moisture + filters: + - invert + - delayed_off: 5s + - platform: gpio + pin: D3 + name: "Basement Drain" + device_class: moisture + filters: + - invert + - delayed_off: 5s \ No newline at end of file diff --git a/bedroom-lightstrips.yaml b/bedroom-lightstrips.yaml new file mode 100644 index 0000000..bc92c4f --- /dev/null +++ b/bedroom-lightstrips.yaml @@ -0,0 +1,61 @@ +esphome: + name: bedroom-lightstrips + +esp8266: + board: nodemcuv2 + framework: + version: 2.7.4 + +logger: + level: INFO + +ota: + password: "69ad39126b95f706a401f48614a8404d" + +wifi: + ssid: !secret ssid + password: !secret pass + fast_connect: true + +mqtt: + broker: henry.int.jnf.me + username: esphome + password: esphome + topic_prefix: esphome/bedroom-lightstrips + +light: + - platform: fastled_spi + name: "Full LED Strip" + id: fullstrip + chipset: SK9822 + rgb_order: BGR + data_pin: D5 + clock_pin: D6 + num_leds: 116 + - platform: partition + name: "Jason's Under Bed Lights" + segments: + - id: fullstrip + from: 0 + to: 57 + effects: + - addressable_rainbow + - addressable_color_wipe + - addressable_scan + - addressable_twinkle + - addressable_fireworks + - addressable_flicker + - platform: partition + name: "Flo's Under Bed Lights" + segments: + - id: fullstrip + from: 58 + to: 115 + reversed: true + effects: + - addressable_rainbow + - addressable_color_wipe + - addressable_scan + - addressable_twinkle + - addressable_fireworks + - addressable_flicker \ No newline at end of file diff --git a/garage.yaml b/garage.yaml new file mode 100644 index 0000000..3039ecf --- /dev/null +++ b/garage.yaml @@ -0,0 +1,158 @@ +esphome: + name: garage + platform: ESP8266 + board: nodemcuv2 + +logger: + level: INFO + +ota: + password: "143fd33979958ada2bb06df1622d5a4d" + +wifi: + ssid: !secret ssid + password: !secret pass + fast_connect: true + +mqtt: + broker: henry.int.jnf.me + username: esphome + password: esphome + topic_prefix: esphome/garage + +dallas: + - pin: D7 + +sensor: + - platform: dallas + address: 0x7701143100966C28 + name: "Freezer" + id: garage_freezer + - platform: dallas + address: 0x200114310A086F28 + name: "Garage" + id: garage_temp + - platform: ultrasonic + trigger_pin: D5 + echo_pin: D8 + id: garage_spot_1 + internal: true + - platform: ultrasonic + trigger_pin: D3 + echo_pin: D4 + id: garage_spot_2 + internal: true + +text_sensor: + - platform: template + name: "Garage Door State" + id: garage_door_state + lambda: !lambda |- + if (id(garage_door_open).state && id(garage_door_closed).state) { + return {"Error"}; + } else if (id(garage_door_open).state) { + return {"Open"}; + } else if (id(garage_door_closed).state) { + return {"Closed"}; + } else return {"Moving"}; + +binary_sensor: + - platform: gpio + pin: D0 + name: "Garage Door" + device_class: door + id: garage_door_open + filters: + - invert: + on_press: + then: + - lambda: |- + id(garage_door_state).publish_state("Open"); + on_release: + then: + - lambda: |- + id(garage_door).current_operation = COVER_OPERATION_CLOSING; + id(garage_door).publish_state(); + id(garage_door_state).publish_state("Moving"); + - platform: gpio + pin: D1 + id: garage_door_closed + filters: + - invert: + internal: true + on_press: + then: + - lambda: |- + id(garage_door_state).publish_state("Closed"); + on_release: + then: + - lambda: |- + id(garage_door).current_operation = COVER_OPERATION_OPENING; + id(garage_door).publish_state(); + id(garage_door_state).publish_state("Moving"); + - platform: gpio + pin: D2 + name: "Side Door" + device_class: door + filters: + - invert + - delayed_off: 5s + + - platform: template + name: "Left Parking Spot" + device_class: occupancy + lambda: |- + if (id(garage_spot_1).state < 2) { + return true; + } else { + return false; + } + - platform: template + name: "Right Parking Spot" + device_class: occupancy + lambda: |- + if (id(garage_spot_2).state < 2) { + return true; + } else { + return false; + } + + +switch: + - platform: gpio + pin: + number: D6 + inverted: true + id: garage_door_switch + on_turn_on: + - delay: 500ms + - switch.turn_off: garage_door_switch + internal: true + +cover: + - platform: template + name: "Garage Door" + id: garage_door + device_class: garage + lambda: !lambda |- + if (id(garage_door_open).state) { + return COVER_OPEN; + } else if (id(garage_door_closed).state) { + return COVER_CLOSED; + } else return {}; + open_action: + - switch.turn_on: garage_door_switch + - delay: 3s + - if: + condition: + binary_sensor.is_on: garage_door_closed + then: + - switch.turn_on: garage_door_switch + close_action: + - switch.turn_on: garage_door_switch + - delay: 3s + - if: + condition: + binary_sensor.is_on: garage_door_open + then: + - switch.turn_on: garage_door_switch \ No newline at end of file diff --git a/houseplant.yaml b/houseplant.yaml new file mode 100644 index 0000000..e9486c4 --- /dev/null +++ b/houseplant.yaml @@ -0,0 +1,40 @@ +esphome: + name: houseplant + platform: ESP8266 + board: nodemcuv2 + +logger: + level: INFO + +ota: + password: "71987bd671fe226031259af06d0ccbea" + +wifi: + ssid: !secret ssid + password: !secret pass + fast_connect: true + +mqtt: + broker: henry.int.jnf.me + username: esphome + password: esphome + topic_prefix: esphome/houseplant + +http_request: + +sensor: + - platform: adc + pin: A0 + name: "Moisture Level" + id: moisture_level + unit_of_measurement: "u" + update_interval: 1h + filters: + - multiply: 1024 + on_value: + - http_request.get: + verify_ssl: false + url: !lambda |- + return (std::string) "https://jasonsplant.jaywll.co/newreading?v=" + to_string(int(id(moisture_level).state)); + headers: + auth-key: !secret houseplant_key \ No newline at end of file diff --git a/laundry.yaml b/laundry.yaml new file mode 100644 index 0000000..afaab60 --- /dev/null +++ b/laundry.yaml @@ -0,0 +1,127 @@ +esphome: + name: laundry + platform: ESP8266 + board: nodemcuv2 + +logger: + level: INFO + +ota: + password: "03af999284928f8525c82a13771a4a4f" + +wifi: + ssid: !secret ssid + password: !secret pass + fast_connect: true + +mqtt: + broker: henry.int.jnf.me + username: esphome + password: esphome + topic_prefix: esphome/laundry + +i2c: + sda: D6 + scl: D5 + scan: True + id: bus_a + +sensor: + - platform: mpu6050 + address: 0x68 + update_interval: 1s + gyro_x: + name: "Dryer Gyro X" + id: dryer_gyro_x + internal: true + gyro_y: + name: "Dryer Gyro Y" + id: dryer_gyro_y + internal: true + gyro_z: + name: "Dryer Gyro Z" + id: dryer_gyro_z + internal: true + temperature: + name: "Dryer Temperature" + filters: + - throttle: 30s + - platform: mpu6050 + address: 0x69 + update_interval: 1s + gyro_x: + name: "Washer Gyro X" + id: washer_gyro_x + internal: true + gyro_y: + name: "Washer Gyro Y" + id: washer_gyro_y + internal: true + gyro_z: + name: "Washer Gyro Z" + id: washer_gyro_z + internal: true + temperature: + name: "Washer Temperature" + filters: + - throttle: 30s + - platform: template + name: "Dryer Gyro All" + id: dryer_gyro_all + unit_of_measurement: °/s² + lambda: |- + return fabs(id(dryer_gyro_x).state) + fabs(id(dryer_gyro_y).state) + fabs(id(dryer_gyro_z).state); + update_interval: 1s + filters: + - lambda: |- + static float last_dryer_value = 0; + static float dryer_change = 0; + dryer_change = x - last_dryer_value; + last_dryer_value = x; + return fabs(dryer_change); + - sliding_window_moving_average: + window_size: 120 + send_every: 10 + - platform: template + name: "Washer Gyro All" + id: washer_gyro_all + unit_of_measurement: °/s² + lambda: |- + return fabs(id(washer_gyro_x).state) + fabs(id(washer_gyro_y).state) + fabs(id(washer_gyro_z).state); + update_interval: 1s + filters: + - lambda: |- + static float last_washer_value = 0; + static float washer_change = 0; + washer_change = x - last_washer_value; + last_washer_value = x; + return fabs(washer_change); + - sliding_window_moving_average: + window_size: 120 + send_every: 10 + +binary_sensor: + - platform: template + name: "Dryer" + id: dryer + lambda: |- + if (id(dryer_gyro_all).state >= 2.0) { + return true; + } else { + return false; + } + filters: + - delayed_on: 30s + - delayed_off: 60s + - platform: template + name: "Washer" + id: washer + lambda: |- + if (id(washer_gyro_all).state >= 1.0) { + return true; + } else { + return false; + } + filters: + - delayed_on: 30s + - delayed_off: 120s \ No newline at end of file