1786901972
This commit is contained in:
@@ -174,7 +174,20 @@ impl From<&crate::home_assistant::CalendarEvent> for CalendarEventData {
|
|||||||
|
|
||||||
impl From<RawBatteryData> for BatteryData {
|
impl From<RawBatteryData> for BatteryData {
|
||||||
fn from(value: RawBatteryData) -> Self {
|
fn from(value: RawBatteryData) -> Self {
|
||||||
let state = value.state.to_shared_string();
|
let state = value
|
||||||
|
.state
|
||||||
|
.to_string()
|
||||||
|
.split_whitespace()
|
||||||
|
.map(|word| {
|
||||||
|
let mut c = word.chars();
|
||||||
|
match c.next() {
|
||||||
|
None => String::new(),
|
||||||
|
Some(first_char) => first_char.to_uppercase().collect::<String>() + c.as_str(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(" ")
|
||||||
|
.to_shared_string();
|
||||||
let percent: f32 = (value.state_of_charge * 100.).into();
|
let percent: f32 = (value.state_of_charge * 100.).into();
|
||||||
let percent = percent.round();
|
let percent = percent.round();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user