Skip to content

Commit

Permalink
daemonIsReady
Browse files Browse the repository at this point in the history
  • Loading branch information
NebzHB authored Jan 22, 2024
1 parent 58a9b78 commit b112197
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/jeedom-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ JeedomClient.prototype.getDeviceProperties = function(ID) {

};

JeedomClient.prototype.daemonIsReady = function(port) {
var that = this;
var url = that.url;

return axios.post(url,
{
jsonrpc:"2.0",
id:(Math.floor(Math.random() * 1000)),
method:"daemonIsReady",
params:{
plugin:that.myPlugin,
apikey:that.apikey,
port:port,
},
}).then((result) => {
if(!result.data) {return Promise.reject("JSON reçu de Jeedom invalide, vérifiez le log API de Jeedom, reçu :"+JSON.stringify(result));}
if(!result.data.result && result.data.error) {
return Promise.reject(result.data.error.message);
} else if(result.data.result == true) {
return result.data.result;
} else {
return Promise.reject("Jeedom n'a pas compris l'envoi du port");
}
});

};

JeedomClient.prototype.getDeviceCmdFromCache = function(ID) {
var that = this;
var clist = [];
Expand Down

0 comments on commit b112197

Please sign in to comment.