projects > acapulko.go
1
A power-outage tracker for one address in Ukraine[github][live]
1
2
Self-hosted power outage tracker for a single Ukrainian address,
3
built to survive the war-driven blackouts. Combines live grid
4
sensor data from Home Assistant with emergency outage
5
announcements from the DTEK utility API.
6
7
Pushes Telegram alerts when power flips or DTEK announces an
8
outage, and serves a live PWA dashboard via Server-Sent Events.
9
Runs on a Raspberry Pi 5, packaged as both a standalone binary
10
and a Home Assistant add-on.
11
12
[Go][Home Assistant][Telegram][Raspberry Pi][Docker][SSE]
13
14
┌┐
15
┌─┼┼─┐ grid
16
─┴─┼┼─┴─ ──────╮ ╭───────▶
17
││
18
││ ╭───────╮
19
─┴┴─ │ │─────────╯ telegram
20
──────pi5
21
─────────╮
22
╰───────╯
23
╭────────╮
24
██████░░├┤ ─────╰ ╰───────▶
25
╰────────╯
26
deye 76%
27
status page
28
30
31
go func() {
32
log().Info("polling started", "interval", pollInterval)
33
ticker := time.NewTicker(pollInterval)
34
defer ticker.Stop()
35
36
for {
37
select {
38
case <-ctx.Done():
39
log().Info("polling stopped")
40
return
41
case <-ticker.C:
42
}
43
44
outage, err := getOutage(ctx, client, dtekBaseURL, region, city, street, building)
45
if err != nil {
46
log().Error("poll failed", "error", err)
47
} else if !prevOutage.Equal(outage) {
48
prevOutage = outage
49
outageUpdates <- outage
50
}
51
}
52
}()
53
54
return prevOutage, nil
55
}
56
57
58
59
60
61
62
63
NORMAL~/oleksandr/projects/acapulko.go.../projects/acapulko.gomainutf-8
Enter to open · :q to quit
keys
j / kmove the cursor line, or the tree cursor
hfocus the tree; in the tree, fold or go to the parent
l / Enterin the tree, unfold or open the file
gg / Gfirst / last line
clickput the cursor on a line; on README.sh, run the session again
:qquit to the shell
:help ?this table
q / Escclose this