Skip to content

Commit

Permalink
feat: add humidifier to devices
Browse files Browse the repository at this point in the history
  • Loading branch information
mgierada committed Jan 12, 2024
1 parent 7f899fb commit e4e6669
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/constants/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ pub enum OfficeDevices {
StandingLeftLED(Device),
WindowLED(Device),
BoardLED(Device),
Humidifier(Device),
}
18 changes: 18 additions & 0 deletions src/services/light_setup_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ impl OfficeDevices {
};
OfficeDevices::WindowLED(window_led)
}

pub fn humidifier() -> Self {
let office_humidifier_id=
env::var("OFFICE_HUMIDIFIER_ID").expect("OFFICE_HUMIDIFIER_ID must be set");
let office_humidifier_model =
env::var("OFFICE_HUMIDIFIER_MODEL").expect("OFFICE_HUMIDIFIER_MODEL must be set");
let humidifier = Device {
device_id: office_humidifier_id,
model: office_humidifier_model,
};
OfficeDevices::WindowLED(humidifier)
}

}

pub fn office_setup(device: &OfficeDevices, command: &str) -> PayloadBody {
Expand Down Expand Up @@ -112,5 +125,10 @@ pub fn office_setup(device: &OfficeDevices, command: &str) -> PayloadBody {
model: standing_left_led.model.clone(),
cmd: command,
},
OfficeDevices::Humidifier(humidifier) => PayloadBody {
device: humidifier.device_id.clone(),
model: humidifier.model.clone(),
cmd: command,
},
}
}

0 comments on commit e4e6669

Please sign in to comment.