├── LICENSE.txt ├── README.md ├── STLs ├── BackHousingV4.stl ├── FrontPlateV4.stl └── TabletMounts.stl ├── fonts └── materialdesignicons-webfont.ttf ├── hadisplay.yaml ├── images └── dashboard1.jpg └── secrets.yaml /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Faraz Ahmad 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Waveshare ST7262 ESPHome LVGL 3 | 4 | Waveshare_ST7262_ESPHome_LVGL is an ESPHome project designed for [Waveshare ESP32-S3-Touch-LCD-7](https://www.waveshare.com/wiki/ESP32-S3-Touch-LCD-7) using ESP32-S3 SOC with 7 inch ST7262 LCD and GT911 touchscreen to facilitate rapid GUI development using LVGL and ESPHome. 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /STLs/BackHousingV4.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL/547ac76877eebb7ebe040238e81a532845b69bc2/STLs/BackHousingV4.stl -------------------------------------------------------------------------------- /STLs/FrontPlateV4.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL/547ac76877eebb7ebe040238e81a532845b69bc2/STLs/FrontPlateV4.stl -------------------------------------------------------------------------------- /STLs/TabletMounts.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL/547ac76877eebb7ebe040238e81a532845b69bc2/STLs/TabletMounts.stl -------------------------------------------------------------------------------- /fonts/materialdesignicons-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL/547ac76877eebb7ebe040238e81a532845b69bc2/fonts/materialdesignicons-webfont.ttf -------------------------------------------------------------------------------- /hadisplay.yaml: -------------------------------------------------------------------------------- 1 | substitutions: 2 | name: hadisplay 3 | friendly_name: "Home Assistant Display" 4 | device_description: "Smart Dashboard" 5 | 6 | lightbulb: "\U000F0335" 7 | ceiling_light: "\U000F0769" 8 | lamp: "\U000F06B5" 9 | floor_lamp: "\U000F08DD" 10 | string_lights: "\U000F12BA" 11 | clock: "\U000F0150" 12 | ceiling_fan: "\U000F1797" 13 | light_recessed: "\U000F179B" 14 | blinds_horizontal: "\U000F1A2B" 15 | blinds_horizontal_closed: "\U000F1A2C" 16 | curtains_closed: "\U000F1847" 17 | curtains: "\U000F1846" 18 | wallsconce: "\U000F091C" 19 | bed: "\U000F02E3" 20 | bed_empty: "\U000F08A0" 21 | thermometer_high: "\U000F10C2" 22 | humidity: "\U000F058E" 23 | wallsconce_variant: "\U000F091E" 24 | kiss: "\U000F0C73" 25 | hvac: "\U000F0D43" 26 | pump_icon: "\U000F058F" 27 | homeicon: "\U000F02DC" 28 | lefticon: "\U000F0141" 29 | righticon: "\U000F0142" 30 | 31 | esphome: 32 | name: ${name} 33 | platformio_options: 34 | build_flags: "-DBOARD_HAS_PSRAM" 35 | board_build.esp-idf.memory_type: qio_opi 36 | board_build.flash_mode: dio 37 | board_upload.maximum_ram_size: 524288 38 | board_build.flash_size: 8MB 39 | 40 | esp32: 41 | board: esp32-s3-devkitc-1 42 | variant: esp32s3 43 | flash_size: 8MB 44 | framework: 45 | type: esp-idf 46 | sdkconfig_options: 47 | CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: y 48 | CONFIG_ESP32S3_DATA_CACHE_64KB: y 49 | CONFIG_SPIRAM_FETCH_INSTRUCTIONS: y 50 | CONFIG_SPIRAM_RODATA: y 51 | CONFIG_ESPTOOLPY_FLASHSIZE_8MB: y 52 | 53 | psram: 54 | mode: octal 55 | speed: 80MHz 56 | 57 | # Enable logging 58 | logger: 59 | level: DEBUG 60 | hardware_uart: UART0 61 | 62 | 63 | # Enable Home Assistant API 64 | api: 65 | encryption: 66 | key: "ko9gKY/n2VCPUzYJgRY7bQvsNV4tZtbPC0boM2NseqQ=" 67 | 68 | ota: 69 | - platform: esphome 70 | password: "c3d5881ed204e27370b9de929222cb74" 71 | 72 | wifi: 73 | ssid: !secret wifi_ssid 74 | password: !secret wifi_password 75 | manual_ip: 76 | # # Set this to the IP of the ESP 77 | static_ip: 192.168.1.138 78 | # # Set this to the IP address of the router. Often ends with .1 79 | gateway: 192.168.1.1 80 | # # The subnet of the network. 255.255.255.0 works for most home networks. 81 | subnet: 255.255.255.0 82 | dns1: 192.168.1.1 83 | 84 | # # Enable fallback hotspot (captive portal) in case wifi connection fails 85 | ap: 86 | ssid: "HADisplay Fallback Hotspot" 87 | password: "11223344" 88 | 89 | web_server: 90 | port: 80 91 | 92 | external_components: 93 | # - source: github://pr#7427 94 | # components: [lvgl] 95 | 96 | # CH422G I/O Expander 97 | # https://github.com/esphome/esphome/pull/7356 98 | # - source: github://pr#7356 99 | # components: [ch422g] 100 | 101 | # rpi_dpi_rgb 102 | # https://github.com/esphome/esphome/pull/7383 103 | - source: github://pr#7383 104 | components: [rpi_dpi_rgb] 105 | 106 | 107 | 108 | time: 109 | - platform: sntp 110 | id: sntp_time 111 | timezone: "Asia/Karachi" 112 | on_time_sync: 113 | then: 114 | - script.execute: time_update 115 | on_time: 116 | - seconds: 0 117 | minutes: "*" 118 | then: 119 | - script.execute: time_update 120 | 121 | script: 122 | - id: time_update 123 | then: 124 | - lvgl.label.update: 125 | id: display_time 126 | text: !lambda |- 127 | static char time_buf[17]; 128 | auto now = id(sntp_time).now(); 129 | bool is_pm = now.hour >= 12; 130 | int hour_12 = now.hour % 12; 131 | if (hour_12 == 0) { hour_12 = 12; } 132 | snprintf(time_buf, sizeof(time_buf), "%02d:%02d", hour_12, now.minute); 133 | return time_buf; 134 | # snprintf(time_buf, sizeof(time_buf), "%02d:%02d %s", hour_12, now.minute, is_pm ? "PM" : "AM"); 135 | # - lvgl.label.update: 136 | # id: display_time 137 | # text: !lambda |- 138 | # static char time_buf[17]; 139 | # auto now = id(sntp_time).now(); 140 | # bool is_pm = now.hour >= 12; 141 | # snprintf(time_buf, sizeof(time_buf), "%s"); 142 | # ESP_LOGI("time: %s", time_buf); 143 | # return time_buf; 144 | 145 | font: 146 | - file: 147 | type: gfonts 148 | family: Roboto 149 | id: roboto24 150 | size: 24 151 | bpp: 4 152 | extras: 153 | - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/ 154 | glyphs: [ 155 | "\U000F004B", 156 | "\U000F006E", 157 | "\U000F012C", 158 | "\U000F179B", 159 | "\U000F0748", 160 | "\U000F1A1B", 161 | "\U000F02DC", 162 | "\U000F0A02", 163 | "\U000F035F", 164 | "\U000F0156", 165 | "\U000F0C5F", 166 | "\U000f0084", 167 | "\U000f0091", 168 | "\U000F058E", 169 | "\U000F10C3", 170 | "\U000F03F0", # mdi-percent 171 | "\U000F0504", # mdi- celcius 172 | "\U000F091E", 173 | "\U000F0140", # mdi-arrow_down 174 | "\U000F0141", # mdi-arrow_left 175 | "\U000F0142", # mdi-arrow_right 176 | "\U000F0143", # mdi-arrow_up 177 | ] 178 | - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/ 179 | id: weather70 180 | size: 70 181 | bpp: 4 182 | glyphs: &mdi-weather-glyphs 183 | - "\U000F0590" # mdi-weather-cloudy 184 | - "\U000F0F2F" # mdi-weather-cloudy-alert 185 | - "\U000F0E6E" # mdi-weather-cloudy-arrow-right 186 | - "\U000F0591" # mdi-weather-fog 187 | - "\U000F0592" # mdi-weather-hail 188 | - "\U000F0F30" # mdi-weather-hazy 189 | - "\U000F0898" # mdi-weather-hurricane 190 | - "\U000F0593" # mdi-weather-lightning 191 | - "\U000F067E" # mdi-weather-lightning-rainy 192 | - "\U000F0594" # mdi-weather-clear-night 193 | - "\U000F0F31" # mdi-weather-night-partly-cloudy 194 | - "\U000F0595" # mdi-weather-partly-cloudy 195 | - "\U000F0F32" # mdi-weather-partly-lightning 196 | - "\U000F0F33" # mdi-weather-partly-rainy 197 | - "\U000F0F34" # mdi-weather-partly-snowy 198 | - "\U000F0F35" # mdi-weather-partly-snowy-rainy 199 | - "\U000F0596" # mdi-weather-pouring 200 | - "\U000F0597" # mdi-weather-rainy 201 | - "\U000F0598" # mdi-weather-snowy 202 | - "\U000F0F36" # mdi-weather-snowy-heavy 203 | - "\U000F067F" # mdi-weather-snowy-rainy 204 | - "\U000F0599" # mdi-weather-sunny 205 | - "\U000F0F37" # mdi-weather-sunny-alert 206 | - "\U000F14E4" # mdi-weather-sunny-off 207 | - "\U000F059A" # mdi-weather-sunset 208 | - "\U000F059B" # mdi-weather-sunset-down 209 | - "\U000F059C" # mdi-weather-sunset-up 210 | - "\U000F0F38" # mdi-weather-tornado 211 | - "\U000F059D" # mdi-weather-windy 212 | - "\U000F059E" # mdi-weather-windy-variant 213 | 214 | - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/ 215 | id: light32 216 | size: 32 217 | bpp: 4 218 | glyphs: [ 219 | "\U000F0335", # mdi-lightbulb 220 | "\U000F0769", # mdi-ceiling-light 221 | "\U000F08DD", # mdi-floor-lamp 222 | "\U000F12BA", # mdi-string-lights 223 | "\U000F0150", # mdi-clock 224 | "\U000F1797", # mdi-ceiling_fan 225 | "\U000F179B", # mdi-light_recessed 226 | "\U000F1A2B", # mdi-blinds_horizontal 227 | "\U000F1A2C", # mdi-blinds_horizontal_closed 228 | "\U000F1847", # mdi-curtains_closed 229 | "\U000F1846", # mdi-curtains 230 | "\U000F091C", # mdi-wallsconce 231 | "\U000F02E3", # mdi-bed 232 | "\U000F08A0", # mdi-bed_empty 233 | "\U000F10C2", # mdi-thermometer_high 234 | "\U000F058E", # mdi-humidity 235 | "\U000F091E", # mdi-wallsconce_variant 236 | "\U000F0C73", # mdi-kiss 237 | "\U000F0D43", # mdi- hvac 238 | "\U000F058F", # mdi-water_pump 239 | ] 240 | 241 | - file: "gfonts://Roboto" 242 | id: roboto10 243 | size: 10 244 | bpp: 4 245 | 246 | - file: "gfonts://Roboto" 247 | id: roboto22 248 | size: 22 249 | bpp: 4 250 | 251 | - file: 252 | type: gfonts 253 | family: Roboto 254 | weight: 900 255 | id: roboto90 256 | size: 90 257 | bpp: 4 258 | 259 | - file: 260 | type: gfonts 261 | family: Roboto 262 | weight: 900 263 | id: roboto55bold 264 | bpp: 4 265 | size: 55 266 | 267 | - file: "gfonts://Roboto" 268 | id: roboto55 269 | size: 55 270 | extras: 271 | - file: "fonts/materialdesignicons-webfont.ttf" # http://materialdesignicons.com/cdn/7.4.47/ 272 | glyphs: [ 273 | "\U000F004B", 274 | "\U000F006E", 275 | "\U000F012C", 276 | "\U000F179B", 277 | "\U000F0748", 278 | "\U000F1A1B", 279 | "\U000F02DC", 280 | "\U000F0A02", 281 | "\U000F035F", 282 | "\U000F0156", 283 | "\U000F0C5F", 284 | "\U000f0084", 285 | "\U000f0091", 286 | "\U000F058E", 287 | "\U000F10C3", 288 | "\U000F03F0", # mdi-percent 289 | "\U000F0504", # mdi- celcius 290 | "\U000F091E", 291 | "\U000F0140", # mdi-arrow_down 292 | "\U000F0141", # mdi-arrow_left 293 | "\U000F0142", # mdi-arrow_right 294 | "\U000F0143", # mdi-arrow_up 295 | ] 296 | 297 | - file: 298 | type: gfonts 299 | family: Roboto 300 | weight: 900 301 | id: roboto40bold 302 | size: 40 303 | 304 | - file: "gfonts://Roboto" 305 | bpp: 4 306 | id: roboto40 307 | size: 40 308 | 309 | - file: 310 | type: gfonts 311 | family: Roboto 312 | weight: 900 313 | id: roboto30bold 314 | bpp: 4 315 | size: 30 316 | 317 | - file: "gfonts://Roboto" 318 | id: roboto30 319 | bpp: 4 320 | size: 30 321 | 322 | image: 323 | - file: "images/dashboard1.jpg" 324 | id: disp_bg 325 | resize: 800x480 326 | type: RGB565 327 | 328 | i2c: 329 | - id: bus_a 330 | sda: GPIO8 331 | scl: GPIO9 332 | scan: true 333 | 334 | ch422g: 335 | - id: io_ex 336 | # address: 0x24 337 | 338 | # Toggles backlight of Waveshare ESP32-S3-Touch-LCD-4.3 339 | switch: 340 | - platform: gpio 341 | id: backlight_switch 342 | name: "Backlight Toggle" 343 | pin: 344 | ch422g: io_ex 345 | number: 2 346 | allow_other_uses: true 347 | # CH422G saves the last state internally, but gpio switch sets state as off except when using RESTORE_ modes 348 | restore_mode: ALWAYS_ON 349 | 350 | # deep_sleep: 351 | # run_duration: 352 | # default: 30s 353 | # touch_wakeup_reason: 30s 354 | # touch_wakeup: True 355 | # sleep_duration: 10min 356 | 357 | touchscreen: 358 | platform: gt911 359 | # address: 0x5D 360 | id: my_touchscreen 361 | update_interval: 16ms 362 | interrupt_pin: 4 363 | reset_pin: 364 | ch422g: io_ex 365 | number: 1 366 | on_touch: 367 | - lambda: |- 368 | ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d", 369 | touch.x, 370 | touch.y, 371 | touch.x_raw, 372 | touch.y_raw 373 | ); 374 | on_release: 375 | - if: 376 | condition: lvgl.is_paused 377 | then: 378 | - logger.log: "LVGL resuming" 379 | - lvgl.resume: 380 | - lvgl.widget.redraw: 381 | - switch.turn_on: backlight_switch 382 | 383 | display: 384 | - platform: rpi_dpi_rgb 385 | id: my_display 386 | #rotation: 90 387 | auto_clear_enabled: false 388 | update_interval: never 389 | color_order: RGB 390 | pclk_frequency: 14MHz 391 | dimensions: 392 | width: 800 393 | height: 480 394 | de_pin: 395 | number: 5 396 | reset_pin: 397 | ch422g: io_ex 398 | number: 3 399 | enable_pin: 400 | ch422g: io_ex 401 | number: 2 402 | allow_other_uses: true 403 | hsync_pin: 404 | number: 46 405 | ignore_strapping_warning: true 406 | vsync_pin: 407 | number: 3 408 | ignore_strapping_warning: true 409 | pclk_pin: 7 410 | pclk_inverted: false 411 | hsync_back_porch: 10 412 | hsync_front_porch: 20 413 | hsync_pulse_width: 10 414 | vsync_back_porch: 10 415 | vsync_front_porch: 10 416 | vsync_pulse_width: 10 417 | data_pins: 418 | red: 419 | - 1 # R3 420 | - 2 # R4 421 | - 42 # R5 422 | - 41 # R6 423 | - 40 # R7 424 | green: 425 | - 39 # G2 426 | - 0 # G3 427 | - 45 # G4 428 | - 48 # G5 429 | - 47 # G6 430 | - 21 # G7 431 | blue: 432 | - 14 # B3 433 | - 38 # B4 434 | - 18 # B5 435 | - 17 # B6 436 | - 10 # B7 437 | 438 | #------------------------------------------- 439 | # Home Assistant Sensors 440 | #------------------------------------------- 441 | sensor: 442 | - platform: homeassistant 443 | entity_id: weather.forecast 444 | attribute: temperature 445 | id: outdoor_temp 446 | on_value: 447 | - lvgl.label.update: 448 | id: weather_label 449 | text: 450 | format: "%.1f\U000F0504" 451 | args: ["x"] 452 | 453 | - platform: homeassistant 454 | entity_id: weather.forecast 455 | attribute: humidity 456 | id: outdoor_humi 457 | on_value: 458 | - lvgl.label.update: 459 | id: weather_humidity_label 460 | text: 461 | format: "%.0f\U000F03F0" 462 | args: ["x"] 463 | 464 | - platform: homeassistant 465 | entity_id: sensor.bedroom_temperature_preserved 466 | id: bedroom_temp 467 | on_value: 468 | - lvgl.label.update: 469 | id: temp_text 470 | text: 471 | format: "\U000F10C3 %.1f \U000F0504" 472 | args: ["x"] 473 | 474 | - platform: homeassistant 475 | entity_id: sensor.bedroom_humidity_preserved 476 | id: bedroom_humi 477 | on_value: 478 | - lvgl.label.update: 479 | id: humidity_text 480 | text: 481 | format: "\U000F058E %.0f \U000F03F0" 482 | args: ["x"] 483 | 484 | - platform: homeassistant 485 | entity_id: sensor.current_load 486 | id: current_load 487 | on_value: 488 | - lvgl.label.update: 489 | id: current_load_text 490 | text: 491 | format: "%.0fW" 492 | args: ["x"] 493 | 494 | - platform: homeassistant 495 | entity_id: sensor.grid_meter_phase_a_power_2 496 | id: grid_power 497 | on_value: 498 | - lvgl.label.update: 499 | id: grid_power_text 500 | text: 501 | format: "%.3fkW" 502 | args: ["x"] 503 | 504 | - platform: homeassistant 505 | entity_id: sensor.solar_inverter_pv_output_power 506 | id: pv_power 507 | on_value: 508 | - lvgl.label.update: 509 | id: pv_power_text 510 | text: 511 | format: "%.0fW" 512 | args: ["x"] 513 | 514 | - platform: homeassistant 515 | entity_id: sensor.max_pv_power 516 | id: max_pv_power 517 | on_value: 518 | - lvgl.label.update: 519 | id: max_pv_power_text 520 | text: 521 | format: "%.0fW" 522 | args: ["x"] 523 | 524 | # - platform: homeassistant 525 | # entity_id: sensor.solar_inverter_battery_capacity 526 | # id: battery_capacity 527 | # on_value: 528 | # - lvgl.label.update: 529 | # id: battery_capacity_text 530 | 531 | - platform: homeassistant 532 | entity_id: sensor.pv_daily_production 533 | id: pv_units_today 534 | on_value: 535 | - lvgl.label.update: 536 | id: pv_units_today_text 537 | text: 538 | format: "%.1fkWh" 539 | args: ["x"] 540 | 541 | - platform: homeassistant 542 | entity_id: sensor.grid_reverse_meter 543 | id: grid_sold 544 | on_value: 545 | - lvgl.label.update: 546 | id: grid_sold_text 547 | text: 548 | format: "%.1fkWh" 549 | args: ["x"] 550 | 551 | - platform: homeassistant 552 | entity_id: sensor.grid_forward_meter 553 | id: grid_bought 554 | on_value: 555 | - lvgl.label.update: 556 | id: grid_bought_text 557 | text: 558 | format: "%.1fkWh" 559 | args: ["x"] 560 | 561 | - platform: homeassistant 562 | entity_id: sensor.daily_home_energy 563 | id: total_unit_consumed 564 | on_value: 565 | - lvgl.label.update: 566 | id: total_unit_consumed_text 567 | text: 568 | format: "%.1fkWh" 569 | args: ["x"] 570 | 571 | 572 | - platform: wifi_signal 573 | name: "WiFi Signal" 574 | id: wifi_signal_db 575 | update_interval: 60s 576 | entity_category: diagnostic 577 | internal: true 578 | 579 | - platform: copy 580 | source_id: wifi_signal_db 581 | name: "WiFi Strength" 582 | filters: 583 | - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0); 584 | unit_of_measurement: "%" 585 | entity_category: diagnostic 586 | 587 | text_sensor: 588 | - platform: template 589 | name: "Time" 590 | id: time_text 591 | update_interval: 20s 592 | lambda: |- 593 | static char time_buf[17]; 594 | auto now = id(sntp_time).now(); 595 | bool is_pm = now.hour >= 12; 596 | snprintf(time_buf, sizeof(time_buf), "%02d:%02d", now.hour, now.minute); 597 | return {time_buf}; 598 | - platform: wifi_info 599 | ip_address: 600 | name: "IP Address" 601 | entity_category: diagnostic 602 | ssid: 603 | name: "Connected SSID" 604 | entity_category: diagnostic 605 | mac_address: 606 | name: "Mac Address" 607 | entity_category: diagnostic 608 | 609 | number: 610 | - platform: template 611 | name: LVGL Screen timeout 612 | optimistic: true 613 | id: display_timeout 614 | unit_of_measurement: "s" 615 | initial_value: 45 616 | restore_value: true 617 | min_value: 10 618 | max_value: 180 619 | step: 5 620 | mode: box 621 | 622 | binary_sensor: 623 | # - platform: esp32_touch 624 | # id: my_touchscreen 625 | - platform: homeassistant 626 | id: bedroom_light 627 | entity_id: light.bedroom_light_2 628 | publish_initial_state: true 629 | on_state: 630 | then: 631 | lvgl.widget.update: 632 | id: lv_button_1 633 | state: 634 | checked: !lambda return x; 635 | - platform: homeassistant 636 | id: living_room_light 637 | entity_id: light.living_room_light_2 638 | publish_initial_state: true 639 | on_state: 640 | then: 641 | lvgl.widget.update: 642 | id: lv_button_2 643 | state: 644 | checked: !lambda return x; 645 | - platform: homeassistant 646 | id: backyard_light_switch 647 | entity_id: switch.backyard_light_switch_1_2 648 | publish_initial_state: true 649 | on_state: 650 | then: 651 | lvgl.widget.update: 652 | id: lv_backyard_light_btn 653 | state: 654 | checked: !lambda return x; 655 | - platform: homeassistant 656 | id: frontyard_light_switch 657 | entity_id: switch.frontyard_light_switch_1_2 658 | publish_initial_state: true 659 | on_state: 660 | then: 661 | lvgl.widget.update: 662 | id: lv_frontyard_light_btn 663 | state: 664 | checked: !lambda return x; 665 | - platform: homeassistant 666 | id: water_pump_switch 667 | entity_id: switch.water_pump_switch_1 668 | publish_initial_state: true 669 | on_state: 670 | then: 671 | lvgl.widget.update: 672 | id: lv_button_3 673 | state: 674 | checked: !lambda return x; 675 | 676 | color: 677 | - id: text_color 678 | hex: FFFFFF 679 | - id: light_red 680 | hex: FF3340 681 | - id: red 682 | hex: FF0000 683 | - id: white 684 | hex: FFFFFF 685 | - id: light_blue 686 | hex: 009EFF 687 | - id: grey 688 | hex: 989898 689 | - id: light_green 690 | hex: A8F698 691 | - id: orange 692 | hex: CC5E14 693 | - id: green 694 | hex: 2CAE65 695 | - id: blue 696 | hex: 3792CB 697 | - id: dark_blue 698 | hex: 0000FF 699 | 700 | 701 | #------------------------------------------- 702 | # lvgl Buttons 703 | #------------------------------------------- 704 | lvgl: 705 | touchscreens: 706 | - touchscreen_id: my_touchscreen 707 | on_idle: 708 | timeout: !lambda "return (id(display_timeout).state * 1000);" 709 | then: 710 | - logger.log: "LVGL is idle" 711 | - switch.turn_off: backlight_switch 712 | - lvgl.pause: 713 | color_depth: 16 714 | disp_bg_image: disp_bg 715 | page_wrap: true 716 | bg_opa: TRANSP 717 | style_definitions: 718 | - id: style_line 719 | line_color: 0x0000FF 720 | line_width: 8 721 | line_rounded: true 722 | - id: date_style 723 | text_font: roboto24 724 | align: center 725 | text_color: 0x333333 726 | bg_opa: cover 727 | radius: 4 728 | pad_all: 2 729 | 730 | ####Header_Footer########## 731 | - id: header_footer 732 | bg_color: 0x1b1b1b 733 | bg_grad_color: 0x1b1b1b 734 | bg_grad_dir: VER 735 | bg_opa: COVER 736 | border_width: 0 737 | radius: 0 738 | pad_all: 0 739 | pad_row: 0 740 | pad_column: 0 741 | border_color: 0x0077b3 742 | text_color: 0xFFFFFF 743 | width: 100% 744 | height: 40 745 | theme: 746 | buttonmatrix: 747 | bg_opa: TRANSP 748 | # border_color: 0x0077b3 749 | # border_width: 0 750 | text_color: 0xFFFFFF 751 | pad_all: 0 752 | items: # set all your buttonmatrix buttons to use your custom defined styles and font 753 | bg_color: 0x1b1b1b 754 | bg_grad_color: 0x1b1b1b 755 | bg_grad_dir: VER 756 | bg_opa: COVER 757 | # border_color: 0x0077b3 758 | # border_width: 1 759 | text_color: 0xFFFFFF 760 | text_font: roboto24 761 | pressed: 762 | bg_color: 0xFF6700 763 | bg_grad_color: 0xa6521b 764 | checked: 765 | bg_color: 0xFF6700 766 | bg_grad_color: 0x03324A 767 | text_color: 0x005580 768 | button: 769 | text_font: roboto24 770 | scroll_on_focus: true 771 | radius: 5 772 | width: 100 773 | height: 150 774 | pad_left: 10px 775 | pad_top: 10px 776 | pad_bottom: 10px 777 | pad_right: 10px 778 | shadow_width: 0 779 | bg_color: 0x000000 780 | border_width: 3 781 | border_color: white 782 | border_side: ['TOP', 'BOTTOM', 'LEFT', 'RIGHT'] 783 | text_color: text_color 784 | checked: 785 | bg_color: 0xCC5E14 # Orange 786 | # bg_color: green # Green 787 | # bg_color: 0x026a6e # Dark Green 788 | #bg_color: 0x0000FF # Blue 789 | #bg_color: 0x3792CB # Blue 790 | text_color: text_color 791 | obj: 792 | text_font: roboto24 793 | scroll_on_focus: true 794 | radius: 5 795 | width: 400 796 | height: 150 797 | pad_left: 10px 798 | pad_top: 10px 799 | pad_bottom: 10px 800 | pad_right: 10px 801 | shadow_width: 0 802 | bg_color: 0x000000 803 | border_width: 3 804 | border_color: white 805 | border_side: ['TOP', 'BOTTOM', 'LEFT', 'RIGHT'] 806 | text_color: text_color 807 | top_layer: 808 | widgets: 809 | - buttonmatrix: 810 | align: bottom_mid 811 | styles: header_footer 812 | pad_all: 0 813 | outline_width: 0 814 | id: top_layer 815 | items: 816 | styles: header_footer 817 | rows: 818 | - buttons: 819 | - id: page_prev 820 | text: $lefticon 821 | on_press: 822 | then: 823 | - lvgl.page.previous: 824 | animation: OUT_RIGHT 825 | time: 300ms 826 | - id: page_home 827 | text: $homeicon 828 | on_press: 829 | then: 830 | lvgl.page.show: main_page 831 | - id: page_next 832 | text: $righticon 833 | on_press: 834 | then: 835 | - lvgl.page.next: 836 | animation: OUT_LEFT 837 | time: 300ms 838 | # - label: 839 | # text_font: roboto24 840 | # text: "- %" 841 | # id: humidity_text 842 | # align: top_right 843 | # x: -20 844 | # y: 7 845 | # # text_align: right 846 | # text_color: 0xFFFFFF 847 | 848 | # - label: 849 | # text_font: roboto24 850 | # text: "-.-°C" 851 | # id: temp_text 852 | # align: top_left 853 | # x: 12 854 | # y: 7 855 | # text_color: 0xFFFFFF 856 | pages: 857 | - id: main_page 858 | layout: 859 | type: grid 860 | grid_row_align: CENTER 861 | grid_column_align: CENTER 862 | grid_rows: [150px, 150px] 863 | grid_columns: [400px, 100px, 100px, 100px] 864 | pad_row: 20px 865 | pad_column: 20px 866 | width: 100% 867 | pad_all: 5 868 | widgets: 869 | - obj: 870 | checkable: true 871 | id: lv_clock_obj 872 | grid_cell_row_pos: 0 873 | grid_cell_column_pos: 0 874 | width: 400 875 | height: 150 876 | pad_left: 10px 877 | pad_top: 10px 878 | pad_bottom: 10px 879 | pad_right: 10px 880 | widgets: 881 | - label: 882 | text_font: roboto90 883 | text: "00:00" 884 | id: display_time 885 | align: center 886 | text_align: 'CENTER' 887 | text_color: 0xFFFFFF 888 | 889 | - obj: 890 | checkable: true 891 | id: lv_weather_obj 892 | grid_cell_row_pos: 1 893 | grid_cell_column_pos: 0 894 | layout: # enable the FLEX layout for the children widgets 895 | type: FLEX 896 | flex_flow: ROW # the order of the widgets starts top left 897 | flex_align_main: CENTER 898 | flex_align_cross: START 899 | flex_align_track: CENTER 900 | widgets: 901 | - label: 902 | text_font: roboto55 903 | text: "--.-" 904 | id: weather_label 905 | text_align: center 906 | text_color: 0xFFFFFF 907 | - label: 908 | text_font: roboto55 909 | text: "--" 910 | id: weather_humidity_label 911 | text_align: center 912 | text_color: 0xFFFFFF 913 | - button: 914 | checkable: true 915 | id: lv_button_1 916 | grid_cell_row_pos: 0 917 | grid_cell_column_pos: 1 918 | widgets: 919 | - label: 920 | text_font: light32 921 | align: top_left 922 | text: $lightbulb 923 | id: lv_button_1_icon 924 | - label: 925 | text_font: roboto22 926 | align: bottom_mid 927 | text: "Bedroom" 928 | long_mode: dot 929 | on_short_click: 930 | - homeassistant.service: 931 | service: light.toggle 932 | data: 933 | entity_id: light.bedroom_light_2 934 | - button: 935 | checkable: true 936 | id: lv_button_2 937 | grid_cell_row_pos: 0 938 | grid_cell_column_pos: 2 939 | widgets: 940 | - label: 941 | text_font: light32 942 | align: top_left 943 | text: $lightbulb 944 | id: lv_button_2_icon 945 | - label: 946 | text_font: roboto22 947 | align: bottom_mid 948 | text: "Kitchen" 949 | long_mode: dot 950 | on_short_click: 951 | - homeassistant.service: 952 | service: light.toggle 953 | data: 954 | entity_id: light.living_room_light_2 955 | - obj: 956 | checkable: true 957 | id: lv_room_obj 958 | grid_cell_row_pos: 0 959 | grid_cell_column_pos: 3 960 | width: 100 961 | height: 150 962 | pad_left: 10px 963 | pad_top: 10px 964 | pad_bottom: 10px 965 | pad_right: 10px 966 | widgets: 967 | - label: 968 | text_font: roboto24 969 | text: "--.-" 970 | id: temp_text 971 | align: top_mid 972 | text_align: 'CENTER' 973 | text_color: 0xFFFFFF 974 | - label: 975 | text_font: roboto24 976 | text: "--" 977 | id: humidity_text 978 | align: bottom_mid 979 | text_align: 'CENTER' 980 | text_color: 0xFFFFFF 981 | 982 | - button: 983 | checkable: true 984 | id: lv_frontyard_light_btn 985 | grid_cell_row_pos: 1 986 | grid_cell_column_pos: 1 987 | widgets: 988 | - label: 989 | text_font: light32 990 | align: top_left 991 | text: $lightbulb 992 | id: lv_frontyard_light_icon 993 | - label: 994 | text_font: roboto22 995 | align: bottom_mid 996 | text: "Frontyard" 997 | long_mode: dot 998 | on_short_click: 999 | - homeassistant.service: 1000 | service: switch.toggle 1001 | data: 1002 | entity_id: switch.frontyard_light_switch_1_2 1003 | - button: 1004 | checkable: true 1005 | id: lv_backyard_light_btn 1006 | grid_cell_row_pos: 1 1007 | grid_cell_column_pos: 2 1008 | widgets: 1009 | - label: 1010 | text_font: light32 1011 | align: top_left 1012 | text: $lightbulb 1013 | id: lv_backyard_light_icon 1014 | - label: 1015 | text_font: roboto22 1016 | align: bottom_mid 1017 | text: "Backyard" 1018 | long_mode: dot 1019 | on_short_click: 1020 | - homeassistant.service: 1021 | service: switch.toggle 1022 | data: 1023 | entity_id: switch.backyard_light_switch_1_2 1024 | - button: 1025 | checkable: true 1026 | id: lv_button_3 1027 | grid_cell_row_pos: 1 1028 | grid_cell_column_pos: 3 1029 | widgets: 1030 | - label: 1031 | text_font: light32 1032 | align: top_left 1033 | text: $pump_icon 1034 | id: lv_button_3_icon 1035 | - label: 1036 | text_font: roboto22 1037 | align: bottom_mid 1038 | text: "Water" 1039 | long_mode: dot 1040 | on_short_click: 1041 | - homeassistant.service: 1042 | service: switch.toggle 1043 | data: 1044 | entity_id: switch.water_pump_switch_1 1045 | - id: power_page 1046 | layout: 1047 | type: grid 1048 | grid_row_align: CENTER 1049 | grid_column_align: CENTER 1050 | grid_rows: [150px, 150px] 1051 | grid_columns: [175px, 175px, 175px, 175px] 1052 | pad_row: 20px 1053 | pad_column: 20px 1054 | width: 100% 1055 | pad_all: 5 1056 | widgets: 1057 | - obj: 1058 | grid_cell_row_pos: 0 1059 | grid_cell_column_pos: 0 1060 | width: 175 1061 | height: 150 1062 | pad_left: 10px 1063 | pad_top: 10px 1064 | pad_bottom: 10px 1065 | pad_right: 10px 1066 | widgets: 1067 | - label: 1068 | text_font: roboto30bold 1069 | text: "---" 1070 | id: current_load_text 1071 | align: center 1072 | text_align: 'CENTER' 1073 | text_color: 0xFFFFFF 1074 | - label: 1075 | text_font: roboto22 1076 | text: "Current Load" 1077 | align: bottom_mid 1078 | text_align: 'CENTER' 1079 | text_color: 0xFFFFFF 1080 | - obj: 1081 | grid_cell_row_pos: 0 1082 | grid_cell_column_pos: 1 1083 | width: 175 1084 | height: 150 1085 | pad_left: 10px 1086 | pad_top: 10px 1087 | pad_bottom: 10px 1088 | pad_right: 10px 1089 | widgets: 1090 | - label: 1091 | text_font: roboto30bold 1092 | text: "---" 1093 | id: grid_power_text 1094 | align: center 1095 | text_align: 'CENTER' 1096 | text_color: 0xFFFFFF 1097 | - label: 1098 | text_font: roboto22 1099 | text: "Grid Power" 1100 | align: bottom_mid 1101 | text_align: 'CENTER' 1102 | text_color: 0xFFFFFF 1103 | - obj: 1104 | grid_cell_row_pos: 0 1105 | grid_cell_column_pos: 2 1106 | width: 175 1107 | height: 150 1108 | pad_left: 10px 1109 | pad_top: 10px 1110 | pad_bottom: 10px 1111 | pad_right: 10px 1112 | widgets: 1113 | - label: 1114 | text_font: roboto30bold 1115 | text: "---" 1116 | id: pv_power_text 1117 | align: center 1118 | text_align: 'CENTER' 1119 | text_color: 0xFFFFFF 1120 | - label: 1121 | text_font: roboto22 1122 | text: "PV Power" 1123 | align: bottom_mid 1124 | text_align: 'CENTER' 1125 | text_color: 0xFFFFFF 1126 | - obj: 1127 | grid_cell_row_pos: 0 1128 | grid_cell_column_pos: 3 1129 | width: 175 1130 | height: 150 1131 | pad_left: 10px 1132 | pad_top: 10px 1133 | pad_bottom: 10px 1134 | pad_right: 10px 1135 | widgets: 1136 | - label: 1137 | text_font: roboto30bold 1138 | text: "---" 1139 | id: max_pv_power_text 1140 | align: center 1141 | text_align: 'CENTER' 1142 | text_color: 0xFFFFFF 1143 | - label: 1144 | text_font: roboto22 1145 | text: "Max PV" 1146 | align: bottom_mid 1147 | text_align: 'CENTER' 1148 | text_color: 0xFFFFFF 1149 | - obj: 1150 | grid_cell_row_pos: 1 1151 | grid_cell_column_pos: 0 1152 | width: 175 1153 | height: 150 1154 | pad_left: 10px 1155 | pad_top: 10px 1156 | pad_bottom: 10px 1157 | pad_right: 10px 1158 | widgets: 1159 | - label: 1160 | text_font: roboto30bold 1161 | text: "---" 1162 | id: pv_units_today_text 1163 | align: center 1164 | text_align: 'CENTER' 1165 | text_color: 0xFFFFFF 1166 | - label: 1167 | text_font: roboto22 1168 | text: "PV Units" 1169 | align: bottom_mid 1170 | text_align: 'CENTER' 1171 | text_color: 0xFFFFFF 1172 | - obj: 1173 | grid_cell_row_pos: 1 1174 | grid_cell_column_pos: 1 1175 | width: 175 1176 | height: 150 1177 | pad_left: 10px 1178 | pad_top: 10px 1179 | pad_bottom: 10px 1180 | pad_right: 10px 1181 | widgets: 1182 | - label: 1183 | text_font: roboto30bold 1184 | text: "---" 1185 | id: grid_sold_text 1186 | align: center 1187 | text_align: 'CENTER' 1188 | text_color: 0xFFFFFF 1189 | - label: 1190 | text_font: roboto22 1191 | text: "Grid Sold" 1192 | align: bottom_mid 1193 | text_align: 'CENTER' 1194 | text_color: 0xFFFFFF 1195 | - obj: 1196 | grid_cell_row_pos: 1 1197 | grid_cell_column_pos: 2 1198 | width: 175 1199 | height: 150 1200 | pad_left: 10px 1201 | pad_top: 10px 1202 | pad_bottom: 10px 1203 | pad_right: 10px 1204 | widgets: 1205 | - label: 1206 | text_font: roboto30bold 1207 | text: "---" 1208 | id: grid_bought_text 1209 | align: center 1210 | text_align: 'CENTER' 1211 | text_color: 0xFFFFFF 1212 | - label: 1213 | text_font: roboto22 1214 | text: "Grid Used" 1215 | align: bottom_mid 1216 | text_align: 'CENTER' 1217 | text_color: 0xFFFFFF 1218 | - obj: 1219 | grid_cell_row_pos: 1 1220 | grid_cell_column_pos: 3 1221 | width: 175 1222 | height: 150 1223 | pad_left: 10px 1224 | pad_top: 10px 1225 | pad_bottom: 10px 1226 | pad_right: 10px 1227 | widgets: 1228 | - label: 1229 | text_font: roboto30bold 1230 | text: "---" 1231 | id: total_unit_consumed_text 1232 | align: center 1233 | text_align: 'CENTER' 1234 | text_color: 0xFFFFFF 1235 | - label: 1236 | text_font: roboto22 1237 | text: "Total Used" 1238 | align: bottom_mid 1239 | text_align: 'CENTER' 1240 | text_color: 0xFFFFFF 1241 | -------------------------------------------------------------------------------- /images/dashboard1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamfaraz/Waveshare_ST7262_ESPHome_LVGL/547ac76877eebb7ebe040238e81a532845b69bc2/images/dashboard1.jpg -------------------------------------------------------------------------------- /secrets.yaml: -------------------------------------------------------------------------------- 1 | # Your Wi-Fi SSID and password 2 | wifi_ssid: "SSID" 3 | wifi_password: "PASSWORD" 4 | --------------------------------------------------------------------------------