ESPHome: Difference between revisions
Jump to navigation
Jump to search
Tag: Manual revert |
No edit summary |
||
Line 19: | Line 19: | ||
api: | api: | ||
encryption: | encryption: | ||
key: " | key: "<key>" | ||
ota: | ota: | ||
password: " | password: "<PASSWORD>" | ||
# Setup WiFi credentials | # Setup WiFi credentials | ||
Line 34: | Line 34: | ||
ap: | ap: | ||
ssid: "CYD" | ssid: "CYD" | ||
password: " | password: "<password>" | ||
captive_portal: | captive_portal: |
Latest revision as of 22:17, 3 January 2024
Useful YAML scripts for ESPHome
CYD Basic Demo
esphome: name: cyd friendly_name: CYD esp32: board: esp32dev framework: type: arduino # Enable logging logger: api: encryption: key: "<key>" ota: password: "<PASSWORD>" # Setup WiFi credentials wifi: ssid: !secret wifi_ssid password: !secret wifi_password fast_connect: true domain: .scottworld.net # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "CYD" password: "<password>" captive_portal: time: - platform: homeassistant id: homeassistant_time web_server: # Create a font to use, add and remove glyphs as needed. font: - file: 'fonts/Arimo-Regular.ttf' id: arimo14 size: 14 - file: 'fonts/Arimo-Regular.ttf' id: arimo24 size: 24 - file: 'fonts/Arimo-Regular.ttf' id: arimo96 size: 96 glyphs: ":0123456789" # Create a Home Assistant blue color color: - id: ha_blue hex: 51c0f2 - id: red hex: ff0000 # Create an ESPHome logo image image: - file: "images/esphome.png" id: esphome_image type: RGB24 light: - platform: monochromatic output: backlight_pwm name: "Display Backlight" id: backlight restore_mode: ALWAYS_ON - platform: rgb name: "Status Light" red: rgb_red green: rgb_green blue: rgb_blue sensor: - platform: homeassistant id: power_usage entity_id: sensor.envoy_122041077530_current_power_consumption internal: true # Setup two binary sensors for the two areas for touch binary_sensor: - platform: touchscreen name: Prev x_min: 0 x_max: 30 y_min: 0 y_max: 240 on_press: - display.page.show_previous: display_screen - component.update: display_screen - platform: touchscreen name: Next x_min: 190 x_max: 320 y_min: 0 y_max: 240 on_press: - display.page.show_next: display_screen - component.update: display_screen spi: - id: tft clk_pin: GPIO14 mosi_pin: GPIO13 miso_pin: GPIO12 - id: touch clk_pin: GPIO25 mosi_pin: GPIO32 miso_pin: GPIO39 # Setup a pin to control the backlight output: - platform: ledc pin: GPIO21 id: backlight_pwm - platform: ledc pin: GPIO04 inverted: True id: rgb_red - platform: ledc pin: GPIO16 id: rgb_green inverted: True - platform: ledc pin: GPIO17 id: rgb_blue inverted: True graph: - id: powergraph sensor: power_usage duration: 30min width: 300 height: 180 x_grid: 5min y_grid: 1000.0 max_value: 8000.0 min_value: 0.0 color: red display: - platform: ili9xxx model: ili9341 id: display_screen spi_id: tft cs_pin: GPIO15 dc_pin: GPIO2 dimensions: height: 240 width: 320 transform: mirror_y: true color_order: rgb pages: - id: homeclock lambda: |- it.fill(id(ha_blue)); it.image(120,10, id(esphome_image)); it.strftime(100, 100, id(arimo24), "%Y-%m-%d", id(homeassistant_time).now()); it.strftime(40, 120, id(arimo96), "%H:%M", id(homeassistant_time).now()); - id: homepower lambda: |- it.fill(id(Color::BLACK)); it.print(0, 60, id(arimo14), TextAlign::TOP_LEFT, "8kW"); it.print(0, 105, id(arimo14), TextAlign::CENTER_LEFT, "6kW"); it.print(0, 150, id(arimo14), TextAlign::CENTER_LEFT, "4kW"); it.print(0, 195, id(arimo14), TextAlign::CENTER_LEFT, "2kW"); it.print(0, 240, id(arimo14), TextAlign::BOTTOM_LEFT, "0kW"); if (id(power_usage).has_state()) { it.printf(160, 5, id(arimo24), TextAlign::TOP_CENTER, "Power Usage: %4.0fW", id(power_usage).state); } it.graph(20, 60, id(powergraph)); touchscreen: platform: xpt2046 spi_id: touch cs_pin: GPIO33 interrupt_pin: GPIO36 update_interval: 50ms transform: swap_xy: True