Code Monkey home page Code Monkey logo

node-gruenstromindex's Introduction

node-gruenstromindex

Green Power Index ( GrünstromIndex ) for Node/Javascript

Installation

via NPM (as module):

npm i gruenstromindex

via NPM (as Shell Script):

npm i -g gruenstromindex

via GIT:

git clone https://github.com/energychain/node-gruenstromindex
npm i

via Script Tag:

    <script src="https://unpkg.com/gruenstromindex/public/js/main.js"></script>

Usage

Command-Line (CLI)

gruenstromindex <Postleitzahl>

Node JS / ESM

#!/usr/bin/env node

import gsi from "gruenstromindex";

const lib = gsi.gsi();

const app = async function(plz) {
   const prediction = await lib.prediction(plz);
   let table = [];
   for(let i=0;i<prediction.forecast.length;i++) {
    const row = {
        date: new Date(prediction.forecast[i].timeStamp).toLocaleString(),
        gsi: prediction.forecast[i].gsi,
        co2: prediction.forecast[i].co2_g_standard
    };
    table.push(row);
   }
   console.table(table); 
}

if(process.argv.length < 3) {
    console.error("usage: gruenstromindex <Postleitzahl>");
} else {
    app(process.argv[2]);
}

Browser/HTML

See sample on JSFiddle.

Widget Development

cd node-gruenstromindex
npm run dev

Point Browser to: http://localhost:9090/

Maintainer / Imprint

STROMDAO GmbH
Gerhard Weiser Ring 29
69256 Mauer
Germany

+49 6226 968 009 0

[email protected]

Handelsregister: HRB 728691 (Amtsgericht Mannheim)

LICENSE

Apache-2.0

node-gruenstromindex's People

Contributors

dependabot[bot] avatar zoernert avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.