Skip to content

Commit 0dabd36

Browse files
committed
fix topic hv en
1 parent f6729ba commit 0dabd36

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub struct HVOnData {
4343
}
4444

4545
/// the topic to listen for for HV enable, 1 is off and 0 is on
46-
pub const HV_EN_TOPIC: &str = "BMS/shutdown/state";
46+
pub const HV_EN_TOPIC: &str = "BMS/Shutdown/State";
4747

4848
/// the topic to listen for mute enable, 1 is on 0 is off
4949
pub const MUTE_EN_TOPIC: &str = "WHEEL/Buttons/Mute";

src/mqtt_handler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl MqttProcessor {
172172
HV_EN_TOPIC => {
173173
if !self.augment_hv_on {
174174
// ensure only triggering upon change from previous loop
175-
if val == 0 && !last_stat {
175+
if val == 1 && !last_stat {
176176
debug!("Transitioning states to HV on, creating folder!");
177177
if let Err(err) = std::fs::create_dir(format!("{}/event-{}", SAVE_LOCATION.get().unwrap(), res.time_us / 1000)) {
178178
warn!("Could not create folder for data, bailing out of this loop! {}", err);
@@ -181,7 +181,7 @@ impl MqttProcessor {
181181
self.hv_stat_send.send(HVTransition::TransitionOn(
182182
crate::HVOnData { time_ms: res.time_us / 1000})).expect("HV Stat Channel Closed");
183183
last_stat = true;
184-
} else if val == 1 && last_stat {
184+
} else if val == 0 && last_stat {
185185
debug!("Transitioning states to HV off");
186186
self.hv_stat_send.send(HVTransition::TransitionOff).expect("HV Stat Channel Closed");
187187
last_stat = false;

0 commit comments

Comments
 (0)