Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: bathroom_display
- friendly_name: Display
- esp32:
- board: esp32dev
- framework:
- type: arduino
- # Enable logging
- logger:
- external_components:
- - source: github://clydebarrow/esphome@lvgl
- refresh: 10min
- components: [lvgl]
- # Enable Home Assistant API
- api:
- encryption:
- key: "xxxx"
- on_client_connected:
- - if:
- condition:
- lambda: 'return (0 == client_info.find("Home Assistant"));'
- then:
- - lvgl.widget.show: lbl_hastatus
- on_client_disconnected:
- - if:
- condition:
- lambda: 'return (0 == client_info.find("Home Assistant"));'
- then:
- - lvgl.widget.hide: lbl_hastatus
- ota:
- - platform: esphome
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- fast_connect: True
- manual_ip:
- static_ip: 192.xxx
- gateway: 192.xxx
- subnet: 255.255.255.0
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Esphome-Web-9B75D8"
- password: "xxx"
- captive_portal:
- i2c:
- sda: GPIO21
- scl: GPIO22
- scan: true
- frequency: 10kHz
- uart:
- - id: uart_1
- rx_pin: GPIO25
- tx_pin: GPIO27
- baud_rate: 115200
- parity: NONE
- stop_bits: 1
- spi:
- clk_pin: GPIO18
- mosi_pin: GPIO23
- miso_pin: GPIO19
- # Define a PWM output on the ESP32
- output:
- - platform: ledc
- pin: GPIO0
- id: gpio_32_backlight_pwm
- frequency: 100Hz
- # Define a monochromatic, dimmable light for the backlight
- light:
- - platform: monochromatic
- output: gpio_32_backlight_pwm
- name: "Bathroom Display Backlight"
- id: back_light
- restore_mode: ALWAYS_ON
- ld2420:
- number:
- - platform: ld2420
- presence_timeout:
- name: Detection Presence Timeout
- min_gate_distance:
- name: Detection Gate Minimum
- max_gate_distance:
- name: Detection Gate Maximum
- # See "Number" section below for detail
- gate_select:
- name: Select Gate to Set
- still_threshold:
- name: Set Still Threshold Value
- move_threshold:
- name: Set Move Threshold Value
- gate_move_sensitivity:
- name: Move Calibration Sensitivity Factor
- gate_still_sensitivity:
- name: Still Calibration Sensitivity Factor
- button:
- - platform: ld2420
- apply_config:
- name: Apply Config
- factory_reset:
- name: Factory Reset
- restart_module:
- name: Restart Module
- revert_config:
- name: Undo Edits
- select:
- - platform: ld2420
- operating_mode:
- name: Operating Mode
- touchscreen:
- platform: xpt2046
- id: my_touchscreen
- cs_pin: GPIO17
- #interrupt_pin: 16
- update_interval: 50ms
- threshold: 400
- calibration:
- x_min: 351
- x_max: 3762
- y_min: 215
- y_max: 3644
- transform:
- swap_xy: true
- mirror_x: false
- mirror_y: false
- on_touch:
- - lambda: |-
- ESP_LOGI("cal", "x=%d, y=%d, x_raw=%d, y_raw=%0d",
- touch.x,
- touch.y,
- touch.x_raw,
- touch.y_raw
- );
- display:
- - platform: ili9xxx
- id: my_display
- model: ST7789V
- #color_order: rgb
- cs_pin: GPIO26 #display CS
- update_interval: never
- auto_clear_enabled: false
- dc_pin: GPIO5 #display DC
- dimensions:
- width: 320
- height: 240
- reset_pin: GPIO15 #display RESET
- #rotation: 90
- data_rate: 40MHz
- show_test_card: false
- transform:
- swap_xy: true
- mirror_x: true
- mirror_y: false
- font:
- - file: "gfonts://Gabarito@700"
- id: gabarito50
- size: 50
- bpp: 4
- extras:
- - file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
- glyphs: [
- "\U000F004B",
- "\U0000f0ed",
- "\U000F006E",
- "\U000F012C",
- "\U000F179B",
- "\U000F0748",
- "\U000F1A1B",
- "\U000F02DC",
- "\U000F0A02",
- "\U000F035F",
- "\U000F0156",
- "\U000F0C5F",
- "\U000f0084",
- "\U000f0091",
- ]
- - file: "gfonts://Gabarito@700"
- id: gabarito40
- size: 40
- bpp: 4
- - file: "gfonts://Gabarito@700"
- id: gabarito15
- size: 15
- bpp: 4
- - file: "gfonts://Gabarito@700"
- id: gabarito30
- size: 30
- bpp: 4
- - file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
- id: weather70
- size: 70
- bpp: 4
- glyphs: &mdi-weather-glyphs
- - "\U000F0590" # mdi-weather-cloudy
- - "\U000F0F2F" # mdi-weather-cloudy-alert
- - "\U000F0E6E" # mdi-weather-cloudy-arrow-right
- - "\U000F0591" # mdi-weather-fog
- - "\U000F0592" # mdi-weather-hail
- - "\U000F0F30" # mdi-weather-hazy
- - "\U000F0898" # mdi-weather-hurricane
- - "\U000F0593" # mdi-weather-lightning
- - "\U000F067E" # mdi-weather-lightning-rainy
- - "\U000F0594" # mdi-weather-clear-night
- - "\U000F0F31" # mdi-weather-night-partly-cloudy
- - "\U000F0595" # mdi-weather-partly-cloudy
- - "\U000F0F32" # mdi-weather-partly-lightning
- - "\U000F0F33" # mdi-weather-partly-rainy
- - "\U000F0F34" # mdi-weather-partly-snowy
- - "\U000F0F35" # mdi-weather-partly-snowy-rainy
- - "\U000F0596" # mdi-weather-pouring
- - "\U000F0597" # mdi-weather-rainy
- - "\U000F0598" # mdi-weather-snowy
- - "\U000F0F36" # mdi-weather-snowy-heavy
- - "\U000F067F" # mdi-weather-snowy-rainy
- - "\U000F0599" # mdi-weather-sunny
- - "\U000F0F37" # mdi-weather-sunny-alert
- - "\U000F14E4" # mdi-weather-sunny-off
- - "\U000F059A" # mdi-weather-sunset
- - "\U000F059B" # mdi-weather-sunset-down
- - "\U000F059C" # mdi-weather-sunset-up
- - "\U000F0F38" # mdi-weather-tornado
- - "\U000F059D" # mdi-weather-windy
- - "\U000F059E" # mdi-weather-windy-variant
- - file: 'fonts/materialdesignicons-webfont.ttf' # http://materialdesignicons.com/cdn/7.4.47/
- id: light32
- size: 50
- bpp: 4
- glyphs: [
- "\U000F0335", # mdi-lightbulb
- "\U000F0769", # mdi-ceiling-light
- "\U000F08DD", # mdi-floor-lamp
- "\U000F12BA", # mdi-string-lights
- "\U000F0210", # mdi-fan
- "\U000F0737", # mdi-up
- ]
- - file: "gfonts://Roboto@400"
- id: roboto20
- size: 20
- bpp: 4
- substitutions:
- lightbulb: "\U000F0335"
- ceiling_light: "\U000F0769"
- floor_lamp: "\U000F08DD"
- string_lights: "\U000F12BA"
- fan: "\U000F0210"
- up: "\U000F0737"
- image:
- - file: "images/humidity.png"
- id: humidity
- resize: 28x28
- type: RGB565
- use_transparency: true
- - file: "images/temp.png"
- id: temp
- resize: 23x23
- type: RGB565
- use_transparency: true
- - file: "images/back.jpg"
- id: background
- resize: 340x260
- type: RGB565
- lvgl:
- displays:
- - display_id: my_display
- buffer_size: 0.25
- touchscreens:
- - touchscreen_id: my_touchscreen
- style_definitions:
- - id: header_footer
- #bg_color: 0x3d3533
- #bg_grad_color: 0x005782
- #bg_grad_dir: VER
- bg_opa: TRANSP
- border_width: 1
- radius: 0
- pad_all: 0
- pad_row: 0
- pad_column: 0
- border_color: 0x3d3533
- text_color: 0xFFFFFF
- width: 100%
- height: 35
- disp_bg_image: background
- color_depth: 16
- bg_opa: TRANSP
- top_layer:
- widgets:
- - label:
- text: "\uF1EB"
- id: lbl_hastatus
- hidden: true
- align: top_right
- x: -2
- y: -2
- text_align: right
- text_color: 0x04cf19
- - btnmatrix:
- align: bottom_mid
- styles: header_footer
- pad_all: 0
- outline_width: 0
- id: top_layer
- items:
- styles: header_footer
- rows:
- - buttons:
- - id: page_prev
- text: "\uF053"
- on_press:
- then:
- - lvgl.page.previous:
- - id: page_home
- text: "\uF015"
- on_press:
- then:
- lvgl.page.show: main_page
- - id: page_next
- text: "\uF054"
- on_press:
- then:
- lvgl.page.next:
- pages:
- - id: main_page
- bg_color: 0x000000
- widgets:
- - obj: # Bathroom Widget
- height: 85
- width: 210
- bg_opa: 0.35
- bg_color: 0x000000
- border_width: 0
- outline_width: 0
- shadow_width: 0
- pad_all: 4
- x: 2
- y: 20
- widgets:
- - img:
- id: hum_icon
- src: humidity
- x: 145
- y: 1
- - img:
- id: temp_icon
- src: temp
- x: 50
- y: 1
- - label:
- text: "°C"
- text_font: gabarito15
- text_color: 0xcccccc
- x: 96
- y: 50
- text_align: right
- - label:
- text: "%"
- text_font: gabarito15
- text_color: 0xcccccc
- x: 187
- y: 50
- - label:
- id: temperature_text
- text: "-.-°C"
- y: 17
- text_font: gabarito50
- text_align: right
- text_color: 0xFFFFFF
- #scrollbar_mode: "off"
- - label:
- id: hum_text
- text: "-.-%"
- x: 130
- y: 17
- text_font: gabarito50
- text_align: right
- text_color: 0xFFFFFF
- - obj: # Outside Weather
- height: 75
- width: 210
- bg_opa: 0.35
- bg_color: 0x000000
- border_width: 0
- outline_width: 0
- shadow_width: 0
- pad_all: 4
- x: 2
- y: 125
- widgets:
- - label:
- text: "OUTSIDE"
- align: top_mid
- text_align: center
- text_color: 0xFFFFFF
- text_font: gabarito15
- - label:
- id: outside_temp_disp
- text: "-.-°C"
- y: 17
- text_font: gabarito30
- text_align: right
- text_color: 0xFFFFFF
- - label:
- text: "°C"
- y: 30
- x: 55
- text_font: gabarito15
- text_align: right
- text_color: 0xcccccc
- - label:
- id: outside_cond_disp
- text: "null"
- x: 80
- y: 17
- text_font: roboto20
- text_align: right
- text_color: 0xFFFFFF
- - label:
- text: "BATHROOM"
- align: top_mid
- text_align: center
- text_color: 0xFFFFFF
- text_font: gabarito15
- - btn:
- id: light_btn
- x: 230
- y: 22
- width: 80
- height: 80
- bg_color: 0x000000
- border_width: 3
- border_color: 0xff8800
- checkable: true
- widgets:
- - label:
- align: center
- text: $ceiling_light
- text_font: light32
- on_click:
- - homeassistant.service:
- service: light.toggle
- data:
- entity_id: light.main_light_bt
- - btn:
- id: fan_btn
- x: 230
- y: 114
- width: 80
- height: 80
- bg_color: 0x000000
- border_width: 3
- border_color: 0xff8800
- checkable: true
- widgets:
- - label:
- align: center
- text: $fan
- text_font: light32
- on_click:
- - homeassistant.service:
- service: fan.toggle
- data:
- entity_id: fan.bathroom_fan
- binary_sensor:
- - platform: ld2420
- has_target:
- name: Presence Bathroom
- - platform: homeassistant
- id: remote_light
- entity_id: light.main_light_bt
- publish_initial_state: true
- on_state:
- then:
- lvgl.widget.update:
- id: light_btn
- state:
- checked: !lambda return x;
- - platform: homeassistant
- id: bathroom_fan
- entity_id: fan.bathroom_fan
- publish_initial_state: true
- on_state:
- then:
- lvgl.widget.update:
- id: fan_btn
- state:
- checked: !lambda return x;
- - platform: homeassistant
- id: hygrostat
- entity_id: binary_sensor.bathroom_hygrostat
- publish_initial_state: True
- - platform: gpio
- pin: GPIO33
- name: Bathroom Motion
- device_class: motion
- sensor:
- - platform: ld2420
- moving_distance:
- name : Moving Distance Bathroom
- - platform: shtcx
- temperature:
- name: "Bathroom Temperature"
- id: bathroom_temp
- filters:
- - offset: -2.5
- on_value:
- - lvgl.label.update:
- id: temperature_text
- text:
- format: "%.1f"
- args: [ 'x' ]
- humidity:
- name: "Bathroom Humidity"
- id: bathroom_hum
- filters:
- - offset: -5
- on_value:
- - lvgl.label.update:
- id: hum_text
- text:
- format: "%.0f"
- args: [ 'x' ]
- address: 0x70
- update_interval: 30s
- - platform: homeassistant
- id: outside_temp
- entity_id: sensor.outside_sensor_temperature
- on_value:
- - lvgl.label.update:
- id: outside_temp_disp
- text:
- format: "%.1f"
- args: [ 'x' ]
- text_sensor:
- - platform: ld2420
- fw_version:
- name: LD2420 Firmware
- - platform: homeassistant
- id: outside_condition
- entity_id: sensor.openweathermap_condition
- filters:
- - to_upper
- on_value:
- - lvgl.label.update:
- id: outside_cond_disp
- text:
- format: "%s"
- args: [ 'id(outside_condition).state.c_str()' ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement