From 790d1b9c32924daf34cef51bed105431b8ceeabe Mon Sep 17 00:00:00 2001 From: longranger Date: Sun, 27 Dec 2020 20:09:29 -0800 Subject: [PATCH] first commit --- .gitignore | 11 ++++ attic_2_fan.yaml | 55 ++++++++++++++++ fountain_1.yaml | 54 ++++++++++++++++ fountain_1_light.yaml | 55 ++++++++++++++++ fountain_outside.yaml | 143 +++++++++++++++++++++++++++++++++++++++++ rack_2.yaml | 76 ++++++++++++++++++++++ rack_3_duct_fan.yaml | 42 ++++++++++++ server_2_wall_fan.yaml | 55 ++++++++++++++++ 8 files changed, 491 insertions(+) create mode 100644 .gitignore create mode 100644 attic_2_fan.yaml create mode 100644 fountain_1.yaml create mode 100644 fountain_1_light.yaml create mode 100644 fountain_outside.yaml create mode 100644 rack_2.yaml create mode 100644 rack_3_duct_fan.yaml create mode 100644 server_2_wall_fan.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd2e2c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# 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 +**/partitions.csv +/secrets.yaml diff --git a/attic_2_fan.yaml b/attic_2_fan.yaml new file mode 100644 index 0000000..8fe6cca --- /dev/null +++ b/attic_2_fan.yaml @@ -0,0 +1,55 @@ +esphome: + name: attic_2_fan + 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: "Attic 2 Fan button" + on_press: + - switch.toggle: relay + +switch: + - platform: gpio + name: "Attic 2 Fan relay" + pin: GPIO14 + id: relay + +status_led: + pin: + number: GPIO12 + inverted: yes + +sensor: + - platform: wifi_signal + name: "Attic 2 Fan WiFi signal" + update_interval: 60s + + - platform: uptime + name: "Attic 2 Fan uptime" + +text_sensor: + - platform: version + name: "Attic 2 Fan ESPHome version" diff --git a/fountain_1.yaml b/fountain_1.yaml new file mode 100644 index 0000000..f1f52ce --- /dev/null +++ b/fountain_1.yaml @@ -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" \ No newline at end of file diff --git a/fountain_1_light.yaml b/fountain_1_light.yaml new file mode 100644 index 0000000..fc02b58 --- /dev/null +++ b/fountain_1_light.yaml @@ -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" \ No newline at end of file diff --git a/fountain_outside.yaml b/fountain_outside.yaml new file mode 100644 index 0000000..4f53e43 --- /dev/null +++ b/fountain_outside.yaml @@ -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 POW’s 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 POW’s 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" \ No newline at end of file diff --git a/rack_2.yaml b/rack_2.yaml new file mode 100644 index 0000000..7a617c8 --- /dev/null +++ b/rack_2.yaml @@ -0,0 +1,76 @@ +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: + +output: + - platform: ledc + pin: GPIO13 + id: gpio_13 + - platform: ledc + pin: GPIO22 + id: gpio_22 + +fan: + - platform: speed + output: gpio_13 + name: "rack_2_duct_fan" + speed: + low: 0.3 + medium: 0.5 + high: 1.0 + - platform: speed + output: gpio_22 + name: "rack_2_wall_fan" + speed: + low: 0.3 + medium: 0.5 + high: 1.0 + +sensor: + - platform: pulse_counter + pin: + number: GPIO23 + mode: INPUT_PULLUP + unit_of_measurement: 'RPM' + name: "rack_2_wall_fan_speed" + update_interval: 10s + filters: + - multiply: 0.5 + - platform: dallas + address: 0xB801143296ED7B28 + name: "rack_2_cold_temp" + - platform: dallas + address: 0x1D01143296570128 + name: "rack_2_hot_temp" + +dallas: + - pin: + number: GPIO32 + mode: INPUT_PULLUP + update_interval: 10s + +# Enable logging +logger: + level: DEBUG + +# Enable Home Assistant API +api: + +ota: diff --git a/rack_3_duct_fan.yaml b/rack_3_duct_fan.yaml new file mode 100644 index 0000000..616e3d4 --- /dev/null +++ b/rack_3_duct_fan.yaml @@ -0,0 +1,42 @@ +esphome: + name: rack_3_duct_fan + 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 Duct Fan Fallback Hotspot" + password: "Ze13rpDX4Qm6" + +captive_portal: + +# Enable logging +logger: + +# Enable Home Assistant API +api: + +ota: + +output: + - platform: ledc + pin: GPIO19 + id: gpio_19 + +fan: + - platform: speed + output: gpio_19 + name: "rack_3_duct_fan" + speed: + low: 0.3 + medium: 0.5 + high: 1.0 diff --git a/server_2_wall_fan.yaml b/server_2_wall_fan.yaml new file mode 100644 index 0000000..ddf27f4 --- /dev/null +++ b/server_2_wall_fan.yaml @@ -0,0 +1,55 @@ +esphome: + name: server_2_wall_fan + 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: "Server 2 Wall Fan button" + on_press: + - switch.toggle: relay + +switch: + - platform: gpio + name: "Server 2 Wall Fan relay" + pin: GPIO14 + id: relay + +status_led: + pin: + number: GPIO12 + inverted: yes + +sensor: + - platform: wifi_signal + name: "Server 2 Wall Fan WiFi signal" + update_interval: 60s + + - platform: uptime + name: "Server 2 Wall Fan uptime" + +text_sensor: + - platform: version + name: "Server 2 Wall Fan ESPHome version"