diff --git a/README.md b/README.md index 5a022ac..cad8c9b 100644 --- a/README.md +++ b/README.md @@ -92,4 +92,4 @@ Some routes (such as `get-hourly-usage`) require timestamps. These must be provi Once connected to a Tapo device, a session is maintained between the server and the device. But Tapo devices set an expiration time, which means the session will eventually expire. -If this happens, you can hit the `/refresh-session?device_name=...` route to refresh the session. \ No newline at end of file +If this happens, you can hit the `/refresh-session?device=...` route to refresh the session. \ No newline at end of file diff --git a/src/server/mod.rs b/src/server/mod.rs index 517da42..6f9ba8a 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -98,21 +98,21 @@ pub async fn serve( #[derive(Deserialize)] struct RefreshDeviceSessionParams { - device_name: String, + device: String, } async fn refresh_session( State(state): State, Query(params): Query, ) -> ApiResult<()> { - let RefreshDeviceSessionParams { device_name } = params; + let RefreshDeviceSessionParams { device } = params; let mut state = state.write().await; let device = state .devices - .get_mut(&device_name) - .with_context(|| format!("Unkown device: {device_name}"))?; + .get_mut(&device) + .with_context(|| format!("Unkown device: {device}"))?; device .refresh_session()