$(date +%s)
This commit is contained in:
@@ -77,16 +77,36 @@ impl From<&HassEntity> for DateTimeData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
temperature: float,
|
||||||
|
dew_point: float,
|
||||||
|
temperature_unit: string,
|
||||||
|
humidity: int,
|
||||||
|
cloud_coverage: int,
|
||||||
|
uv_index: float,
|
||||||
|
pressure: float,
|
||||||
|
pressure_unit: string,
|
||||||
|
wind_bearing: float,
|
||||||
|
wind_speed: float,
|
||||||
|
wind_speed_unit: string,
|
||||||
|
visibility_unit: string,
|
||||||
|
precipitation_unit: string,
|
||||||
|
attribution: string,
|
||||||
|
friendly_name: string,
|
||||||
|
supported_features: int
|
||||||
|
*/
|
||||||
impl From<&HassEntity> for WeatherData {
|
impl From<&HassEntity> for WeatherData {
|
||||||
fn from(value: &HassEntity) -> Self {
|
fn from(value: &HassEntity) -> Self {
|
||||||
let outside_temperature = value
|
let temperature = value
|
||||||
.attributes
|
.attributes
|
||||||
.get("outside_temperature")
|
.get("temperature")
|
||||||
.unwrap_or_default()
|
.and_then(|x| x.as_f64())
|
||||||
.to_shared_string();
|
.unwrap_or_default() as f32;
|
||||||
|
|
||||||
|
todo!();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
outside_temperature,
|
temperature,
|
||||||
outside_high: todo!(),
|
outside_high: todo!(),
|
||||||
outside_condition: todo!(),
|
outside_condition: todo!(),
|
||||||
weather_kind: todo!(),
|
weather_kind: todo!(),
|
||||||
|
|||||||
@@ -6,10 +6,22 @@ in property <string> : "cloud";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export struct WeatherData {
|
export struct WeatherData {
|
||||||
outside-temperature: string,
|
temperature: float,
|
||||||
outside-high: string,
|
dew_point: float,
|
||||||
outside-condition: string,
|
temperature_unit: string,
|
||||||
weather-kind: string,
|
humidity: int,
|
||||||
|
cloud_coverage: int,
|
||||||
|
uv_index: float,
|
||||||
|
pressure: float,
|
||||||
|
pressure_unit: string,
|
||||||
|
wind_bearing: float,
|
||||||
|
wind_speed: float,
|
||||||
|
wind_speed_unit: string,
|
||||||
|
visibility_unit: string,
|
||||||
|
precipitation_unit: string,
|
||||||
|
attribution: string,
|
||||||
|
friendly_name: string,
|
||||||
|
supported_features: int,
|
||||||
}
|
}
|
||||||
|
|
||||||
export component Climate inherits Rectangle {
|
export component Climate inherits Rectangle {
|
||||||
@@ -17,79 +29,79 @@ export component Climate inherits Rectangle {
|
|||||||
Text {
|
Text {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 116px;
|
height: 116px;
|
||||||
text: weather.outside-temperature;
|
text: "\{weather.temperature}\{weather.temperature-unit}";
|
||||||
font-size: 104px;
|
font-size: 104px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
// Text {
|
||||||
width: 150px;
|
// width: 150px;
|
||||||
height: 32px;
|
// height: 32px;
|
||||||
text: weather.outside-high;
|
// text: weather.outside-high;
|
||||||
font-size: 20px;
|
// font-size: 20px;
|
||||||
font-weight: 700;
|
// font-weight: 700;
|
||||||
vertical-alignment: center;
|
// vertical-alignment: center;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if weather.weather-kind == "sun": Image {
|
// if weather.weather-kind == "sun": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/sun.svg");
|
// source: @image-url("icons/sun.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-sun": Image {
|
// if weather.weather-kind == "cloud-sun": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-sun.svg");
|
// source: @image-url("icons/cloud-sun.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-moon": Image {
|
// if weather.weather-kind == "cloud-moon": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-moon.svg");
|
// source: @image-url("icons/cloud-moon.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud": Image {
|
// if weather.weather-kind == "cloud": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud.svg");
|
// source: @image-url("icons/cloud.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-rain": Image {
|
// if weather.weather-kind == "cloud-rain": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-rain.svg");
|
// source: @image-url("icons/cloud-rain.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-rain-wind": Image {
|
// if weather.weather-kind == "cloud-rain-wind": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-rain-wind.svg");
|
// source: @image-url("icons/cloud-rain-wind.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-lightning": Image {
|
// if weather.weather-kind == "cloud-lightning": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-lightning.svg");
|
// source: @image-url("icons/cloud-lightning.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "snowflake": Image {
|
// if weather.weather-kind == "snowflake": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/snowflake.svg");
|
// source: @image-url("icons/snowflake.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "cloud-fog": Image {
|
// if weather.weather-kind == "cloud-fog": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/cloud-fog.svg");
|
// source: @image-url("icons/cloud-fog.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
if weather.weather-kind == "moon": Image {
|
// if weather.weather-kind == "moon": Image {
|
||||||
width: 120px;
|
// width: 120px;
|
||||||
height: 105px;
|
// height: 105px;
|
||||||
source: @image-url("icons/moon.svg");
|
// source: @image-url("icons/moon.svg");
|
||||||
image-fit: contain;
|
// image-fit: contain;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user