From 8501474b84961fb7a8e666aee3868fb07d6c5e0d Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Fri, 22 Oct 2021 12:19:35 +0200 Subject: [PATCH] esphome test --- esp32weatherstation2.yaml | 163 ++++++++++++++++++++++++++++++++++++++ fonts/slkscr.ttf | Bin 0 -> 7636 bytes veml6075_custom_sensor.h | 27 +++++++ 3 files changed, 190 insertions(+) create mode 100644 esp32weatherstation2.yaml create mode 100644 fonts/slkscr.ttf create mode 100644 veml6075_custom_sensor.h diff --git a/esp32weatherstation2.yaml b/esp32weatherstation2.yaml new file mode 100644 index 0000000..e0a986e --- /dev/null +++ b/esp32weatherstation2.yaml @@ -0,0 +1,163 @@ +esphome: + name: esp32weatherstation2 + platform: ESP32 + board: lolin_d32_pro + includes: + - veml6075_custom_sensor.h + libraries: + - "https://github.com/adafruit/Adafruit_VEML6075" + - "https://github.com/adafruit/Adafruit_BusIO" + platformio_options: + lib_ldf_mode: chain+ + project: + name: "xd0.esp32weatherstation2" + version: "0.0.1" + +# Enable logging +logger: +# level: VERY_VERBOSE + +# Enable Home Assistant API +api: + +ota: + password: "123456789" + +wifi: + networks: + - ssid: "ssid1" + password: "password1" + - ssid: "ssid2" + password: "password2" + power_save_mode: light + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esp32Weatherstation2" + password: "supersecret" + +captive_portal: + +time: + - platform: sntp + id: sntp_time + timezone: "Europe/Berlin" + +#mqtt: +# broker: home.xd0.de +# username: tasmota-login +# password: supersecret + +i2c: + sda: 21 + scl: 22 + scan: true + +spi: + clk_pin: 18 + mosi_pin: 23 + miso_pin: 19 + +uart: + rx_pin: 15 + tx_pin: 2 + baud_rate: 9600 + +# display #250x122 pixels +font: + - file: 'fonts/slkscr.ttf' + id: font1 + size: 8 + +status_led: + pin: + number: GPIO5 + inverted: true + +display: + - platform: waveshare_epaper + cs_pin: 14 + dc_pin: 27 + reset_pin: 33 + model: 2.13in-ttgo + rotation: 90 + update_interval: 30s + full_update_every: 1 + lambda: |- + it.print(5, 6, id(font1), "Hello World!"); + it.strftime(130, 6, id(font1), "%Y-%m-%d %H:%M", id(sntp_time).now()); + it.line(0, 15, 250, 15); + if (id(temperature).state) { + it.printf(5, 40, id(font1), "Temperature: %.1f°C, Humidity: %.1f%%, Pressure: %.1fhPa", id(temperature).state, id(humidity).state, id(pressure).state); + } + +sensor: +# BME680 Temperature+Pressure+Humidity+Gas Sensor + - platform: bme680 + temperature: + name: "BME680 Temperature" + oversampling: 16x + id: temperature + pressure: + name: "BME680 Pressure" + id: pressure + humidity: + name: "BME680 Humidity" + id: humidity + gas_resistance: + name: "BME680 Gas Resistance" + address: 0x77 + update_interval: 60s +# BME280 Temperature+Pressure+Humidity Sensor + - platform: bme280 + temperature: + name: "BME280 Temperature" + oversampling: 16x + pressure: + name: "BME280 Pressure" + humidity: + name: "BME280 Humidity" + address: 0x77 + update_interval: 60s +# SDS 011 Particulate Matter Sensor + - platform: sds011 + pm_2_5: + name: "Particulate Matter <2.5µm Concentration" + pm_10_0: + name: "Particulate Matter <10.0µm Concentration" + update_interval: 5min +# BH1750 Ambient Light Sensor + - platform: bh1750 + name: "BH1750 Illuminance" + address: 0x23 + measurement_duration: 69 + update_interval: 60s +# VEML6075 UV sensor + - platform: custom + lambda: |- + auto veml6075 = new VEML6075CustomSensor(); + App.register_component(veml6075); + return {veml6075->uva_sensor, veml6075->uvb_sensor}; + sensors: + - name: "zelva UVA" + id: zelva_uva + unit_of_measurement: "mW/cm²" + accuracy_decimals: 0 + - name: "zelva UVB" + id: zelva_uvb + unit_of_measurement: "mW/cm²" + accuracy_decimals: 0 +# Example configuration entry + - platform: esp32_hall + name: "ESP32 Hall Sensor" + update_interval: 60s + - platform: ble_rssi + mac_address: 11:22:33:44:55:66 + name: "MiBand Hendrik RSSI value" + +# Example configuration entry +esp32_ble_tracker: + +#text_sensor: +# - platform: ble_scanner +# name: "BLE Devices Scanner" diff --git a/fonts/slkscr.ttf b/fonts/slkscr.ttf new file m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