diff --git a/kodi.html b/kodi.html
index 491acd0..983fa40 100644
--- a/kodi.html
+++ b/kodi.html
@@ -107,7 +107,7 @@
kodicommand: {value: ""}
},
inputs: 1,
- outputs: 0,
+ outputs: 1,
align: 'right',
icon: "bridge-dash.png",
label: function () {
diff --git a/kodi.js b/kodi.js
index 63152d7..e5f66d8 100644
--- a/kodi.js
+++ b/kodi.js
@@ -119,12 +119,18 @@ module.exports = function (RED) {
}
}
- node.send(payload, function (err) {
+ node.sendToKodi(payload, function (err, data) {
if (err) {
node.error('send error: ' + err);
}
if (typeof(msg.cb) === 'function')
msg.cb(err);
+ if(!err){
+ node.send({
+ topic: 'kodi',
+ payload: data
+ });
+ }
});
});
@@ -165,9 +171,9 @@ module.exports = function (RED) {
fsm.on('reconnect', nodeStatusReconnect);
});
- this.send = function (data, callback) {
+ this.sendToKodi = function (data, callback) {
DEBUG && RED.comms.publish("debug", {name: node.name, msg: 'send data[' + JSON.stringify(data) + ']'});
- //node.log('send data[' + data + ']');
+ //node.log('sendToKodi data[' + data + ']');
// init a new one-off connection from the effectively singleton KodiController
// there seems to be no way to reuse the outgoing conn in adreek/node-kodijs
controllerNode.initializeKodiConnection(function (fsm) {
@@ -175,8 +181,8 @@ module.exports = function (RED) {
DEBUG && RED.comms.publish("debug", {name: node.name, msg: "send: " + JSON.stringify(data)});
data.cmd = data.cmd || data.method;
data.args = data.args || data.params;
- fsm.connection.run(data.cmd, data.args).then(function () {
- callback && callback();
+ fsm.connection.run(data.cmd, data.args).then(function (data) {
+ callback && callback(null, data);
}, function (err) {
callback && callback(err);
});
@@ -268,4 +274,4 @@ module.exports = function (RED) {
}
RED.nodes.registerType("kodi-in", KodiIn);
-}
\ No newline at end of file
+}
diff --git a/package.json b/package.json
index 03b023c..a8ba00c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-kodi",
- "version": "0.2.8",
+ "version": "0.3.0",
"description": "Node-RED nodes for communicating with a Kodi (former XBMC).",
"repository": {
"type": "git",