Skip to content

Commit

Permalink
fix for #169
Browse files Browse the repository at this point in the history
  • Loading branch information
empierre committed May 31, 2018
1 parent db1835d commit ef9be57
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions mdah.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//##############################################################################
// This file is part of MyDomoAtHome - https://github.com/empierre/MyDomoAtHome
// Copyright (C) 2014-2017 Emmanuel PIERRE ([email protected])
// Copyright (C) 2014-2018 Emmanuel PIERRE ([email protected])
//
// MyDomoAtHome is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,6 +35,7 @@ var errorHandler = require('errorhandler');
var requester = require('sync-request');
var winston = require('winston');
var pjson = require('./package.json');
var isBase64 = require('is-base64');
var app = express();
global.logger = winston;

Expand Down Expand Up @@ -418,13 +419,19 @@ function DevMultiSwitch(data) {
params.push({"key": "LastRun", "value": dt});
var status;
//console.log("L:"+data.Level);
var res = data.LevelNames.split('|').join(',');
var dataLevelNames;
if (isBase64(data.LevelNames)) {
dataLevelNames = new Buffer(data.LevelNames, 'base64').toString("ascii");; // Ta-da
} else {
dataLevelNames=data.LevelNames;
}
var res = dataLevelNames.split('|').join(',');

if(data.LevelOffHidden) {
res = res.replace ("Off,","");
}

var ret = data.LevelNames.split('|');
var ret = dataLevelNames.split('|');
var mydev = {MaxDimLevel: null, Action: null, graph: null, Selector: ret};
console.log(mydev);
device_tab[data.idx] = mydev;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"request": "^2.67.0",
"sync-request": "3.0.0",
"underscore": "1.4.4",
"is-base64": "0.0.4",
"winston": "^1.0.1"
},
"devDependencies": {
Expand Down Expand Up @@ -115,4 +116,4 @@
"safeGet"
]
}
}
}

0 comments on commit ef9be57

Please sign in to comment.