diff --git a/thermostat.yml b/thermostat.yml index 0aee503..5f54977 100644 --- a/thermostat.yml +++ b/thermostat.yml @@ -125,12 +125,15 @@ sensor: humidity: name: "Humidity" id: humidity + filters: + - round: 1 on_value: then: - lvgl.label.update: id: humidity_label text: !lambda |- - return to_string(' : ') + to_string(x) + to_string('%'); + auto hum = " " + str_truncate(to_string(x), 4) + "%"; + return hum; pressure: name: "Pressure" @@ -161,6 +164,71 @@ sensor: unit_of_measurement: °C icon: 'mdi:thermometer-alert' +mapping: + - id: weather_mapping + from: string + to: string + entries: + Clear: "󰖙" + light-rain: "󰖗" + medium-rain: "󰖗" + heavy-rain: "󰖗" +text_sensor: + - platform: homeassistant + id: weather + entity_id: sensor.pirateweather_summary + on_value: + then: + - lvgl.label.update: + id: out_weather_label + text: !lambda |- + return id(weather_mapping)[x]; + - platform: homeassistant + id: weather_summary + entity_id: sensor.pirateweather_minutely_summary + on_value: + then: + - lvgl.label.update: + id: out_weather_sum_label + text: !lambda |- + return x; + - platform: homeassistant + id: weather_temp + entity_id: sensor.pirateweather_temperature + on_value: + then: + - lvgl.label.update: + id: out_temp_label + text: !lambda |- + auto temp = " " + x + "°"; + return temp; + - platform: homeassistant + id: weather_hum + entity_id: weather.pirateweather + attribute: humidity + # on_value: + # then: + # - lvgl.label.update: + # id: out_hum_label + # text: !lambda |- + # auto hum = " " + x + "%"; + # return hum; + - platform: homeassistant + id: weather_dew + entity_id: weather.pirateweather + attribute: dew_point + # on_value: + # then: + # - lvgl.label.update: + # id: out_dew_label + # text: !lambda |- + # auto temp = "󰏈 " + x + "°"; + # return temp; + # - platform: template + # id: weather_temp + # entity_id: weather.pirateweather + # attribute: temperature + switch: - platform: homeassistant id: heater @@ -382,6 +450,14 @@ climate: state: checked: true +# output: +# - platform: gpio +# id: backlight +# pin: +# ch422g: +# number: 2 +# allow_other_uses: true + # Example minimal configuration entry display: - platform: rpi_dpi_rgb @@ -398,7 +474,7 @@ display: number: 3 enable_pin: ch422g: - allow_other_uses: true + # allow_other_uses: true number: 2 de_pin: number: 5 @@ -408,7 +484,9 @@ display: vsync_pin: number: 3 ignore_strapping_warning: true - pclk_pin: 7 + pclk_pin: + number: 7 + # allow_other_uses: true hsync_back_porch: 30 hsync_front_porch: 210 hsync_pulse_width: 30 @@ -427,6 +505,25 @@ font: weight: 500 id: h2 size: 40 + extras: + - file: "fonts/vm.ttf" + glyphs: [ + "󰖩", # nf:wifi + "", # nf:up + "", # nf:down + "󱖞", # nf:off + "", # nf:humidity + "", # nf:temp + "󰏈", # nf:dew + "󰖙", # nf:clear + "󰖗", # nf:rain + "󰖘", # nf:snow + "󰖕", # nf:partlycloudy + "󰖓", # nf:stormy + "󰖐", # nf:cloudy + "󰖔", # nf:night + "󰼱", # nf:cloudynight + ] - file: type: gfonts family: Quicksand @@ -441,6 +538,16 @@ font: "", # nf:down "󱖞", # nf:off "", # nf:humidity + "", # nf:temp + "󰏈", # nf:dew + "󰖙", # nf:clear + "󰖗", # nf:rain + "󰖘", # nf:snow + "󰖕", # nf:partlycloudy + "󰖓", # nf:stormy + "󰖐", # nf:cloudy + "󰖔", # nf:night + "󰼱", # nf:cloudynight ] - file: type: gfonts @@ -535,37 +642,33 @@ touchscreen: touch.x_raw, touch.y_raw ); - on_release: - then: - - if: - condition: lvgl.is_paused - then: - - lvgl.resume: - - lvgl.widget.redraw: - - switch.turn_on: display_backlight + # on_release: + # then: + # - if: + # condition: lvgl.is_paused + # then: + # - lvgl.resume: + # - lvgl.widget.redraw: + # - switch.turn_on: display_backlight color: - id: bg hex: 282A36 -output: - - platform: ledc - pin: - ch422g: - number: 2 - allow_other_uses: true - mode: - output: true - inverted: False - frequency: 1220 - id: gpio_backlight_pwm +# output: +# - platform: ledc +# pin: +# number: 7 +# allow_other_uses: true +# frequency: 1220 +# id: backlight -light: - - platform: monochromatic - output: gpio_backlight_pwm - name: ${devicename} Display Backlight - id: back_light - restore_mode: ALWAYS_ON +# light: +# - platform: monochromatic +# output: backlight +# name: Display Backlight +# id: back_light +# restore_mode: ALWAYS_ON number: - platform: template @@ -588,12 +691,12 @@ lvgl: bg_color: 0x57c7ff knob: bg_color: 0x57c7ff - on_idle: - timeout: !lambda "return (id(display_timeout).state * 1000);" - then: - - logger.log: "LVGL is idle" - - switch.turn_off: display_backlight - - lvgl.pause: + # on_idle: + # timeout: !lambda "return (id(display_timeout).state * 1000);" + # then: + # - logger.log: "LVGL is idle" + # - switch.turn_off: display_backlight + # - lvgl.pause: pages: - id: main_page @@ -992,19 +1095,20 @@ lvgl: text_color: 0xE2E4E5 - obj: - height: 50% - y: 100 + height: 70% + y: 80 width: 170 x: 0 bg_opa: 0 border_width: 0 + scrollable: false layout: type: flex - pad_row: 40 - pad_column: 4 + pad_row: 20 + pad_column: 2 flex_flow: COLUMN - flex_align_main: CENTER - flex_align_cross: CENTER + flex_align_main: START + flex_align_cross: START flex_align_track: CENTER widgets: - label: @@ -1012,7 +1116,45 @@ lvgl: text_font: h3 text: " : 50%" text_color: ${color_white} - align: center + align: LEFT_MID + - obj: + bg_color: ${color_white} + height: 2 + width: 100% + pad_top: 50 + - label: + id: out_weather_label + text_font: h3 + text: "" + text_color: ${color_white} + pad_top: 50 + align: LEFT_MID + long_mode: WRAP + - label: + id: out_weather_sum_label + text_font: h4 + text: "" + text_color: ${color_white} + align: LEFT_MID + long_mode: WRAP + - label: + id: out_temp_label + text_font: h2 + text: "" + text_color: ${color_white} + align: LEFT_MID + # - label: + # id: out_hum_label + # text_font: h3 + # text: " : 50%" + # text_color: ${color_white} + # align: LEFT_MID + # - label: + # id: out_dew_label + # text_font: h3 + # text: "." + # text_color: ${color_white} + # align: LEFT_MID - label: