refactor: proper tray logging

This commit is contained in:
2025-08-01 12:16:59 -05:00
parent 8048fcd953
commit b9adf96c39
2 changed files with 19 additions and 9 deletions

View File

@@ -48,7 +48,7 @@ func NewApp(logger *slog.Logger) *App {
state: StatePaused,
config: nil,
lastStarted: nil,
tray: &Tray{},
tray: NewTray(logger.With("type", "tray")),
ha: nil,
}
}
@@ -72,17 +72,14 @@ func (app *App) Pause() error {
"previous_state", app.state,
"new_state", StatePaused)
// TODO: Implement actual pause logic
// - Disconnect from Home Assistant WebSocket
// - Stop background tasks
// - Pause sensor monitoring
// - Stop tray icon event loop
err := app.ha.Close()
if err != nil {
app.logger.Error("failed to close home assistant connection", "error", err)
return err
}
// - Stop tray icon event loop
err = app.tray.Stop()
if err != nil {
app.logger.Error("failed to stop tray", "error", err)