From df320926a1b61ebabdf6b34c0b05234852d69787 Mon Sep 17 00:00:00 2001 From: Jan Grewe <jan@faked.org> Date: Sat, 28 May 2022 13:22:56 +0200 Subject: [PATCH] use 'packages' to merge configs --- README.md | 12 ++++++++---- common.yaml => base.yaml | 35 +++++++++++++++++++++++++++++++++-- include/nous_a1t.yaml | 12 ------------ include/text_sensors.yaml | 18 ------------------ propbox-fan.yaml | 8 +++----- propbox-light.yaml | 8 +++----- propbox.yaml | 22 +++------------------- secrets.yaml.dist | 3 ++- 8 files changed, 52 insertions(+), 66 deletions(-) rename common.yaml => base.yaml (51%) delete mode 100644 include/text_sensors.yaml diff --git a/README.md b/README.md index b9f1cac..bbfb961 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,11 @@ Home Grow(n) Monitoring ## Components -* propbox: Propagator Controller, any ESP32 -* propbox-light: Smart Plug for Lights, e.g. Nous A1T -* propbox-fan: Smart Plug for Fan, e.g. Nous A1T -* Xiaomi Mi Temperature and Humidity Monitor 2 (LYWSD03MMC), does what it says on the tin +* propbox: ESP32 Propagator Controller + * BME280 Temperature and Humidity Sensor (3.3V, I2C) + * Dallas DS18B20 Temperature Sensor +* propbox-light: Nous A1T Smart Plug for Light +* propbox-fan: Nous A1T Smart Plug for Fan + +## Configuration +Copy `secrets.yaml.dist` to `secrets.yaml` and adjust to your preferences. diff --git a/common.yaml b/base.yaml similarity index 51% rename from common.yaml rename to base.yaml index 0783413..c823a8f 100644 --- a/common.yaml +++ b/base.yaml @@ -15,8 +15,6 @@ preferences: logger: # level: INFO - logs: - esp32_ble_tracker: INFO api: password: !secret api_password @@ -42,3 +40,36 @@ web_server: # include_internal: true prometheus: + +sensor: + - platform: wifi_signal + name: "Wifi Signal" + update_interval: 60s + + - platform: uptime + name: "Device Uptime" + update_interval: 60s + +text_sensor: + - platform: version + name: "ESPHome Version" + hide_timestamp: true + + - platform: template + name: "Device Time" + lambda: |- + auto str_time = id(sntp_time).now().strftime("%d-%m-%Y %H:%M"); + return { str_time }; + update_interval: 60s + + - platform: wifi_info + ip_address: + name: "Wifi IP Address" + ssid: + name: "Wifi SSID" + bssid: + name: "Wifi BSSID" + +switch: + - platform: restart + name: "Device Restart" diff --git a/include/nous_a1t.yaml b/include/nous_a1t.yaml index 54b1691..8fb21ef 100644 --- a/include/nous_a1t.yaml +++ b/include/nous_a1t.yaml @@ -46,18 +46,6 @@ switch: pin: GPIO14 sensor: -### Default Sensors - - - platform: wifi_signal - name: "Wifi Signal" - update_interval: 60s - - - platform: uptime - name: "Uptime" - update_interval: 60s - -### Specific Sensors - - platform: total_daily_energy name: "Electric Consumption [kWh]" power_id: "nous_a1t_watt" diff --git a/include/text_sensors.yaml b/include/text_sensors.yaml deleted file mode 100644 index a67a7ec..0000000 --- a/include/text_sensors.yaml +++ /dev/null @@ -1,18 +0,0 @@ -- platform: wifi_info - ip_address: - name: "Wifi IP Address" - ssid: - name: "Wifi SSID" - bssid: - name: "Wifi BSSID" - -- platform: version - name: "ESPHome Version" - hide_timestamp: true - -- platform: template - name: "Device Time" - lambda: |- - auto str_time = id(sntp_time).now().strftime("%d-%m-%Y %H:%M"); - return { str_time }; - update_interval: 60s diff --git a/propbox-fan.yaml b/propbox-fan.yaml index ff99829..e54a885 100644 --- a/propbox-fan.yaml +++ b/propbox-fan.yaml @@ -1,6 +1,6 @@ substitutions: devicename: "propbox-fan" - domain: "faked.local" + domain: !secret domain comment: "Propagator Fan Control" project_name: "groovy.propbox-fan" project_version: "1.0" @@ -8,9 +8,7 @@ substitutions: current_res: "0.00280" # Higher value gives lower watt readout voltage_div: "775" # Lower value gives lower voltage readout -<<: !include common.yaml +packages: + device_base: !include base.yaml <<: !include include/nous_a1t.yaml - -text_sensor: - !include include/text_sensors.yaml diff --git a/propbox-light.yaml b/propbox-light.yaml index 6ab726a..b8f1cc8 100644 --- a/propbox-light.yaml +++ b/propbox-light.yaml @@ -1,6 +1,6 @@ substitutions: devicename: "propbox-light" - domain: "faked.local" + domain: !secret domain comment: "Propagator Light Control" project_name: "groovy.propbox-light" project_version: "1.0" @@ -8,9 +8,7 @@ substitutions: current_res: "0.00280" # Higher value gives lower watt readout voltage_div: "775" # Lower value gives lower voltage readout -<<: !include common.yaml +packages: + device_base: !include base.yaml <<: !include include/nous_a1t.yaml - -text_sensor: - !include include/text_sensors.yaml diff --git a/propbox.yaml b/propbox.yaml index d26d688..db2c1da 100644 --- a/propbox.yaml +++ b/propbox.yaml @@ -1,6 +1,6 @@ substitutions: devicename: "propbox" - domain: "faked.local" + domain: !secret domain comment: "Propagator Monitor" project_name: "groovy.propbox" project_version: "1.0" @@ -19,7 +19,8 @@ substitutions: schedule_bloom_on: "0 * * * * *" schedule_bloom_off: "30 * * * * *" -<<: !include common.yaml +packages: + device_base: !include base.yaml esp32: board: esp32dev @@ -37,22 +38,7 @@ http_request: useragent: esphome/${devicename} timeout: 10s -text_sensor: - !include include/text_sensors.yaml - sensor: -### Default Sensors - - - platform: wifi_signal - name: "Wifi Signal" - update_interval: 60s - - - platform: uptime - name: "Device Uptime" - update_interval: 60s - -### Specific Sensors - - platform: bme280 address: 0x76 update_interval: 5s @@ -133,8 +119,6 @@ select: restore_value: true switch: - - platform: restart - name: "Device Restart" - platform: template id: propbox_light name: "Light Status" diff --git a/secrets.yaml.dist b/secrets.yaml.dist index 94d6535..07cf9d0 100644 --- a/secrets.yaml.dist +++ b/secrets.yaml.dist @@ -1,4 +1,5 @@ wifi_ssid: foo wifi_password: bar ota_password: baz -api_password: qux \ No newline at end of file +api_password: qux +domain: example.com -- GitLab