27 lines
649 B
Go
27 lines
649 B
Go
// Copyright (c) 2023 Joshua Rich <joshua.rich@gmail.com>
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
package tracker
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/joshuar/go-hass-agent/internal/hass"
|
|
"github.com/joshuar/go-hass-agent/internal/hass/api"
|
|
"github.com/rs/zerolog/log"
|
|
)
|
|
|
|
func updateLocation(ctx context.Context, l *hass.LocationData) {
|
|
response := <-api.ExecuteRequest(ctx, l)
|
|
switch r := response.(type) {
|
|
case []byte:
|
|
log.Debug().Msg("Location Updated.")
|
|
case error:
|
|
log.Warn().Err(r).Msg("Failed to update location.")
|
|
default:
|
|
log.Warn().Msgf("Unknown response type %T", r)
|
|
}
|
|
}
|