From 9830387f21a6eab5f8a41cccd19a7ce1386fa1f9 Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Sat, 9 Jul 2022 16:26:13 -0400 Subject: [PATCH] Send power events in a more usable format --- router/websocket/websocket.go | 6 +++--- server/activity.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/router/websocket/websocket.go b/router/websocket/websocket.go index 3beb715..6298ffe 100644 --- a/router/websocket/websocket.go +++ b/router/websocket/websocket.go @@ -368,9 +368,9 @@ func (h *Handler) HandleInbound(ctx context.Context, m Message) error { return nil } - _ = h.ra.Save(h.server, server.ActivityPower, server.ActivityMeta{ - "signal": string(action), - }) + if err == nil { + _ = h.ra.Save(h.server, server.Event(server.ActivityPowerPrefix+action), nil) + } return err } diff --git a/server/activity.go b/server/activity.go index d15fc21..8396859 100644 --- a/server/activity.go +++ b/server/activity.go @@ -13,8 +13,9 @@ import ( type Event string type ActivityMeta map[string]interface{} +const ActivityPowerPrefix = "power_" + const ( - ActivityPower = Event("power") ActivityConsoleCommand = Event("console_command") )