feat: add HA weather bindings, Status tab, and Temp/Status toggle wiring
This commit is contained in:
parent
434ceda91a
commit
245bb79203
3 changed files with 301 additions and 146 deletions
|
|
@ -41,20 +41,40 @@ lvgl:
|
|||
flex_align_main: space_evenly
|
||||
widgets:
|
||||
- button:
|
||||
id: toggle_temp_btn
|
||||
width: 120px
|
||||
height: 36px
|
||||
radius: 18
|
||||
bg_color: 0xFFFFFF
|
||||
on_click:
|
||||
- lvgl.widget.show: temp_view
|
||||
- lvgl.widget.hide: status_view
|
||||
- lvgl.widget.update:
|
||||
id: toggle_temp_btn
|
||||
bg_color: 0xFFFFFF
|
||||
- lvgl.widget.update:
|
||||
id: toggle_status_btn
|
||||
bg_opa: transp
|
||||
widgets:
|
||||
- label:
|
||||
text: "Temp"
|
||||
text_color: 0x000000
|
||||
text_font: montserrat_16
|
||||
- button:
|
||||
id: toggle_status_btn
|
||||
width: 120px
|
||||
height: 36px
|
||||
radius: 18
|
||||
bg_opa: transp
|
||||
on_click:
|
||||
- lvgl.widget.show: status_view
|
||||
- lvgl.widget.hide: temp_view
|
||||
- lvgl.widget.update:
|
||||
id: toggle_status_btn
|
||||
bg_color: 0xFFFFFF
|
||||
- lvgl.widget.update:
|
||||
id: toggle_temp_btn
|
||||
bg_opa: transp
|
||||
widgets:
|
||||
- label:
|
||||
text: "Status"
|
||||
|
|
@ -74,6 +94,15 @@ lvgl:
|
|||
y: 20
|
||||
text: "Firecrest"
|
||||
text_font: montserrat_16
|
||||
- obj:
|
||||
id: temp_view
|
||||
width: 100%
|
||||
height: 100%
|
||||
pad_all: 0
|
||||
border_width: 0
|
||||
outline_width: 0
|
||||
scrollable: false
|
||||
widgets:
|
||||
- arc:
|
||||
id: dial_bg_arc
|
||||
align: center
|
||||
|
|
@ -231,10 +260,51 @@ lvgl:
|
|||
text: "75"
|
||||
text_font: montserrat_20
|
||||
- label:
|
||||
id: outside_temp_label
|
||||
align: bottom_right
|
||||
x: -24
|
||||
y: -24
|
||||
text: "-- °" # outside temp stub — weather data source deferred per design spec
|
||||
text: "-- °"
|
||||
text_font: montserrat_20
|
||||
- obj:
|
||||
id: status_view
|
||||
hidden: true
|
||||
width: 100%
|
||||
height: 100%
|
||||
pad_all: 16
|
||||
border_width: 0
|
||||
outline_width: 0
|
||||
scrollable: false
|
||||
layout:
|
||||
type: flex
|
||||
flex_flow: column
|
||||
flex_align_cross: center
|
||||
flex_align_track: center
|
||||
flex_align_main: space_evenly
|
||||
widgets:
|
||||
- label:
|
||||
id: status_condition_label
|
||||
text: "--"
|
||||
text_font: montserrat_32
|
||||
- label:
|
||||
id: status_temp_label
|
||||
text: "Outside: -- °F"
|
||||
text_font: montserrat_24
|
||||
- label:
|
||||
id: status_humidity_label
|
||||
text: "Humidity: -- %"
|
||||
text_font: montserrat_20
|
||||
- label:
|
||||
id: status_high_label
|
||||
text: "High: -- °F"
|
||||
text_font: montserrat_20
|
||||
- label:
|
||||
id: status_low_label
|
||||
text: "Low: -- °F"
|
||||
text_font: montserrat_20
|
||||
- label:
|
||||
id: status_precip_label
|
||||
text: "Precipitation: -- %"
|
||||
text_font: montserrat_20
|
||||
- id: page_sensors
|
||||
widgets:
|
||||
|
|
|
|||
84
firmware/components/weather.yaml
Normal file
84
firmware/components/weather.yaml
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
text_sensor:
|
||||
- platform: homeassistant
|
||||
id: weather_condition
|
||||
entity_id: weather.forecast_home
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: status_condition_label
|
||||
text: !lambda |-
|
||||
if (x == "clear-night") return "Clear";
|
||||
if (x == "cloudy") return "Cloudy";
|
||||
if (x == "exceptional") return "Exceptional";
|
||||
if (x == "fog") return "Foggy";
|
||||
if (x == "hail") return "Hail";
|
||||
if (x == "lightning") return "Lightning";
|
||||
if (x == "lightning-rainy") return "Thunderstorms";
|
||||
if (x == "partlycloudy") return "Partly Cloudy";
|
||||
if (x == "pouring") return "Pouring Rain";
|
||||
if (x == "rainy") return "Rainy";
|
||||
if (x == "snowy") return "Snowy";
|
||||
if (x == "snowy-rainy") return "Snow/Rain";
|
||||
if (x == "sunny") return "Sunny";
|
||||
if (x == "windy") return "Windy";
|
||||
if (x == "windy-variant") return "Windy";
|
||||
return x;
|
||||
|
||||
sensor:
|
||||
- platform: homeassistant
|
||||
id: weather_outside_temp
|
||||
entity_id: weather.forecast_home
|
||||
attribute: temperature
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: outside_temp_label
|
||||
text:
|
||||
format: "%.0f °"
|
||||
args: ["x"]
|
||||
- lvgl.label.update:
|
||||
id: status_temp_label
|
||||
text:
|
||||
format: "Outside: %.0f °F"
|
||||
args: ["x"]
|
||||
- platform: homeassistant
|
||||
id: weather_humidity
|
||||
entity_id: weather.forecast_home
|
||||
attribute: humidity
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: status_humidity_label
|
||||
text:
|
||||
format: "Humidity: %.0f%%"
|
||||
args: ["x"]
|
||||
- platform: homeassistant
|
||||
id: weather_forecast_high
|
||||
entity_id: sensor.firecrest_forecast_high
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: status_high_label
|
||||
text:
|
||||
format: "High: %.0f °F"
|
||||
args: ["x"]
|
||||
- platform: homeassistant
|
||||
id: weather_forecast_low
|
||||
entity_id: sensor.firecrest_forecast_low
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: status_low_label
|
||||
text:
|
||||
format: "Low: %.0f °F"
|
||||
args: ["x"]
|
||||
- platform: homeassistant
|
||||
id: weather_precip_prob
|
||||
entity_id: sensor.firecrest_precip_probability
|
||||
on_value:
|
||||
then:
|
||||
- lvgl.label.update:
|
||||
id: status_precip_label
|
||||
text:
|
||||
format: "Precipitation: %.0f%%"
|
||||
args: ["x"]
|
||||
|
|
@ -50,3 +50,4 @@ packages:
|
|||
relays: !include components/relays.yaml
|
||||
climate: !include components/climate.yaml
|
||||
diagnostics: !include components/diagnostics.yaml
|
||||
weather: !include components/weather.yaml
|
||||
|
|
|
|||
Loading…
Reference in a new issue