Skip to content

Commit

Permalink
feat(linux/power): ✨ power state and screen lock sensor requests will…
Browse files Browse the repository at this point in the history
… be retried on response failure

- retry power/screen lock state sensor updates on response failure. this will hopefully ensure the power state is properly updated after coming back up  from suspend state and detecting the state change before the network is back up
  • Loading branch information
joshuar committed Dec 21, 2024
1 parent b103679 commit e4ca6e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"linux/cpu",
"linux/system",
"linux/mem",
"BREAKING_CHANGES"
"BREAKING_CHANGES",
"linux/power"
],
"go.testFlags": ["-v"],
"[markdown]": {
Expand Down
3 changes: 3 additions & 0 deletions internal/linux/power/powerState.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func newPowerState(name powerSignal, value any) sensor.Entity {
Attributes: map[string]any{
"data_source": linux.DataSrcDbus,
},
RequestMetadata: sensor.RequestMetadata{
RetryRequest: true,
},
},
}
}
Expand Down
3 changes: 3 additions & 0 deletions internal/linux/power/screenLock.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func newScreenlockSensor(value bool) sensor.Entity {
Attributes: map[string]any{
"data_source": linux.DataSrcDbus,
},
RequestMetadata: sensor.RequestMetadata{
RetryRequest: true,
},
},
}
}
Expand Down

0 comments on commit e4ca6e7

Please sign in to comment.