Compare commits
2 Commits
35f3aa76f6
...
86918e69c3
| Author | SHA1 | Date | |
|---|---|---|---|
| 86918e69c3 | |||
| 2af82804c0 |
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -203,7 +203,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "common"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"lighter_lib",
|
||||
@ -605,7 +605,7 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "hemma"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -630,7 +630,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hemma_web"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"common",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "hemma"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -27,6 +27,8 @@ impl Waker {
|
||||
}
|
||||
|
||||
const TIME_FMT: &str = "%H:%M";
|
||||
const WAKE_TARGET_BRIGHTNESS: u8 = 75;
|
||||
const WAKE_TARGET_TEMPERATURE: u8 = 60;
|
||||
|
||||
impl LightScript for Waker {
|
||||
fn get_params(&mut self, bulb: &BulbId) -> BulbPrefs {
|
||||
@ -116,9 +118,8 @@ async fn wake_task(manager: BulbManager, id: BulbId, day: Weekday, time: NaiveTi
|
||||
let r = manager
|
||||
.until_interrupted(id.clone(), async {
|
||||
// slowly turn up brightness of bulb
|
||||
for brightness in (1..=75).map(|i| (i as f32) * 0.01) {
|
||||
//sleep(Duration::from_secs(12)).await;
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
for brightness in (1..=WAKE_TARGET_BRIGHTNESS).map(|i| (i as f32) * 0.01) {
|
||||
sleep(Duration::from_secs(12)).await;
|
||||
|
||||
manager
|
||||
.send_command(BulbCommand::SetColor(
|
||||
@ -130,6 +131,21 @@ async fn wake_task(manager: BulbManager, id: BulbId, day: Weekday, time: NaiveTi
|
||||
))
|
||||
.await
|
||||
}
|
||||
|
||||
// slowly turn up temperature of bulb
|
||||
for temperature in (1..=WAKE_TARGET_TEMPERATURE).map(|i| (i as f32) * 0.01) {
|
||||
sleep(Duration::from_secs(12)).await;
|
||||
|
||||
manager
|
||||
.send_command(BulbCommand::SetColor(
|
||||
BulbSelector::Id(id.clone()),
|
||||
BulbColor::Kelvin {
|
||||
t: temperature,
|
||||
b: WAKE_TARGET_BRIGHTNESS as f32 * 0.01,
|
||||
},
|
||||
))
|
||||
.await
|
||||
}
|
||||
})
|
||||
.await;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "common"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "hemma_web"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
authors = ["Joakim Hulthe <joakim@hulthe.net"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user