Periodically update sensors from local push extension (#2138)

## Summary
When the Local Push extension is running (when we're on Wi-Fi in an SSID marked as 'Internal' and location is set to Always), we're given a persistent opportunity to do work. When we're running, we now update sensors on a regular interval.

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#753

## Any other notes
Updating the metadata/sensors every 5 minutes (by default) should have minimal, if any, battery implications. This follows the same setting as the "Periodic" timer which we use for foreground updates.
This commit is contained in:
Zac West
2022-05-23 20:30:25 -07:00
committed by GitHub
parent 675872bb68
commit 2250a779ea
6 changed files with 86 additions and 60 deletions

View File

@@ -136,10 +136,11 @@ public class HomeAssistantAPI {
case cold
case warm
case periodic
case background
var updateSensorTrigger: LocationUpdateTrigger {
switch self {
case .cold, .warm:
case .cold, .warm, .background:
return .Launch
case .periodic:
return .Periodic