Directly send wol packet instead of using the webhook
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-01-19 16:35:35 +01:00
parent a0cefa8302
commit aa8963bd4a
6 changed files with 50 additions and 26 deletions

View File

@@ -165,6 +165,8 @@ pub enum Device {
#[serde(flatten)]
mqtt: MqttDeviceConfig,
mac_address: MacAddress,
#[serde(default = "default_broadcast_ip")]
broadcast_ip: Ipv4Addr,
},
KasaOutlet {
ip: Ipv4Addr,
@@ -182,6 +184,10 @@ pub enum Device {
}
}
fn default_broadcast_ip() -> Ipv4Addr {
Ipv4Addr::new(255, 255, 255, 255)
}
impl Config {
pub fn parse_file(filename: &str) -> Result<Self, ConfigParseError> {
debug!("Loading config: {filename}");
@@ -227,9 +233,9 @@ impl Device {
IkeaOutlet::build(&identifier, info, mqtt, kettle, client).await
.map(device_box)?
},
Device::WakeOnLAN { info, mqtt, mac_address } => {
Device::WakeOnLAN { info, mqtt, mac_address, broadcast_ip } => {
trace!(id = identifier, "WakeOnLan [{} in {:?}]", info.name, info.room);
WakeOnLAN::build(&identifier, info, mqtt, mac_address, client).await
WakeOnLAN::build(&identifier, info, mqtt, mac_address, broadcast_ip, client).await
.map(device_box)?
},
Device::KasaOutlet { ip } => {