Party mode
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use chrono::{NaiveTime, Weekday};
|
||||
use lighter_lib::{BulbColor, BulbId, BulbMode};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -15,7 +14,7 @@ pub enum ServerMessage {
|
||||
BulbState {
|
||||
id: BulbId,
|
||||
mode: BulbMode,
|
||||
wake_schedule: HashMap<Weekday, NaiveTime>,
|
||||
prefs: BTreeMap<ScriptId, BulbPrefs>,
|
||||
},
|
||||
|
||||
BulbMap(BulbMap),
|
||||
@ -35,10 +34,11 @@ pub enum ClientMessage {
|
||||
id: BulbId,
|
||||
power: bool,
|
||||
},
|
||||
SetBulbWakeTime {
|
||||
id: BulbId,
|
||||
day: Weekday,
|
||||
time: Option<NaiveTime>,
|
||||
SetBulbPref {
|
||||
bulb: BulbId,
|
||||
script: ScriptId,
|
||||
name: String,
|
||||
value: Param,
|
||||
},
|
||||
}
|
||||
|
||||
@ -78,3 +78,16 @@ impl BulbGroupShape {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub type ScriptId = String;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum Param {
|
||||
String(String),
|
||||
Toggle(bool),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub struct BulbPrefs {
|
||||
pub kvs: BTreeMap<String, Param>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user