Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
daft-panda committed Oct 8, 2023
1 parent f8e9b51 commit 2815d13
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
42 changes: 22 additions & 20 deletions ebus-thermostat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,28 @@ starting the thermostat.
3. Set the ebusd network port
4. Add a MQTT thermostat to your HA configuration.yaml. Do not alter the topic names. Reload or restart HA when added.
```yaml
mqtt:
climate:
- name: Heating
unique_id: Vaillant EcoTec Exclusive
max_temp: 23
min_temp: 20
precision: 0.1
temp_step: 0.5
modes:
- auto
- heat
- "off"
mode_state_topic: "ebus-thermostat/mode"
mode_command_topic: "ebus-thermostat/mode/set"
temperature_state_topic: "ebus-thermostat/temp"
temperature_low_state_topic: ebus-thermostat/temp/low"
temperature_high_state_topic: "ebus-thermostat/temp/high"
temperature_low_command_topic: "ebus-thermostat/temp/low/set"
temperature_high_command_topic: "ebus-thermostat/temp/high/set"
current_temperature_topic: "ebus-thermostat/temp"
mqtt:
climate:
- name: Heating
unique_id: Vaillant EcoTec Exclusive
retain: true
max_temp: 23
min_temp: 20
precision: 0.1
temp_step: 0.5
modes:
- auto
- heat
- "off"
mode_state_topic: "ebus-thermostat/mode"
mode_command_topic: "ebus-thermostat/mode/set"
temperature_state_topic: "ebus-thermostat/temp"
temperature_command_topic: "ebus-thermostat/temp/set"
temperature_low_state_topic: "ebus-thermostat/temp/low"
temperature_high_state_topic: "ebus-thermostat/temp/high"
temperature_low_command_topic: "ebus-thermostat/temp/low/set"
temperature_high_command_topic: "ebus-thermostat/temp/high/set"
current_temperature_topic: "ebus-thermostat/temp/current"
```
5. Configure the thermostat plugin in HA
6. Enjoy the heat 🔥
Expand Down
20 changes: 10 additions & 10 deletions ebus-thermostat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ async fn main() {
#[derive(Clone, Debug)]
pub struct TemperaturePreferences {
temperature_band: f32,
low_watermark: f32,
high_watermark: f32,
lower_bound: f32,
higher_bound: f32,
set_point: f32,
maintain_state_for: Duration,
tap_water_set_point: f32,
Expand All @@ -81,8 +81,8 @@ impl Default for TemperaturePreferences {
fn default() -> Self {
TemperaturePreferences {
temperature_band: 1.0,
low_watermark: 19.0,
high_watermark: 23.0,
lower_bound: 19.0,
higher_bound: 23.0,
set_point: 22.0,
maintain_state_for: Duration::from_secs(60),
tap_water_set_point: 45.0,
Expand Down Expand Up @@ -349,13 +349,13 @@ impl Thermostat {
fn update_heater_settings(&mut self, current_temp: f32) -> Option<HeaterSettings> {
if self.settings.flow_temp_desired == 0 {
// heater is currently inactive
if current_temp <= self.prefs.low_watermark {
if current_temp <= self.prefs.lower_bound {
self.settings.flow_temp_desired = 60;
return Some(self.settings.clone());
}
} else if self.settings.flow_temp_desired != 0 {
// heater is active
if current_temp >= self.prefs.high_watermark {
if current_temp >= self.prefs.higher_bound {
self.settings.flow_temp_desired = 0;
return Some(self.settings.clone());
}
Expand All @@ -371,13 +371,13 @@ impl Thermostat {
self.mqtt_tx
.send((
"temp/low".to_string(),
format!("{}", self.prefs.low_watermark),
format!("{}", self.prefs.lower_bound),
))
.await?;
self.mqtt_tx
.send((
"temp/high".to_string(),
format!("{}", self.prefs.high_watermark),
format!("{}", self.prefs.higher_bound),
))
.await?;
self.mqtt_tx
Expand Down Expand Up @@ -478,9 +478,9 @@ impl Thermostat {
publish.payload.to_vec(),
)?)?;
info!("New temp set point: {}", self.prefs.set_point);
self.prefs.low_watermark =
self.prefs.lower_bound =
self.prefs.set_point - self.prefs.temperature_band;
self.prefs.high_watermark =
self.prefs.higher_bound =
self.prefs.set_point + self.prefs.temperature_band;
self.publish_settings().await?;
}
Expand Down

0 comments on commit 2815d13

Please sign in to comment.