Decarbonize My Discovergy SmartMeter

CO2Offset

Uses the CO2 Offset API to automatically compensate CO2 footprint of consumed electricity.

Free CO2 Compensation up to 1kg/month

Requirements

[{"id":"b10b433c6ca23d08","type":"tab","label":"Decarbonize My SmartMeter","disabled":false,"info":"Automatically Offset CO2 footprint of an Discovergy Energy Meter."},{"id":"1e2866780a8b44d7","type":"debug","z":"b10b433c6ca23d08","name":"Certified Compensation ","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.certificate.co2requested","statusType":"msg","x":1050,"y":100,"wires":[]},{"id":"89e38a5292863cf3","type":"inject","z":"b10b433c6ca23d08","name":"Every 6h","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"21600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payloadType":"date","x":110,"y":160,"wires":[["ddded0130f583709","ef1ad34e6de69c53"]]},{"id":"bfa1ece311f95316","type":"function","z":"b10b433c6ca23d08","name":"Calculate CO2","func":"const EMISSIONFACTOR=35; // Gram of CO2eq per kWh (35 fits for Ökostrom in Germany).\n\nlet lastReading = flow.get(msg.payload.meterinfo.fullSerialNumber);\n\nif(typeof msg.payload.latest !== 'undefined') {\n    let offsetGrams = 0;\n    if((typeof lastReading !== 'undefined') && (lastReading !== null)) {\n        // calculate Delta of Reading\n        let delta = msg.payload.latest.energy_wh - lastReading.energy_wh;\n        offsetGrams = Math.floor((delta / 1000) * EMISSIONFACTOR) + 1; \n    }\n    flow.set(msg.payload.meterinfo.fullSerialNumber,msg.payload.latest);\n    msg.payload = {\n        gram: offsetGrams\n    }\n} else {\n    msg.payload = {};\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":100,"wires":[["a91b04de1e036ed7"]]},{"id":"ddded0130f583709","type":"Discovergy Meter","z":"b10b433c6ca23d08","name":"My Energy Meter","account":"9b658d63a33fe119","meterId":"7987040f5f7a40f297d53460cae627f9","firstReading":0,"firstReadingOut":0,"firstReadingDate":"","isProduction":false,"revenue":0,"amortization":0,"prodMeterId":null,"firstReadingProd":0,"x":350,"y":100,"wires":[["bfa1ece311f95316"]]},{"id":"6331660e11b34db0","type":"debug","z":"b10b433c6ca23d08","name":"Total Compensated CO2","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload.balance","statusType":"msg","x":1050,"y":240,"wires":[]},{"id":"4ea76819e90c5229","type":"function","z":"b10b433c6ca23d08","name":"Use Identity 4 Balance","func":"msg.payload = {\n    identity:msg.payload.account\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":240,"wires":[["9570675d43bade90"]]},{"id":"30daed23905a1818","type":"comment","z":"b10b433c6ca23d08","name":"Auto Compensate CO2","info":"","x":360,"y":60,"wires":[]},{"id":"6384290351517417","type":"comment","z":"b10b433c6ca23d08","name":"Retrieve Lifetime Total Grams of CO Offset","info":"","x":420,"y":200,"wires":[]},{"id":"458b1f5745d75b4a","type":"comment","z":"b10b433c6ca23d08","name":"Setup: Set your Rapid Credentials (API Key, Host) in 3 Nodes!","info":"","x":480,"y":340,"wires":[]},{"id":"a91b04de1e036ed7","type":"RapidAPI","z":"b10b433c6ca23d08","name":"CO2 Offset","account":"1e79c85e958df143","url":"https://co2-offset.p.rapidapi.com/rapidapi/compensate","method":"GET","credentials":{},"x":790,"y":100,"wires":[["1e2866780a8b44d7"]]},{"id":"ef1ad34e6de69c53","type":"RapidAPI","z":"b10b433c6ca23d08","name":"Who am I","account":"1e79c85e958df143","url":"https://co2-offset.p.rapidapi.com/rapidapi/whoami","method":"GET","x":320,"y":240,"wires":[["4ea76819e90c5229"]]},{"id":"9570675d43bade90","type":"RapidAPI","z":"b10b433c6ca23d08","name":"Total Compensated","account":"1e79c85e958df143","url":"https://co2-offset.p.rapidapi.com/co2/balanceOf","method":"GET","x":790,"y":240,"wires":[["6331660e11b34db0"]]},{"id":"9b658d63a33fe119","type":"discovergy-config","name":"MSB der STROMDAO"},{"id":"1e79c85e958df143","type":"rapidapi-config","name":""}]

Flow Info

Created 2 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x3)
  • debug (x2)
  • function (x2)
  • inject (x1)
Other

Tags

  • smartmeter
  • discovegy
  • co2
  • greenenergy
  • climate
  • decarbonization
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option