Skip to content

Instantly share code, notes, and snippets.

@zoernert
Created April 23, 2017 22:18
Show Gist options
  • Save zoernert/9dbad0ec52a05e5643595f489bc92f5c to your computer and use it in GitHub Desktop.
Save zoernert/9dbad0ec52a05e5643595f489bc92f5c to your computer and use it in GitHub Desktop.
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();
console.log("UpdateReading",myReading);
console.log("Reader In",gwalink.reader_in.obj.address);
console.log("Reader Out",gwalink.reader_out.obj.address);
reader_in.pingReading(myReading).then(function(o) {console.log("Ping In",o);});
//reader_out.pingReading(myReading).then(function(o) {console.log("Ping Out",o);});
// Reading von GWALink
gwalink.obj.zss(node.wallet.address).then(function(o) {console.log("Reading@GWALink",o[1].toString())});
// Reading von Reader
reader_in.obj.readings(node.wallet.address).then(function(o) {console.log("Reading@Reader",o[0].toString())});
}
);
// Lade einen PDContract und prüfe TXs
node.pdcontract('0x16B23aEA5A8bD97b39A4aAb86a8BB9A88eAf77a8').then(
function(pdcontract) {
pdcontract.check().then(function(o) {
console.log(node.getRef(o));
});
pdcontract.costSum().then(function(o) {
console.log(node.getRef(o));
});
}
);
console.log("MyAddress",node.wallet.address);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment