Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#228 add polling intervall an lint #229

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions admin/jsonConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"items": [
{
"type": "text",
"width": "20%",
"width": "25%",
"title": {
"en": "Name"
},
Expand Down Expand Up @@ -60,8 +60,8 @@
"default": ""
},
{
"type": "text",
"width": "20%",
"type": "number",
"width": "10%",
"title": {
"en": "Port"
},
Expand All @@ -70,9 +70,20 @@
"sort": true,
"default": "80"
},
{
"type": "number",
"width": "10%",
"title": {
"en": "Update period"
},
"attr": "polling",
"filter": false,
"sort": true,
"default": "360"
},
{
"type": "select",
"width": "20%",
"width": "15%",
"title": {
"en": "Type"
},
Expand Down
114 changes: 104 additions & 10 deletions admin/words.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,114 @@
/* eslint-disable quote-props */
// eslint-disable-next-line no-unused-vars
/* global systemDictionary:true */
/*
+===================== DO NOT MODIFY ======================+
| This file was generated by translate-adapter, please use |
| `translate-adapter adminLanguages2words` to update it. |
+===================== DO NOT MODIFY ======================+
*/
"use strict";
'use strict';

systemDictionary = {
"Extended logging": { en: "Extended logging", de: "Erweiterte Protokollierung", ru: "Расширенное ведение журнала", pt: "Registro estendido", nl: "Uitgebreide logboekregistratie", fr: "Journalisation étendue", it: "Registrazione estesa", es: "Registro extendido", pl: "Rozszerzone logowanie", uk: "Розширений журнал", "zh-cn": "扩展日志记录" },
"Name": { en: "Name", de: "Name", ru: "Имя", pt: "Nome", nl: "Naam", fr: "Nom", it: "Nome", es: "Nombre", pl: "Nazwa", uk: "Ім'я", "zh-cn": "姓名" },
"IP Adress": { en: "IP Adress", de: "IP Adresse", ru: "IP адрес", pt: "Endereço de IP", nl: "IP adres", fr: "Adresse IP", it: "Indirizzo IP", es: "Dirección IP", pl: "Adres IP", uk: "Веб-камера", "zh-cn": "IP地址" },
"Port": { en: "Port", de: "Port", ru: "Порт", pt: "Porta", nl: "Port", fr: "Port", it: "Porta", es: "Puerto", pl: "Port", uk: "Портфоліо", "zh-cn": "港口" },
"Smart name": { en: "Smart name", de: "Smart Name", ru: "Умное имя", pt: "Nome inteligente", nl: "Slimme naam", fr: "Nom intelligent", it: "Nome intelligente", es: "Nombre inteligente", pl: "Inteligentna nazwa", uk: "Розумне ім'я", "zh-cn": "聪明的名字" },
"Type": { en: "Type", de: "Typ", ru: "Тип", pt: "Modelo", nl: "Type", fr: "Taper", it: "Tipo", es: "Escribe", pl: "Rodzaj", uk: "Тип", "zh-cn": "类型" },
"blebox adapter settings": { en: "Adapter settings for blebox", de: "Adaptereinstellungen für blebox", ru: "Настройки адаптера для blebox", pt: "Configurações do adaptador para blebox", nl: "Adapterinstellingen voor blebox", fr: "Paramètres d'adaptateur pour blebox", it: "Impostazioni dell'adattatore per blebox", es: "Ajustes del adaptador para blebox", pl: "Ustawienia adaptera dla blebox", "zh-cn": "blebox的适配器设置" }
'Extended logging': {
en: 'Extended logging',
de: 'Erweiterte Protokollierung',
ru: 'Расширенное ведение журнала',
pt: 'Registro estendido',
nl: 'Uitgebreide logboekregistratie',
fr: 'Journalisation étendue',
it: 'Registrazione estesa',
es: 'Registro extendido',
pl: 'Rozszerzone logowanie',
uk: 'Розширений журнал',
'zh-cn': '扩展日志记录',
},
Name: {
en: 'Name',
de: 'Name',
ru: 'Имя',
pt: 'Nome',
nl: 'Naam',
fr: 'Nom',
it: 'Nome',
es: 'Nombre',
pl: 'Nazwa',
uk: "Ім'я",
'zh-cn': '姓名',
},
'IP Adress': {
en: 'IP Adress',
de: 'IP Adresse',
ru: 'IP адрес',
pt: 'Endereço de IP',
nl: 'IP adres',
fr: 'Adresse IP',
it: 'Indirizzo IP',
es: 'Dirección IP',
pl: 'Adres IP',
uk: 'Веб-камера',
'zh-cn': 'IP地址',
},
Port: {
en: 'Port',
de: 'Port',
ru: 'Порт',
pt: 'Porta',
nl: 'Port',
fr: 'Port',
it: 'Porta',
es: 'Puerto',
pl: 'Port',
uk: 'Портфоліо',
'zh-cn': '港口',
},
'Smart name': {
en: 'Smart name',
de: 'Smart Name',
ru: 'Умное имя',
pt: 'Nome inteligente',
nl: 'Slimme naam',
fr: 'Nom intelligent',
it: 'Nome intelligente',
es: 'Nombre inteligente',
pl: 'Inteligentna nazwa',
uk: "Розумне ім'я",
'zh-cn': '聪明的名字',
},
Type: {
en: 'Type',
de: 'Typ',
ru: 'Тип',
pt: 'Modelo',
nl: 'Type',
fr: 'Taper',
it: 'Tipo',
es: 'Escribe',
pl: 'Rodzaj',
uk: 'Тип',
'zh-cn': '类型',
},
'Update period': {
en: 'Update period',
de: 'Aktualisierungszeitraum',
ru: 'Период обновления',
pt: 'Período de atualização',
nl: 'Bijwerken periode',
fr: 'Période de mise à jour',
it: 'Periodo di aggiornamento',
es: 'Período de actualización',
pl: 'Okres aktualizacji',
uk: 'Період оновлення',
'zh-cn': '更新期',
},
'blebox adapter settings': {
en: 'Adapter settings for blebox',
de: 'Adaptereinstellungen für blebox',
ru: 'Настройки адаптера для blebox',
pt: 'Configurações do adaptador para blebox',
nl: 'Adapterinstellingen voor blebox',
fr: "Paramètres d'adaptateur pour blebox",
it: "Impostazioni dell'adattatore per blebox",
es: 'Ajustes del adaptador para blebox',
pl: 'Ustawienia adaptera dla blebox',
'zh-cn': 'blebox的适配器设置',
},
};
107 changes: 80 additions & 27 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,70 +75,123 @@ class Blebox extends utils.Adapter {
tools.getBleboxData(device, 'settingsState');
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'shutterExtendedState');
schedule.scheduleJob('*/10 * * * *', function () {
tools.getBleboxData(device, 'deviceUptime');
tools.getBleboxData(device, 'shutterExtendedState');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'shutterExtendedState')
.then(data => this.log.info('shutterExtendedState:', data))
.catch(err => this.log.error('Fehler bei shutterExtendedState:', err));
}, device.polling * 1000);
}
this.subscribeStates(`${device.dev_name}.command.*`);
break;
case 'tvlift':
tvlift.init();
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'deviceNetwork');
tools.getBleboxData(device, 'tvliftExtendedState');
schedule.scheduleJob('*/10 * * * *', function () {
tools.getBleboxData(device, 'deviceUptime');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
}, device.polling * 1000);
}
this.subscribeStates(`${device.dev_name}.command.*`);
break;
case 'gatebox':
gatebox.init();
tools.getBleboxData(device, 'settingsState');
tools.getBleboxData(device, 'deviceState');
schedule.scheduleJob('*/10 * * * * *', function () {
tools.getBleboxData(device, 'deviceUptime');
tools.getBleboxData(device, 'gateExtendedState');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'gateExtendedState')
.then(data => this.log.info('gateExtendedState:', data))
.catch(err => this.log.error('Fehler bei gateExtendedState:', err));
}, device.polling * 1000);
}
this.subscribeStates(`${device.dev_name}.command.*`);
break;
case 'switchbox':
switchbox.init();
tools.getBleboxData(device, 'settingsState');
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'switchExtendedState');
schedule.scheduleJob('*/10 * * * *', function () {
tools.getBleboxData(device, 'deviceUptime');
tools.getBleboxData(device, 'switchExtendedState');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'switchExtendedState')
.then(data => this.log.info('switchExtendedState:', data))
.catch(err => this.log.error('Fehler bei switchExtendedState:', err));
}, device.polling * 1000);
}
this.subscribeStates(`${device.dev_name}.command.*`);
break;
case 'tempsensor':
tempsensor.init();
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'tempsensorExtendedState');
schedule.scheduleJob('*/10 * * * * *', function () {
tools.getBleboxData(device, 'tempsensorExtendedState');
tools.getBleboxData(device, 'deviceUptime');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'tempsensorExtendedState')
.then(data => this.log.info('tempsensorExtendedState:', data))
.catch(err => this.log.error('Fehler bei tempsensorExtendedState:', err));
}, device.polling * 1000);
}
break;
case 'multisensor':
multisensor.init();
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'multisensorExtendedState');
schedule.scheduleJob('*/10 * * * * *', function () {
tools.getBleboxData(device, 'multisensorExtendedState');
tools.getBleboxData(device, 'deviceUptime');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'multisensorExtendedState')
.then(data => this.log.info('multisensorExtendedState:', data))
.catch(err => this.log.error('Fehler bei multisensorExtendedState:', err));
}, device.polling * 1000);
}
break;
case 'saunabox':
saunabox.init();
tools.getBleboxData(device, 'deviceState');
tools.getBleboxData(device, 'saunaboxExtendedState');
this.subscribeStates(`${device.dev_name}.command.*`);
schedule.scheduleJob('*/30 * * * * *', function () {
tools.getBleboxData(device, 'saunaboxExtendedState');
tools.getBleboxData(device, 'deviceUptime');
});
if (device.polling > 0) {
setInterval(() => {
tools
.getBleboxData(device, 'deviceUptime')
.then(data => this.log.info('deviceUptime:', data))
.catch(err => this.log.error('Fehler bei deviceUptime:', err));
tools
.getBleboxData(device, 'saunaboxExtendedState')
.then(data => this.log.info('saunaboxExtendedState:', data))
.catch(err => this.log.error('Fehler bei saunaboxExtendedState:', err));
}, device.polling * 1000);
}
break;
default:
break;
Expand Down
Loading