Skip to content

Commit

Permalink
add parameter documentation
Browse files Browse the repository at this point in the history
fix io-package.json
  • Loading branch information
DEV2DEV-DE committed Nov 29, 2023
1 parent 7734acd commit b0ab645
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 8 deletions.
1 change: 0 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"zh-cn": "首次出版"
}
},
"title": "Jablotron",
"titleLang": {
"en": "Jablotron",
"de": "Jablotron",
Expand Down
55 changes: 48 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Jablotron extends utils.Adapter {
// create interval for recurring tasks
if (this.connected) {
this.refreshInterval = setInterval(() => {
if (this.connected && this.sessionId) {
if (this.sessionId) {
this.getExtendedData(headers, this.sessionId);
this.log.debug('Polling data from jablonet.net');
}
Expand Down Expand Up @@ -108,7 +108,11 @@ class Jablotron extends utils.Adapter {
}
}

// get data from jablonet cloud
/**
* get data from jablonet cloud
* @param {object} headers
* @param {string} cookie
*/
async getExtendedData(headers, cookie) {
const services = await this.getServices(headers, cookie);
await this.createFolder('services', 'All services related to the account');
Expand All @@ -125,7 +129,11 @@ class Jablotron extends utils.Adapter {
}
}

// read all services related to the account
/**
* read all services related to the account
* @param {object} headers
* @param {string} cookie
*/
async getServices(headers, cookie) {
const payload = {
'list-type': 'EXTENDED',
Expand All @@ -137,7 +145,12 @@ class Jablotron extends utils.Adapter {
return response.data['data']['services'];
}

// read all sections related to a given service
/**
* read all sections related to a given service
* @param {object} headers
* @param {string} cookie
* @param {string} serviceId
*/
async getSections(headers, cookie, serviceId) {
const payload = {
'connect-device': true,
Expand All @@ -164,7 +177,12 @@ class Jablotron extends utils.Adapter {
}
}

// read all programmable gates related to a given service
/**
* read all programmable gates related to a given service
* @param {object} headers
* @param {string} cookie
* @param {string} serviceId
*/
async getProgrammableGates(headers, cookie, serviceId) {
const payload = {
'connect-device': true,
Expand All @@ -191,8 +209,13 @@ class Jablotron extends utils.Adapter {
}
}

// read all thermo devices related to a given service
// currently work in prograss due to missing examples
/**
* read all thermo devices related to a given service
* currently work in prograss due to missing examples
* @param {object} headers
* @param {string} cookie
* @param {string} serviceId
*/
async getThermoDevices(headers, cookie, serviceId) {
const payload = {
'connect-device': true,
Expand All @@ -206,14 +229,32 @@ class Jablotron extends utils.Adapter {
this.log.debug('thermoDevicesGet: ' + JSON.stringify(response.data));
}

/**
* create a folder in the object tree
* @param {string} id
* @param {string} name
*/
async createFolder(id, name) {
await this.setObjectAsync(id, { type: 'folder', common: { name: `${name}` }, native: {}, });
}

/**
* create a channel in the object tree
* @param {string} id
* @param {string} name
*/
async createChannel(id, name) {
await this.setObjectAsync(id, { type: 'channel', common: { name: `${name}` }, native: {}, });
}

/**
* create a state in the object tree and set its value
* @param {string} id
* @param {string} name
* @param {boolean} read
* @param {boolean} write
* @param {any} value
*/
async createState(id, name, read, write, value) {
let type = undefined;
switch (typeof (value)) {
Expand Down

0 comments on commit b0ab645

Please sign in to comment.