(bluefox) add getPanels
This commit is contained in:
+23
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user