From d9bbeb17040b25086df24648865db81a637b5e7d Mon Sep 17 00:00:00 2001 From: longranger Date: Sun, 3 Jul 2022 08:40:41 -0700 Subject: [PATCH] Modularize and move all to kungle-oss. --- _data/.common.yaml | 8 ++ _data/.esp32.yaml | 4 + _data/.esp8266.yaml | 4 + _data/.gitignore | 5 + _data/{r3-cpu-pwr.yaml => .gosund-wp3.yaml} | 34 ------- _data/.weather.yaml | 40 ++++++++ _data/.wifi-oss.yaml | 9 ++ _data/fountain-1-light.yaml | 10 ++ _data/fountain-1.yaml | 10 ++ ...ain_outside.yaml => fountain-outside.yaml} | 33 ++----- _data/fountain_1.yaml | 54 ---------- _data/fountain_1_light.yaml | 55 ----------- _data/pj_3_duct_fan_pwr.yaml | 83 ---------------- _data/{projector_3.yaml => prj-3.yaml} | 99 +++++++++---------- _data/prj3-duct-fan-pwr.yaml | 10 ++ _data/rack-2-df-pwr.yaml | 10 ++ _data/rack-3-cpu-pwr.yaml | 10 ++ _data/rack-3-df-pwr.yaml | 10 ++ _data/{rack-2.yaml => rack_2.yaml} | 0 _data/rack_2_duct_fan_pwr.yaml | 55 ----------- _data/rack_3.yaml | 27 +---- _data/rack_3_duct_fan_pwr.yaml | 55 ----------- _data/tv1-cpu-pwr.yaml | 76 +------------- _data/weather-in-1.yaml | 77 ++------------- _data/weather-out-n.yaml | 77 ++------------- _data/weather-out-s.yaml | 77 ++------------- 26 files changed, 207 insertions(+), 725 deletions(-) create mode 100644 _data/.common.yaml create mode 100644 _data/.esp32.yaml create mode 100644 _data/.esp8266.yaml create mode 100644 _data/.gitignore rename _data/{r3-cpu-pwr.yaml => .gosund-wp3.yaml} (60%) create mode 100644 _data/.weather.yaml create mode 100644 _data/.wifi-oss.yaml create mode 100644 _data/fountain-1-light.yaml create mode 100644 _data/fountain-1.yaml rename _data/{fountain_outside.yaml => fountain-outside.yaml} (92%) delete mode 100644 _data/fountain_1.yaml delete mode 100644 _data/fountain_1_light.yaml delete mode 100644 _data/pj_3_duct_fan_pwr.yaml rename _data/{projector_3.yaml => prj-3.yaml} (74%) create mode 100644 _data/prj3-duct-fan-pwr.yaml create mode 100644 _data/rack-2-df-pwr.yaml create mode 100644 _data/rack-3-cpu-pwr.yaml create mode 100644 _data/rack-3-df-pwr.yaml rename _data/{rack-2.yaml => rack_2.yaml} (100%) delete mode 100644 _data/rack_2_duct_fan_pwr.yaml delete mode 100644 _data/rack_3_duct_fan_pwr.yaml diff --git a/_data/.common.yaml b/_data/.common.yaml new file mode 100644 index 0000000..19c0dca --- /dev/null +++ b/_data/.common.yaml @@ -0,0 +1,8 @@ +# Enable logging +logger: + +# Enable Home Assistant API +api: + +ota: + # password: "38fdad38872738fe7c08f77643ed5d56" diff --git a/_data/.esp32.yaml b/_data/.esp32.yaml new file mode 100644 index 0000000..f991887 --- /dev/null +++ b/_data/.esp32.yaml @@ -0,0 +1,4 @@ +esphome: + name: "${device_name}" + platform: ESP32 + board: esp32doit-devkit-v1 diff --git a/_data/.esp8266.yaml b/_data/.esp8266.yaml new file mode 100644 index 0000000..4ea2ecf --- /dev/null +++ b/_data/.esp8266.yaml @@ -0,0 +1,4 @@ +esphome: + name: "${device_name}" + platform: ESP8266 + board: esp01_1m diff --git a/_data/.gitignore b/_data/.gitignore new file mode 100644 index 0000000..d8b4157 --- /dev/null +++ b/_data/.gitignore @@ -0,0 +1,5 @@ +# 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/ +/secrets.yaml diff --git a/_data/r3-cpu-pwr.yaml b/_data/.gosund-wp3.yaml similarity index 60% rename from _data/r3-cpu-pwr.yaml rename to _data/.gosund-wp3.yaml index 8200e5c..a353ca8 100644 --- a/_data/r3-cpu-pwr.yaml +++ b/_data/.gosund-wp3.yaml @@ -1,37 +1,3 @@ -substitutions: - device_name: r3-cpu-pwr - dn: r3_cpu_pwr - friendly_name: Rack3 Computer Power - -esphome: - name: "${device_name}" - platform: ESP8266 - board: esp01_1m - -wifi: - ssid: !secret wifi_oss_ssid - password: !secret wifi_oss_pw - fast_connect: true - - manual_ip: - static_ip: 192.168.35.248 - gateway: 192.168.35.1 - subnet: 255.255.255.0 - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: "${device_name} Fallback Hotspot" - password: !secret wifi_fallback_pw - -# Enable logging -logger: - -# Enable Home Assistant API -api: - -ota: - # password: !secret gosund_1_ota - binary_sensor: - platform: gpio pin: diff --git a/_data/.weather.yaml b/_data/.weather.yaml new file mode 100644 index 0000000..b9673fc --- /dev/null +++ b/_data/.weather.yaml @@ -0,0 +1,40 @@ +i2c: + sda: 4 + scl: 5 + scan: true + id: bus_a + +sensor: + - platform: bme280 + temperature: + name: Temp${dn} + id: bme280_temperature + pressure: + name: Press${dn} + id: bme280_pressure + humidity: + name: HumidityRel${dn} + id: bme280_humidity + address: 0x76 + update_interval: 15s + # Templates from https://esphome.io/cookbook/bme280_environment.html + - platform: template + name: HumidityAbs${dn} + lambda: |- + const float mw = 18.01534; // molar mass of water g/mol + const float r = 8.31447215; // Universal gas constant J/mol/K + return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / + (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / + ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 + accuracy_decimals: 2 + update_interval: 15s + icon: 'mdi:water' + unit_of_measurement: 'g/m³' + - platform: template + name: DewPt${dn} + lambda: |- + return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/ + (243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)- + ((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); + unit_of_measurement: °C + icon: 'mdi:thermometer-alert' diff --git a/_data/.wifi-oss.yaml b/_data/.wifi-oss.yaml new file mode 100644 index 0000000..1407532 --- /dev/null +++ b/_data/.wifi-oss.yaml @@ -0,0 +1,9 @@ +wifi: + ssid: !secret wifi_oss_ssid + password: !secret wifi_oss_pw + use_address: "${device_name}" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "${device_name}-fallback" + password: !secret wifi_fallback_pw diff --git a/_data/fountain-1-light.yaml b/_data/fountain-1-light.yaml new file mode 100644 index 0000000..1f8ed24 --- /dev/null +++ b/_data/fountain-1-light.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: fountain-1-light + dn: fountain_1_light + friendly_name: 1st Floor Fountain Light + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml diff --git a/_data/fountain-1.yaml b/_data/fountain-1.yaml new file mode 100644 index 0000000..f7bf1c2 --- /dev/null +++ b/_data/fountain-1.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: fountain-1 + dn: fountain_1 + friendly_name: 1st Floor Fountain Pump + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml diff --git a/_data/fountain_outside.yaml b/_data/fountain-outside.yaml similarity index 92% rename from _data/fountain_outside.yaml rename to _data/fountain-outside.yaml index 4f53e43..ce1b864 100644 --- a/_data/fountain_outside.yaml +++ b/_data/fountain-outside.yaml @@ -1,33 +1,12 @@ substitutions: - device_name: fountain_outside - device_description: Energy Monitoring Smart Plug with button, blue LED, and red LED. + device_name: fountain-outside + dn: fountain_outside friendly_name: Fountain Outside + device_description: Energy Monitoring Smart Plug with button, blue LED, and red LED. -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 +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml # Enable time component for use by daily power sensor time: diff --git a/_data/fountain_1.yaml b/_data/fountain_1.yaml deleted file mode 100644 index 5871677..0000000 --- a/_data/fountain_1.yaml +++ /dev/null @@ -1,54 +0,0 @@ -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/_data/fountain_1_light.yaml b/_data/fountain_1_light.yaml deleted file mode 100644 index fc02b58..0000000 --- a/_data/fountain_1_light.yaml +++ /dev/null @@ -1,55 +0,0 @@ -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/_data/pj_3_duct_fan_pwr.yaml b/_data/pj_3_duct_fan_pwr.yaml deleted file mode 100644 index d3189cc..0000000 --- a/_data/pj_3_duct_fan_pwr.yaml +++ /dev/null @@ -1,83 +0,0 @@ -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" \ No newline at end of file diff --git a/_data/projector_3.yaml b/_data/prj-3.yaml similarity index 74% rename from _data/projector_3.yaml rename to _data/prj-3.yaml index 7b81210..66cf2bd 100644 --- a/_data/projector_3.yaml +++ b/_data/prj-3.yaml @@ -1,68 +1,56 @@ substitutions: + device_name: prj-3 + dn: prj_3 + sn: P3 + friendly_name: Prj 3 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_name: ${sn} Duct Fan Spd + duct_fan_tgt_spd_in_name: ${sn} Duct Fan Tgt Spd In + duct_fan_tgt_spd_prj_name: ${sn} Duct Fan Tgt Spd Prj + duct_fan_tgt_spd_out_name: ${sn} Duct Fan 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" - prjpwr_pin: GPIO19 - prjpwr_name: Prj3 Pwr + prjpwr_pin: GPIO19 + prjpwr_name: ${sn} Pwr dallas_pin: GPIO32 dallas_in_addr: "0x1F3C01D0756F0928" - dallas_in_name: Prj3 Temp In + dallas_in_name: ${sn} Temp In dallas_prj_addr: "0x873C01D0756D4B28" - dallas_prj_name: Prj3 Temp Prj + dallas_prj_name: ${sn} Temp Prj dallas_out_addr: "0xA901143295610E28" - dallas_out_name: Prj3 Temp Out + dallas_out_name: ${sn} Temp Out dallas_update_interval: 30s globals: - - id: duct_fan_off_spd + - id: duct_fan_off_spd_id type: float initial_value: ${duct_fan_off_spd} - - id: duct_fan_lo_spd + - id: duct_fan_lo_spd_id type: float initial_value: ${duct_fan_lo_spd} - - id: duct_fan_vent_spd + - id: duct_fan_vent_spd_id type: float initial_value: ${duct_fan_vent_spd} - - id: duct_fan_hi_spd + - id: duct_fan_hi_spd_id type: float initial_value: ${duct_fan_hi_spd} +<<: !include .common.yaml +<<: !include .wifi-oss.yaml + 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: + on_boot: + - priority: 200.0 + then: + - output.set_level: + id: duct_fan_output_id + level: ${duct_fan_vent_spd}% switch: - platform: template @@ -80,7 +68,7 @@ fan: - platform: speed id: duct_fan_spd_id output: duct_fan_output_id - name: ${duct_fan_spd_name} + name: ${duct_fan_name} dallas: - pin: @@ -114,15 +102,15 @@ binary_sensor: number: - platform: template - id: duct_fan_target_spd_in - name: ${duct_fan_target_spd_in_name} + 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_target_spd_prj - name: ${duct_fan_target_spd_prj_name} + id: duct_fan_tgt_spd_prj + name: ${duct_fan_tgt_spd_prj_name} min_value: ${duct_fan_off_spd} max_value: ${duct_fan_hi_spd} step: 1 @@ -140,10 +128,10 @@ number: 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); + off_spd = id(duct_fan_off_spd_id); + lo_spd = id(duct_fan_lo_spd_id); + vent_spd = id(duct_fan_vent_spd_id); + 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 Current Temp: %f", curtemp); ESP_LOGD("fan_speed", "DEBUG Thermostat State: %d", id(thermostat_on_id).state); @@ -154,9 +142,14 @@ number: call.perform(); return off_spd; } - if (curtemp > hi_temp) { + if (std::isnan(curtemp)) { + ESP_LOGD("fan_speed", "DEBUG current temp unknown. Set spd to vent."); + newspd = vent_spd; + } else 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)); @@ -178,8 +171,8 @@ number: call.perform(); return newspd; - platform: template - id: duct_fan_target_spd_out - name: ${duct_fan_target_spd_out_name} + id: duct_fan_tgt_spd_out + name: ${duct_fan_tgt_spd_out_name} optimistic: true min_value: ${duct_fan_off_spd} max_value: ${duct_fan_hi_spd} @@ -204,12 +197,12 @@ climate: min_heating_run_time: 60s min_idle_time: 60s heat_action: - - logger.log: "Turning off Prj3 Thermostat" + - logger.log: "Turning off ${friendly_name} Thermostat" - switch.turn_off: thermostat_on_id idle_action: - - logger.log: "Turning on Prj3 Thermostat" + - logger.log: "Turning on ${friendly_name} Thermostat" - switch.turn_on: thermostat_on_id cool_action: - - logger.log: "WARNING: Prj3 Thermostat has hit high temp!" + - logger.log: "WARNING: ${friendly_name} Thermostat has hit high temp!" - switch.turn_on: thermostat_on_id #TODO - provide some kind of warning / action here diff --git a/_data/prj3-duct-fan-pwr.yaml b/_data/prj3-duct-fan-pwr.yaml new file mode 100644 index 0000000..5622723 --- /dev/null +++ b/_data/prj3-duct-fan-pwr.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: "prj3-duct-fan-pwr" + dn: "prj3_duct_fan_pwr" + friendly_name: "Prj 3 Duct Fan Pwr" + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml \ No newline at end of file diff --git a/_data/rack-2-df-pwr.yaml b/_data/rack-2-df-pwr.yaml new file mode 100644 index 0000000..ed87bf9 --- /dev/null +++ b/_data/rack-2-df-pwr.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: rack-2-df-pwr + dn: rack_2_df_pwr + friendly_name: Rack 2 Duct Fan Power + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml diff --git a/_data/rack-3-cpu-pwr.yaml b/_data/rack-3-cpu-pwr.yaml new file mode 100644 index 0000000..776eb00 --- /dev/null +++ b/_data/rack-3-cpu-pwr.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: rack-3-cpu-pwr + dn: rack_3_cpu_pwr + friendly_name: Rack3 Computer Power + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml \ No newline at end of file diff --git a/_data/rack-3-df-pwr.yaml b/_data/rack-3-df-pwr.yaml new file mode 100644 index 0000000..404bedd --- /dev/null +++ b/_data/rack-3-df-pwr.yaml @@ -0,0 +1,10 @@ +substitutions: + device_name: rack-3-df-pwr + dn: rack_3_df_pwr + friendly_name: Rack 3 Duct Fan Power + +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml + +<<: !include .gosund-wp3.yaml diff --git a/_data/rack-2.yaml b/_data/rack_2.yaml similarity index 100% rename from _data/rack-2.yaml rename to _data/rack_2.yaml diff --git a/_data/rack_2_duct_fan_pwr.yaml b/_data/rack_2_duct_fan_pwr.yaml deleted file mode 100644 index 3ed47c0..0000000 --- a/_data/rack_2_duct_fan_pwr.yaml +++ /dev/null @@ -1,55 +0,0 @@ -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" diff --git a/_data/rack_3.yaml b/_data/rack_3.yaml index 7923eb8..703bf05 100644 --- a/_data/rack_3.yaml +++ b/_data/rack_3.yaml @@ -39,6 +39,9 @@ globals: type: float initial_value: ${duct_fan_hi_spd} +<<: !include .common.yaml +<<: !include .wifi-oss.yaml + esphome: name: rack_3 platform: ESP32 @@ -50,30 +53,6 @@ esphome: id: duct_fan_output_id level: ${duct_fan_vent_spd}% -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 diff --git a/_data/rack_3_duct_fan_pwr.yaml b/_data/rack_3_duct_fan_pwr.yaml deleted file mode 100644 index 84070f7..0000000 --- a/_data/rack_3_duct_fan_pwr.yaml +++ /dev/null @@ -1,55 +0,0 @@ -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" diff --git a/_data/tv1-cpu-pwr.yaml b/_data/tv1-cpu-pwr.yaml index 44e75ac..d03a960 100644 --- a/_data/tv1-cpu-pwr.yaml +++ b/_data/tv1-cpu-pwr.yaml @@ -3,76 +3,8 @@ substitutions: dn: tv1_cpu_pwr friendly_name: 1st Floor TV Computer Power -esphome: - name: "${device_name}" - platform: ESP8266 - board: esp01_1m +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml -wifi: - ssid: !secret wifi_oss_ssid - password: !secret wifi_oss_pw - use_address: "${device_name}" - - # Enable fallback hotspot (captive portal) in case wifi connection fails - ap: - ssid: "${device_name}-fallback" - password: !secret wifi_fallback_pw - -# Enable logging -logger: - -# Enable Home Assistant API -api: - -ota: - # password: !secret gosund_1_ota - -binary_sensor: - - platform: gpio - pin: - number: GPIO4 - mode: INPUT_PULLUP - inverted: True - name: "${friendly_name} Button" - id: "${dn}_button" - on_press: - - switch.toggle: "${dn}_relay" - - platform: status - name: "${friendly_name} Status" - id: "${dn}_status" - -switch: - - platform: gpio - name: "${friendly_name} Relay" - id: "${dn}_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: "${dn}_wifi_signal" - update_interval: 60s - - platform: uptime - name: "${friendly_name} Uptime" - id: "${dn}_uptime" - update_interval: 60s - -text_sensor: - - platform: version - name: "${friendly_name} ESPHome Version" - id: "${dn}_esphome_version" \ No newline at end of file +<<: !include .gosund-wp3.yaml \ No newline at end of file diff --git a/_data/weather-in-1.yaml b/_data/weather-in-1.yaml index 4585022..c92cad6 100644 --- a/_data/weather-in-1.yaml +++ b/_data/weather-in-1.yaml @@ -1,74 +1,9 @@ substitutions: - device_name: In1 + device_name: weather-in-1 + dn: In1 -esphome: - name: weather-in-1 +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml -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: Temp${device_name} - id: bme280_temperature - pressure: - name: Press${device_name} - id: bme280_pressure - humidity: - name: HumidityRel${device_name} - id: bme280_humidity - address: 0x76 - update_interval: 15s - # Templates from https://esphome.io/cookbook/bme280_environment.html - - platform: template - name: HumidityAbs${device_name} - lambda: |- - const float mw = 18.01534; // molar mass of water g/mol - const float r = 8.31447215; // Universal gas constant J/mol/K - return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / - (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / - ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 - accuracy_decimals: 2 - update_interval: 15s - icon: 'mdi:water' - unit_of_measurement: 'g/m³' - - platform: template - name: DewPt${device_name} - lambda: |- - return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/ - (243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)- - ((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); - unit_of_measurement: °C - icon: 'mdi:thermometer-alert' +<<: !include .weather.yaml diff --git a/_data/weather-out-n.yaml b/_data/weather-out-n.yaml index af90887..4587416 100644 --- a/_data/weather-out-n.yaml +++ b/_data/weather-out-n.yaml @@ -1,74 +1,9 @@ substitutions: - device_name: OutN + device_name: weather-out-n + dn: OutN -esphome: - name: weather-out-n +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml -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: Temp${device_name} - id: bme280_temperature - pressure: - name: Press${device_name} - id: bme280_pressure - humidity: - name: HumidityRel${device_name} - id: bme280_humidity - address: 0x76 - update_interval: 15s - # Templates from https://esphome.io/cookbook/bme280_environment.html - - platform: template - name: HumidityAbs${device_name} - lambda: |- - const float mw = 18.01534; // molar mass of water g/mol - const float r = 8.31447215; // Universal gas constant J/mol/K - return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / - (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / - ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 - accuracy_decimals: 2 - update_interval: 15s - icon: 'mdi:water' - unit_of_measurement: 'g/m³' - - platform: template - name: DewPt${device_name} - lambda: |- - return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/ - (243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)- - ((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); - unit_of_measurement: °C - icon: 'mdi:thermometer-alert' +<<: !include .weather.yaml diff --git a/_data/weather-out-s.yaml b/_data/weather-out-s.yaml index 6396e88..6d2dcef 100644 --- a/_data/weather-out-s.yaml +++ b/_data/weather-out-s.yaml @@ -1,74 +1,9 @@ substitutions: - device_name: OutS + device_name: weather-out-s + dn: OutS -esphome: - name: weather-out-s +<<: !include .common.yaml +<<: !include .esp8266.yaml +<<: !include .wifi-oss.yaml -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: Temp${device_name} - id: bme280_temperature - pressure: - name: Press${device_name} - id: bme280_pressure - humidity: - name: HumidityRel${device_name} - id: bme280_humidity - address: 0x76 - update_interval: 15s - # Templates from https://esphome.io/cookbook/bme280_environment.html - - platform: template - name: HumidityAbs${device_name} - lambda: |- - const float mw = 18.01534; // molar mass of water g/mol - const float r = 8.31447215; // Universal gas constant J/mol/K - return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / - (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / - ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3 - accuracy_decimals: 2 - update_interval: 15s - icon: 'mdi:water' - unit_of_measurement: 'g/m³' - - platform: template - name: DewPt${device_name} - lambda: |- - return (243.5*(log(id(bme280_humidity).state/100)+((17.67*id(bme280_temperature).state)/ - (243.5+id(bme280_temperature).state)))/(17.67-log(id(bme280_humidity).state/100)- - ((17.67*id(bme280_temperature).state)/(243.5+id(bme280_temperature).state)))); - unit_of_measurement: °C - icon: 'mdi:thermometer-alert' +<<: !include .weather.yaml