Skip to content

Commit

Permalink
Revert "prefer to use LAN API to apply light scenes"
Browse files Browse the repository at this point in the history
This reverts commit c0545a8; we'll
revisit this after a bit more investigation.

refs: #354
refs: #353
  • Loading branch information
wez committed Jan 2, 2025
1 parent bb4ba8e commit 588ee30
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions src/service/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,21 +639,6 @@ impl State {
device: &Device,
scene: &str,
) -> anyhow::Result<()> {
if let Some(lan_dev) = &device.lan_device {
log::info!("Using LAN API to set {device} to scene {scene}");
match lan_dev.set_scene_by_name(scene).await {
Ok(_) => {
self.device_mut(&device.sku, &device.id)
.await
.set_active_scene(Some(scene));
return Ok(());
}
Err(err) => {
log::error!("Error using LAN API to set {device} to scene {scene}: {err:#}. Maybe fallback to platform API");
}
}
}

// TODO: some plumbing to maintain offline scene controls for preferred-LAN control
let avoid_platform_api = device.avoid_platform_api();

Expand All @@ -670,6 +655,16 @@ impl State {
}
}

if let Some(lan_dev) = &device.lan_device {
log::info!("Using LAN API to set {device} to scene {scene}");
lan_dev.set_scene_by_name(scene).await?;

self.device_mut(&device.sku, &device.id)
.await
.set_active_scene(Some(scene));
return Ok(());
}

anyhow::bail!("Unable to set scene for {device}");
}

Expand Down

0 comments on commit 588ee30

Please sign in to comment.