diff --git a/framework/services/httppull.service.js b/framework/services/httppull.service.js index 8a2035d..b53e881 100644 --- a/framework/services/httppull.service.js +++ b/framework/services/httppull.service.js @@ -78,7 +78,7 @@ module.exports = { const Handlebars = require('handlebars'); function convertObject(obj, rulesTemplate) { - const template = Handlebars.compile(rulesTemplate); + const template = Handlebars.compile(JSON.stringify(rulesTemplate)); const context = { json: obj }; const convertedData = JSON.parse(template(context)); return convertedData; @@ -103,6 +103,8 @@ module.exports = { let json = await ctx.call("httppull.process",{requestId:results[0].requestId}); if(json !== null) { json.meterId = results[0].meterId; + json.reading *= 1; + json.timestamp *= 1000; //TODO: Fix should be done in Template not in code return await ctx.call("metering.updateReading",json); } else return {}; } diff --git a/framework/services/httppull_model.service.js b/framework/services/httppull_model.service.js index e76ca4c..154282a 100644 --- a/framework/services/httppull_model.service.js +++ b/framework/services/httppull_model.service.js @@ -24,7 +24,7 @@ module.exports = { * Settings */ settings: { - fields: ["_id", "fetch","processor"], + fields: ["_id", "requestId","fetch","processor","meterId"], }, /**