Skip to content

tvup/poweruse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This project provides an application with tools to

  • calculate electricity bill before it's received from your vendor
  • get totalprices for next hours
  • calculate price for certain, inputted data today
  • get data about electriciy installation, charges, etc.

Data is retrieved from multiple sources:

  • Eloverblik
  • EnergiDataService
  • Smart-Me

Based on Laravel 10

Installation

It's strongly recommended that you add an alias to your bash/zsh config

It will make it much easier to run the sail command

alias sail="./vendor/bin/sail"

Install dependencies

You will have to install dependencies locally, because we use sail which is located in the /vendor folder.

composer install --ignore-platform-reqs

Set default environment variables

cp .env.example .env

Start application

Docker (might take a while first time)

sail up -d

if you get "Docker is not running." this link might be helpful

if you get bind problems for e.g. tcp4 0.0.0.0:80 (http) or tcp4 0.0.0.0:3306 (mysql), you can change the forward ports in .env like these examples:

APP_PORT=8001
FORWARD_DB_PORT=3308

Generate a new App Key

sail artisan key:generate

Migrate

sail artisan migrate

Passport

sail artisan passport:install

Build NPM & Vite components

sail npm install
sail npm run build 

Now is a good time to view all the nice stuff

Navigate to http://localhost/ (if you set the APP_PORT, you should include this in link also, e.g.: http://localhost:8001 )

Data

Want some data to get things going? Populate with prices might be an idea - this also loads grid operators:

Charge groups

sail artisan energidata:request-and-store-charge-groups

Prices (may take a while - expect ~75min.)

(tip, import csv database/fixtures/poweruse_datahub_price_lists.csv to table instead ("Remove problematic data" step won't be necessary if you do so))

sail artisan energidata:request-and-store-datahub-prices

Remove problematic data

sail artisan datahubpricelist:remove-problematic-data

Testing

sail test

Static analysis

Run the static analysis locally inside the docker container through sail

sail shell ./bin/phpstan

PSR

Run the psr fixer locally inside the docker container through sail

sail shell ./bin/style

Test with code-coverage

You can generate a test coverage report using XDebug, which is already preinstalled, simply by adding XDEBUG_MODE=coverage as environment varible.

XDEBUG_MODE=coverage sail test

PWA

The appilication is provided as PWA (https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps) Icons for the PWA isn't imported and rendered through vite as one might expect. This is due to fact, that the technology doesn't seem mature enough at point of implementing to be able to handle icon-assets in manifest. Service worker registration is performed in app.js while all configuration is kept in vite.config.js Be careful if changing paths/urls as errors might not show immediately and can seem a bit tricky since module is doing a lot of magic! and adds sub-directories to path-strings.

Mails

When developing locally we use Mailhog to trap all mails.

The interface is available here: http://localhost:8025/

About

Utilities to calculate electricity bills

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages