version bump + more climate data

This commit is contained in:
Alex Janka 2024-01-18 16:32:24 +11:00
parent 826918d67a
commit e7cacafa52
4 changed files with 29 additions and 2 deletions

2
Cargo.lock generated
View file

@ -2567,7 +2567,7 @@ dependencies = [
[[package]]
name = "tesla-charge-controller"
version = "1.0.7-prerelease"
version = "1.0.7"
dependencies = [
"async-channel",
"chrono",

View file

@ -1,6 +1,6 @@
[package]
name = "tesla-charge-controller"
version = "1.0.7-prerelease"
version = "1.0.7"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"

View file

@ -29,6 +29,9 @@ struct Metrics {
climate_on: Gauge,
preconditioning: Gauge,
remote_heater_control_enabled: Gauge,
is_auto_conditioning_on: Gauge,
driver_temp_setting: Gauge,
passenger_temp_setting: Gauge,
tesla_online: Gauge,
charging_state: ChargingStateGauges,
}
@ -60,6 +63,12 @@ impl Metrics {
"Remote heater control enabled"
);
let remote_heater_control_enabled = gauge!("tesla_remote_heater_control_enabled");
describe_gauge!("tesla_is_auto_conditioning_on", "Auto conditioning on");
let is_auto_conditioning_on = gauge!("tesla_is_auto_conditioning_on");
describe_gauge!("tesla_driver_temp_setting", "Driver temp");
let driver_temp_setting = gauge!("tesla_driver_temp_setting");
describe_gauge!("tesla_passenger_temp_setting", "Passenger temp");
let passenger_temp_setting = gauge!("tesla_passenger_temp_setting");
describe_gauge!("tesla_online", "Tesla online");
let tesla_online = gauge!("tesla_online");
describe_gauge!("tesla_charging_state", "Tesla charging state");
@ -77,6 +86,9 @@ impl Metrics {
climate_on,
preconditioning,
remote_heater_control_enabled,
is_auto_conditioning_on,
driver_temp_setting,
passenger_temp_setting,
tesla_online,
charging_state,
}
@ -301,6 +313,15 @@ impl TeslaInterface {
self.metrics
.remote_heater_control_enabled
.set(bf(new_climate_state.remote_heater_control_enabled));
self.metrics
.is_auto_conditioning_on
.set(bf(new_climate_state.is_auto_conditioning_on));
self.metrics
.driver_temp_setting
.set(new_climate_state.driver_temp_setting);
self.metrics
.passenger_temp_setting
.set(new_climate_state.passenger_temp_setting);
state.climate_state = Some(new_climate_state);
}

View file

@ -27,6 +27,9 @@ pub struct ClimateState {
pub climate_on: bool,
pub preconditioning: bool,
pub remote_heater_control_enabled: bool,
pub is_auto_conditioning_on: bool,
pub driver_temp_setting: f64,
pub passenger_temp_setting: f64,
}
impl TryFrom<teslatte::vehicles::ClimateState> for ClimateState {
@ -40,6 +43,9 @@ impl TryFrom<teslatte::vehicles::ClimateState> for ClimateState {
climate_on: value.is_climate_on,
preconditioning: value.is_preconditioning,
remote_heater_control_enabled: value.remote_heater_control_enabled,
is_auto_conditioning_on: value.is_auto_conditioning_on.unwrap_or(false),
driver_temp_setting: value.driver_temp_setting,
passenger_temp_setting: value.passenger_temp_setting,
})
}
}