1
0
Fork
You've already forked powerup
0
When multiple Kyiv addresses have Yasno electricity today (2026年02月08日: back to DTEK)
  • JavaScript 100%
2026年02月10日 01:24:09 +02:00
.env.example Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00
.gitignore Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00
.prettierrc Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00
eslint.config.js Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00
index.js Make slug from query street. Full street name spelling seems to be taken from one database in the morning and another in the evening 2026年02月10日 01:22:07 +02:00
package.json Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00
README.md Add heading to server section in README 2026年02月10日 01:24:09 +02:00
tsconfig.json Use Yasno API v2 and Node.js 2026年01月02日 23:38:27 +02:00

powerup - When multiple Kyiv addresses have DTEK electricity today.

Copyright (C) 2022, 2025-2026 Denys Nykula nykula@ukr.net

Prerequisites: uk_UA.UTF-8 locale and Europe/Kyiv time zone.

Usage on Debian GNU/Linux:

sudo apt-get install firefox npm tigervnc-standalone-server tigervnc-viewer
npm install
cp .env.example .env
echo PORT=8080 >>.env
echo ORIGIN=http://localhost:8080 >>.env
node --env-file=.env index.js --house 'Броварський,2|Імені+Прізвища,8Б'
node --env-file=.env index.js --listen

A web browser opens. Complete a captcha if it asks. The browser loads cookies and exits. Powerup loads outage tables for houses matching the query you pass as an argument. It shows you the path where the tables for your addresses are accessible. Express shows Powerup at http://localhost:8080.

Debug individual functions locally:

node --env-file=.env -p 'require("./index.js").startMarionette()' &
node --env-file=.env -p 'require("./index.js").fetchSession()'
node --env-file=.env -p 'require("./index.js").fetchHouse({ input: { house: [{ street: "Броварський", house: "2" }, { street: "Імені Прізвища", house: "8Б" }], lang: "uk" } })'

On server

Load houses using the --house option with the following format (if you installed Powerup as user www-data):

sudo su -s /bin/sh -c 'vncserver -fg -- /usr/bin/node --env-file=/var/www/powerup/.env /var/www/powerup/index.js --house \"Броварський,2|Імені+Прізвища,8Б\" - www-data

If Powerup does not respond for too long, tunnel to the server:

ssh www-data@example.org -L 5901:0.0.0.0:5901

and connect to the web browser from another terminal to enter a captcha:

vncviewer 0.0.0.0::5901

Schedule a refresh every 4 hours, starting at 00:05:

echo '5 */4 * * * www-data timeout -k 60 3600 vncserver -fg -- /usr/bin/node --env-file=/var/www/powerup/.env /var/www/powerup/index.js --house "Броварський,2|Імені+Прізвища,8Б"' |sudo tee /etc/cron.d/powerup

License

License AGPLv3+: GNU AGPL version 3 or later https://gnu.org/licenses/agpl-3.0.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.