(bluefox) add getPanels

This commit is contained in:
GermanBluefox
2018-03-11 13:55:47 +01:00
parent 4e6b678d85
commit f95fecfe5f
2 changed files with 23 additions and 63 deletions
+23
View File
@@ -63,6 +63,19 @@ function HASS(options, log) {
}
}
function getPanels(socket, callback) {
if (socket && typeof socket.send === 'function') {
var id = currentId++;
requests[id] = {type: 'get_panels', cb: callback, ts: Date.now()};
socket.send(JSON.stringify({
id: id,
type: 'get_panels'
}));
} else {
callback && callback('not connected');
}
}
function getServices(socket, callback) {
if (socket && typeof socket.send === 'function') {
var id = currentId++;
@@ -215,6 +228,16 @@ function HASS(options, log) {
}
};
this.getPanels = function (callback) {
if (!connected) {
if (typeof callback === 'function') {
callback('not connected');
}
} else {
getPanels(this.socket, callback);
}
};
this.callService = function (service, domain, serviceData, callback) {
if (!connected) {
if (typeof callback === 'function') {