This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const app = async function() { | |
| const sendgridAPIKey = process.env.sendgridAPIKey; | |
| const rapidAPIKey = process.env.rapidAPIKey; | |
| const fromDate = new Date(new Date().getTime() - (7*87600000)).toISOString().split('T')[0]; // last 7 days | |
| const axios = require("axios"); | |
| // Retrieve Statistics from Sendgrid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sendgridAPIKey = 'YOUR_SENDGRID_API_KEY'; | |
| const rapidAPIKey = 'YOUR_RAPIDAPI_KEY'; | |
| const fromDate = new Date(new Date().getTime() - (7*87600000)).toISOString().split('T')[0]; // last 7 days | |
| const axios = require("axios"); | |
| // Retrieve Statistics from Sendgrid | |
| const sendgridStatsResponds = await axios.get("https://sendgrid.com/v3/stats?start_date="+fromDate,{ | |
| headers: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let totalco=0; | |
| for(let i=0;i<mailStats.length;i++) { | |
| for(let j=0;j<mailStats[i].stats.length;j++) { | |
| for (const [key, value] of Object.entries(mailStats[i].stats[j].metrics)) { | |
| if(key == "blocks") totalco2+=1 | |
| if(key == "bounce_drops") totalco2+=2 | |
| if(key == "bounces") totalco2+=2 | |
| if(key == "clicks") totalco2+=2 | |
| if(key == "deferred") totalco2+=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Metric | CO2Eq | |
|---|---|---|
| blocks | 1 | |
| bounce_drops | 2 | |
| bounces | 2 | |
| clicks | 2 | |
| deferred | 2 | |
| delivered | 20 | |
| invalid_emails | 0 | |
| opens | 10 | |
| processed | 15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sendgridAPIKey = 'YOUR_SENDGRID_API_KEY'; | |
| const fromDate = new Date(new Date().getTime() - (7*87600000)).toISOString().split('T')[0]; // last 7 days | |
| const axios = require("axios"); | |
| // Retrieve Statistics from Sendgrid | |
| const sendgridStatsResponds = await axios.get("https://sendgrid.com/v3/stats?start_date="+fromDate,{ | |
| headers: { | |
| 'content-type': 'application/json', | |
| 'Authorization': 'Bearer '+sendgridAPIKey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am zoernert on github. | |
| * I am thorsten_zoerner (https://keybase.io/thorsten_zoerner) on keybase. | |
| * I have a public key ASBw2XjGvKjX1N3bjppkXX8nOSCAiQytJsA0sqTFlJTDdQo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### Keybase proof | |
| I hereby claim: | |
| * I am zoernert on github. | |
| * I am thorstenzoerner (https://keybase.io/thorstenzoerner) on keybase. | |
| * I have a public key ASAc7rKmzHWeWyFeq3a5o_S83EBgnW4ryLXjgnTX_3Pgzwo | |
| To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity ^0.4.10; | |
| /** | |
| * StromDAO Business Objects | |
| * ==================================================================== | |
| * Upper level business objects required for power delivery on a public | |
| * energy distribution system. Defines PowerDelivery as digital asset | |
| * used for transaction data and entities (roles) for master data. | |
| * | |
| * @author Thorsten Zoerner <thorsten.zoerner(at)stromdao.de) | |
| **/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var StromDAONode = new require("./StromDAONode.js"); | |
| var node = new StromDAONode.Node({}); | |
| // Hole einen GWALink und schreibe einen Messwert | |
| node.gwalink('0xBA2ef7bF8f21218c85c3399025E0d6D63632dc03').then( | |
| function(gwalink) { | |
| var reader_in = gwalink.reader_in; | |
| var reader_out = gwalink.reader_out; | |
| var myReading=new Date().getTime(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"p01067":{"a":"27.7","g":"118.62"},"p01069":{"a":"27.7","g":"118.62"},"p01097":{"a":"27.7","g":"118.62"},"p01099":{"a":"27.7","g":"118.62"},"p01108":{"a":"27.7","g":"118.62"},"p01109":{"a":"27.7","g":"118.62"},"p01127":{"a":"27.7","g":"118.62"},"p01129":{"a":"27.7","g":"118.62"},"p01139":{"a":"27.7","g":"118.62"},"p01156":{"a":"27.7","g":"118.62"},"p01157":{"a":"27.7","g":"118.62"},"p01159":{"a":"27.7","g":"118.62"},"p01169":{"a":"27.7","g":"118.62"},"p01187":{"a":"26.13","g":"146.85"},"p01189":{"a":"27.7","g":"118.62"},"p01217":{"a":"27.7","g":"118.62"},"p01219":{"a":"27.7","g":"118.62"},"p01237":{"a":"27.7","g":"118.62"},"p01239":{"a":"27.7","g":"118.62"},"p01257":{"a":"27.7","g":"118.62"},"p01259":{"a":"27.7","g":"118.62"},"p01277":{"a":"27.7","g":"118.62"},"p01279":{"a":"27.7","g":"118.62"},"p01307":{"a":"27.7","g":"118.62"},"p01309":{"a":"27.7","g":"118.62"},"p01324":{"a":"27.7","g":"118.62"},"p01326":{"a":"27.7","g":"118.62"},"p01328":{"a":"27.7","g":"118.62"},"p01445":{"a":"24","g":"122.57"},"p01454": |