Created
May 10, 2022 13:29
-
-
Save tyhdefu/576b9ca463351db6291d64aaff64eadc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[overrun_during] | |
[[overrun_during.slots]] | |
slot = { type = "Local", start="01:00:00", end="04:30:00" } | |
sensor = "1" | |
temp = 50.1 | |
[[overun_during.slots]] | |
slot = { type = "Local", start="03:20:00", end="4:30:00" } | |
sensor = "2" | |
temp = 46.0 | |
min_temp = 30.0 | |
[[overun_during.slots]] | |
slot = { type = "Local", start="04:00:00", end="4:30:00" } | |
sensor = "3" | |
temp = 48.0 | |
min_temp = 45.0 | |
[[overrun_during.slots]] | |
slot = { type = "Utc", start="12:00:00", end="14:50:00" } | |
sensor = "4" | |
temp = 46.1 | |
[[overrun_during.slots]] | |
slot = { type = "Utc", start="11:00:00", end="15:50:00" } | |
sensor = "5" | |
temp = 21.5 | |
min_temp = 10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thread 'brain::python_like::tests::test_deserialize_config' panicked at 'assertion failed: `(left == right)` | |
left: `OverrunConfig { slots: [OverrunBap { slot: Local(TimeSlot { start: 01:00:00, end: 04:30:00 }), temp: 50.1, sensor: Other(SensorId { id: "1" }), min_temp: None }, OverrunBap { slot: Local(TimeSlot { start: 03:20:00, end: 04:30:00 }), temp: 46.0, sensor: Other(SensorId { id: "2" }), min_temp: Some(30.0) }, OverrunBap { slot: Local(TimeSlot { start: 01:00:00, end: 04:30:00 }), temp: 48.0, sensor: Other(SensorId { id: "3" }), min_temp: Some(45.0) }, OverrunBap { slot: Utc(TimeSlot { start: 01:00:00, end: 04:30:00 }), temp: 46.1, sensor: Other(SensorId { id: "4" }), min_temp: None }, OverrunBap { slot: Utc(TimeSlot { start: 11:00:00, end: 15:50:00 }), temp: 21.5, sensor: Other(SensorId { id: "5" }), min_temp: Some(10.1) }] }`, | |
right: `OverrunConfig { slots: [OverrunBap { slot: Local(TimeSlot { start: 01:00:00, end: 04:30:00 }), temp: 50.1, sensor: Other(SensorId { id: "1" }), min_temp: None }, OverrunBap { slot: Utc(TimeSlot { start: 11:00:00, end: 15:50:00 }), temp: 21.5, sensor: Other(SensorId { id: "5" }), min_temp: Some(10.1) }] }`: Overrun during not equal', src/brain/python_like/mod.rs:356:9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Clone, Deserialize, Debug, PartialEq)] | |
#[serde(default)] | |
pub struct PythonBrainConfig { | |
hp_pump_on_time: Duration, | |
hp_pump_off_time: Duration, | |
hp_fully_reneable_min_time: Duration, | |
max_heating_hot_water: f32, | |
max_heating_hot_water_delta: f32, | |
temp_before_circulate: f32, | |
try_not_to_turn_on_heat_pump_after: NaiveTime, | |
try_not_to_turnon_heat_pump_end_threshold: Duration, | |
try_not_to_turn_on_heat_pump_extra_delta: f32, | |
initial_heat_pump_cycling_sleep: Duration, | |
default_working_range: WorkingTemperatureRange, | |
heat_up_to_during_optimal_time: f32, | |
overrun_during: OverrunConfig, | |
immersion_heater_model: ImmersionHeaterModel, | |
} | |
#[derive(Deserialize, Clone, Debug, PartialEq)] | |
pub struct OverrunConfig { | |
slots: Vec<OverrunBap> | |
} | |
#[derive(Deserialize, PartialEq, Debug, Clone)] | |
pub struct OverrunBap { | |
slot: ZonedSlot, | |
temp: f32, | |
sensor: Sensor, | |
min_temp: Option<f32>, | |
} | |
#[derive(Deserialize, PartialEq, Debug, Clone)] | |
#[serde(tag = "type")] | |
pub enum ZonedSlot { | |
Utc(TimeSlot), | |
Local(TimeSlot), | |
} | |
#[derive(Deserialize, Debug, PartialEq, Clone)] | |
pub struct TimeSlot { | |
start: NaiveTime, | |
end: NaiveTime, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment