Socket
Socket
Sign inDemoInstall

iobroker.bayernluft

Package Overview
Dependencies
Maintainers
30
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iobroker.bayernluft - npm Package Compare versions

Comparing version 1.2.2 to 2.0.0-alpha.0

admin/i18n/uk/translations.json

8

admin/i18n/de/translations.json
{
"bayernluft adapter settings": "Adaptereinstellungen für bayernluft",
"option1": "Option 1",
"option2": "Option 2"
}
"bayernluft adapter settings": "Adaptereinstellungen für bayernluft",
"option1": "Option 1",
"option2": "Option 2"
}
{
"bayernluft adapter settings": "Ajustes del adaptador para bayernluft",
"option1": "Opción 1",
"option2": "opcion 2"
}
"bayernluft adapter settings": "Ajustes del adaptador para bayernluft",
"option1": "Opción 1",
"option2": "opcion 2"
}
{
"bayernluft adapter settings": "Paramètres d'adaptateur pour bayernluft",
"option1": "Option 1",
"option2": "Option 2"
}
"bayernluft adapter settings": "Paramètres d'adaptateur pour bayernluft",
"option1": "Option 1",
"option2": "Option 2"
}
{
"bayernluft adapter settings": "Impostazioni dell'adattatore per bayernluft",
"option1": "opzione 1",
"option2": "opzione 2"
}
"bayernluft adapter settings": "Impostazioni dell'adattatore per bayernluft",
"option1": "opzione 1",
"option2": "opzione 2"
}
{
"bayernluft adapter settings": "Adapterinstellingen voor bayernluft",
"option1": "Optie 1",
"option2": "Optie 2"
}
"bayernluft adapter settings": "Adapterinstellingen voor bayernluft",
"option1": "Optie 1",
"option2": "Optie 2"
}
{
"bayernluft adapter settings": "Ustawienia adaptera dla bayernluft",
"option1": "opcja 1",
"option2": "Opcja 2"
}
"bayernluft adapter settings": "Ustawienia adaptera dla bayernluft",
"option1": "opcja 1",
"option2": "Opcja 2"
}
{
"bayernluft adapter settings": "Configurações do adaptador para bayernluft",
"option1": "Opção 1",
"option2": "opção 2"
}
"bayernluft adapter settings": "Configurações do adaptador para bayernluft",
"option1": "Opção 1",
"option2": "opção 2"
}
{
"bayernluft adapter settings": "Настройки адаптера для bayernluft",
"option1": "Опция 1",
"option2": "вариант 2"
}
"bayernluft adapter settings": "Настройки адаптера для bayernluft",
"option1": "Опция 1",
"option2": "вариант 2"
}
{
"bayernluft adapter settings": "bayernluft的适配器设置",
"option1": "选项1",
"option2": "选项2"
}
"bayernluft adapter settings": "bayernluft的适配器设置",
"option1": "选项1",
"option2": "选项2"
}
{
"common": {
"name": "bayernluft",
"version": "1.2.2",
"version": "2.0.0-alpha.0",
"news": {
"2.0.0-alpha.0": {
"en": "Adapter has been move to iobroker-community-adapters organization\nDependencies have been updated",
"de": "Adapter wurde auf iobroker-community-Adapter Organisation verschoben\nAbhängigkeiten wurden aktualisiert",
"ru": "Адаптер перешел в организацию iobroker-community-adapters\nЗависимость обновлена",
"pt": "Adapter foi transferido para iobroker-community-adapters organização\nAs dependências foram atualizadas",
"nl": "Adapter is verplaatst naar iobroker-community-adapters organisatie\nAfhankelijkheden zijn bijgewerkt",
"fr": "Adaptateur a été transféré à iobroker-community-adaptateurs organisation\nLes dépendances ont été actualisées",
"it": "L'adattatore è stato spostato all'organizzazione iobroker-community-adapters\nLe dipendenze sono state aggiornate",
"es": "Adaptador ha sido trasladado a la organización de ibroker-community-adapters\nSe han actualizado las dependencias",
"pl": "Adapter został przeniesiony do organizacji adapterów iobroker- community\nZaktualizowano zależności",
"uk": "Перехід на iobroker-community-adapters\nЗалежність було оновлено",
"zh-cn": "适应者被转移到了职业经纪人-社区适应者组织\n依赖关系已更新"
},
"1.2.2": {

@@ -83,18 +96,4 @@ "en": "Updated Rest of Old Repo Name",

"zh-cn": "补充最新间隔"
},
"1.0.2": {
"en": "Fixed Node-Fetch Import",
"de": "Feste Node-Fetch Import",
"ru": "Фиксированный импорт Node-Fetch",
"pt": "Importação de nó fixo",
"nl": "_",
"fr": "Node-Fetch Import fixe",
"it": "Importazione nodo fisso",
"es": "Importación de nodos fijos",
"pl": "Oficjalna strona Node-Fetch Import",
"uk": "Виправлено Node-Fetch Імпорт",
"zh-cn": "Fixde-Fetch进口"
}
},
"title": "BayernLuft",
"titleLang": {

@@ -110,3 +109,4 @@ "en": "BayernLuft",

"pl": "BayernLuft",
"zh-cn": "拜仁吕夫特"
"zh-cn": "拜仁吕夫特",
"uk": "BayernLuft"
},

@@ -123,6 +123,8 @@ "desc": {

"pl": "Łączy dane BayernLuft z IoBroker",
"zh-cn": "将 BayernLuft 数据连接到 IoBroker"
"zh-cn": "将 BayernLuft 数据连接到 IoBroker",
"uk": "Підключає BayernLuft Data до IoBroker"
},
"authors": [
"Marco15453 <support@marco15453.xyz>"
"Marco15453 <support@marco15453.xyz>",
"mcm1957 <mcm57@gmx.at>"
],

@@ -135,10 +137,13 @@ "keywords": [

],
"license": "MIT",
"licenseInformation": {
"license": "MIT",
"type": "free"
},
"platform": "Javascript/Node.js",
"main": "main.js",
"icon": "bayernluft.png",
"enabled": true,
"extIcon": "https://raw.githubusercontent.com/Marco15453/ioBroker.bayernluft/main/admin/bayernluft.png",
"readme": "https://github.com/Marco15453/ioBroker.bayernluft/blob/main/README.md",
"extIcon": "https://raw.githubusercontent.com/iobroker-community-adapters/ioBroker.bayernluft/main/admin/bayernluft.png",
"readme": "https://github.com/iobroker-community-adapters/ioBroker.bayernluft/blob/main/README.md",
"loglevel": "info",
"tier": 2,
"mode": "daemon",

@@ -154,3 +159,3 @@ "type": "climate-control",

{
"js-controller": ">=3.3.22"
"js-controller": ">=5.0.19"
}

@@ -160,3 +165,3 @@ ],

{
"admin": ">=5.1.13"
"admin": ">=6.13.16"
}

@@ -163,0 +168,0 @@ ]

// @ts-nocheck
"use strict";
'use strict';

@@ -8,4 +8,4 @@ /*

const utils = require("@iobroker/adapter-core");
const NodeFetch = (...args) => import("node-fetch").then(({default: fetch}) => fetch(...args));
const utils = require('@iobroker/adapter-core');
const NodeFetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));

@@ -15,109 +15,109 @@ // @ts-ignore

/**
/**
* @param {Partial<utils.AdapterOptions>} [options={}]
*/
constructor(options) {
super({
...options,
name: "bayernluft",
});
this.on("ready", this.onReady.bind(this));
this.on("stateChange", this.onStateChange.bind(this));
this.on("unload", this.onUnload.bind(this));
}
constructor(options) {
super({
...options,
name: 'bayernluft',
});
this.on('ready', this.onReady.bind(this));
this.on('stateChange', this.onStateChange.bind(this));
this.on('unload', this.onUnload.bind(this));
}
/**
/**
* Is called when databases are connected and adapter received configuration.
*/
async onReady() {
// Initialize your adapter here
async onReady() {
// Initialize your adapter here
// Reset the connection indicator during startup
await this.setStateAsync("info.connection", false, true);
// Reset the connection indicator during startup
await this.setStateAsync('info.connection', false, true);
if (this.config.devices == null) {
this.log.error("No devices has been set, disabling adapter!");
this.disable();
return;
}
if (this.config.devices == null) {
this.log.error('No devices has been set, disabling adapter!');
this.disable();
return;
}
this.pullInterval = setInterval(async () => {
await this.checkDevices();
}, this.config.pullInterval * 1000);
this.pullInterval = setInterval(async () => {
await this.checkDevices();
}, this.config.pullInterval * 1000);
// Indicate that the connection has been established
await this.setStateAsync("info.connection", true, true);
}
// Indicate that the connection has been established
await this.setStateAsync('info.connection', true, true);
}
/**
/**
* Is called when adapter shuts down - callback has to be called under any circumstances!
* @param {() => void} callback
*/
async onUnload(callback) {
try {
await this.setStateAsync("info.connection", false, true);
this.pullInterval && clearInterval(this.pullInterval);
callback();
} catch (e) {
callback();
}
}
async onUnload(callback) {
try {
await this.setStateAsync('info.connection', false, true);
this.pullInterval && clearInterval(this.pullInterval);
callback();
} catch (e) {
callback();
}
}
/**
/**
* Checking Devices and updating Objects/States
*/
async checkDevices() {
for await(const device of this.GetDevices() || []) {
const exporttxt = await this.GetHttpRequest("http://" + device.ip + ":" + device.port + "/export.txt", device.name);
const deviceInfo = await this.GetHttpRequest("http://" + device.ip + ":" + device.port + "/?export=0", device.name);
async checkDevices() {
for await(const device of this.GetDevices() || []) {
const exporttxt = await this.GetHttpRequest('http://' + device.ip + ':' + device.port + '/export.txt', device.name);
const deviceInfo = await this.GetHttpRequest('http://' + device.ip + ':' + device.port + '/?export=0', device.name);
if(exporttxt == null || deviceInfo == null) continue;
if(exporttxt == null || deviceInfo == null) continue;
// Create Data Objects
await this.setObjectNotExistsAsyncEasy(device.name + ".data.date", "state", exporttxt.data.date.replaceAll("~~", ""), deviceInfo.data.date, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.time", "state", exporttxt.data.time.replaceAll("~~", ""), deviceInfo.data.time, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.name", "state", exporttxt.data.name.replaceAll("~~", ""), deviceInfo.data.name, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.mac", "state", exporttxt.data.mac.replaceAll("~~", ""), deviceInfo.data.mac, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.localip", "state", exporttxt.data.local_IP.replaceAll("~~", ""), deviceInfo.data.local_IP, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.rssi", "state", exporttxt.data.rssi.replaceAll("~~", ""), deviceInfo.data.rssi, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.fw_maincontroller", "state", exporttxt.data.fw_MainController.replaceAll("~~", ""), deviceInfo.data.fw_MainController, "string", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".data.fw_wifi", "state", exporttxt.data.fw_WiFi.replaceAll("~~", ""), deviceInfo.data.fw_WiFi, "string", "indicator", true, false);
// Create Data Objects
await this.setObjectNotExistsAsyncEasy(device.name + '.data.date', 'state', exporttxt.data.date.replaceAll('~~', ''), deviceInfo.data.date, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.time', 'state', exporttxt.data.time.replaceAll('~~', ''), deviceInfo.data.time, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.name', 'state', exporttxt.data.name.replaceAll('~~', ''), deviceInfo.data.name, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.mac', 'state', exporttxt.data.mac.replaceAll('~~', ''), deviceInfo.data.mac, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.localip', 'state', exporttxt.data.local_IP.replaceAll('~~', ''), deviceInfo.data.local_IP, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.rssi', 'state', exporttxt.data.rssi.replaceAll('~~', ''), deviceInfo.data.rssi, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.fw_maincontroller', 'state', exporttxt.data.fw_MainController.replaceAll('~~', ''), deviceInfo.data.fw_MainController, 'string', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.data.fw_wifi', 'state', exporttxt.data.fw_WiFi.replaceAll('~~', ''), deviceInfo.data.fw_WiFi, 'string', 'indicator', true, false);
// Create Parameter Objects
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.temperature_in", "state", exporttxt.parameter.temperature_In.replaceAll("~~", ""), deviceInfo.parameter.temperature_In, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.temperature_out", "state", exporttxt.parameter.temperature_Out.replaceAll("~~", ""), deviceInfo.parameter.temperature_Out, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.temperature_fresh", "state", exporttxt.parameter.temperature_Fresh.replaceAll("~~", ""), deviceInfo.parameter.temperature_Fresh, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.rel_humidity_in", "state", exporttxt.parameter.rel_Humidity_In.replaceAll("~~", ""), deviceInfo.parameter.rel_Humidity_In, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.rel_humidity_out", "state", exporttxt.parameter.rel_Humidity_Out.replaceAll("~~", ""), deviceInfo.parameter.rel_Humidity_Out, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.abs_humidity_in", "state", exporttxt.parameter.abs_Humidity_In.replaceAll("~~", ""), deviceInfo.parameter.abs_Humidity_In, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.abs_humidity_out", "state", exporttxt.parameter.abs_Humidity_Out.replaceAll("~~", ""), deviceInfo.parameter.abs_Humidity_Out, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.efficiency", "state", exporttxt.parameter.efficiency.replaceAll("~~", ""), deviceInfo.parameter.efficiency, "number", "indicator", true, false);
await this.setObjectNotExistsAsyncEasy(device.name + ".parameter.humidity_transport", "state", exporttxt.parameter.humidity_Transport.replaceAll("~~", ""), deviceInfo.parameter.humidity_Transport, "number", "indicator", true, false);
// Create Parameter Objects
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.temperature_in', 'state', exporttxt.parameter.temperature_In.replaceAll('~~', ''), deviceInfo.parameter.temperature_In, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.temperature_out', 'state', exporttxt.parameter.temperature_Out.replaceAll('~~', ''), deviceInfo.parameter.temperature_Out, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.temperature_fresh', 'state', exporttxt.parameter.temperature_Fresh.replaceAll('~~', ''), deviceInfo.parameter.temperature_Fresh, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.rel_humidity_in', 'state', exporttxt.parameter.rel_Humidity_In.replaceAll('~~', ''), deviceInfo.parameter.rel_Humidity_In, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.rel_humidity_out', 'state', exporttxt.parameter.rel_Humidity_Out.replaceAll('~~', ''), deviceInfo.parameter.rel_Humidity_Out, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.abs_humidity_in', 'state', exporttxt.parameter.abs_Humidity_In.replaceAll('~~', ''), deviceInfo.parameter.abs_Humidity_In, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.abs_humidity_out', 'state', exporttxt.parameter.abs_Humidity_Out.replaceAll('~~', ''), deviceInfo.parameter.abs_Humidity_Out, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.efficiency', 'state', exporttxt.parameter.efficiency.replaceAll('~~', ''), deviceInfo.parameter.efficiency, 'number', 'indicator', true, false);
await this.setObjectNotExistsAsyncEasy(device.name + '.parameter.humidity_transport', 'state', exporttxt.parameter.humidity_Transport.replaceAll('~~', ''), deviceInfo.parameter.humidity_Transport, 'number', 'indicator', true, false);
// Create States Objects
await this.setObjectNotExistsAsyncEasy(device.name + ".states.speed_in", "state", exporttxt.states.speed_In.replaceAll("~~", ""), parseInt(deviceInfo.states.speed_In), "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.speed_out", "state", exporttxt.states.speed_Out.replaceAll("~~", ""), parseInt(deviceInfo.states.speed_Out), "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.antifreeze", "state", exporttxt.states.antiFreeze.replaceAll("~~", ""), parseInt(deviceInfo.states.antiFreeze), "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.systemon", "state", exporttxt.states.SystemOn.replaceAll("~~", ""), deviceInfo.states.SystemOn, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.Antifreeze", "state", exporttxt.states.AntiFreeze.replaceAll("~~", ""), deviceInfo.states.AntiFreeze, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.fixed_speed", "state", exporttxt.states.Fixed_Speed.replaceAll("~~", ""), deviceInfo.states.Fixed_Speed, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.defrosting", "state", exporttxt.states.Defrosting.replaceAll("~~", ""), deviceInfo.states.Defrosting, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.landlord_mode", "state", exporttxt.states.Landlord_Mode.replaceAll("~~", ""), deviceInfo.states.Landlord_Mode, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.cross_ventilation", "state", exporttxt.states.Cross_Ventilation.replaceAll("~~", ""), deviceInfo.states.Cross_Ventilation, "number", "indicator", true, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".states.timer_active", "state", exporttxt.states.Timer_active.replaceAll("~~", ""), deviceInfo.states.Timer_active, "number", "indicator", true, true);
// Create States Objects
await this.setObjectNotExistsAsyncEasy(device.name + '.states.speed_in', 'state', exporttxt.states.speed_In.replaceAll('~~', ''), parseInt(deviceInfo.states.speed_In), 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.speed_out', 'state', exporttxt.states.speed_Out.replaceAll('~~', ''), parseInt(deviceInfo.states.speed_Out), 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.antifreeze', 'state', exporttxt.states.antiFreeze.replaceAll('~~', ''), parseInt(deviceInfo.states.antiFreeze), 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.systemon', 'state', exporttxt.states.SystemOn.replaceAll('~~', ''), deviceInfo.states.SystemOn, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.Antifreeze', 'state', exporttxt.states.AntiFreeze.replaceAll('~~', ''), deviceInfo.states.AntiFreeze, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.fixed_speed', 'state', exporttxt.states.Fixed_Speed.replaceAll('~~', ''), deviceInfo.states.Fixed_Speed, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.defrosting', 'state', exporttxt.states.Defrosting.replaceAll('~~', ''), deviceInfo.states.Defrosting, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.landlord_mode', 'state', exporttxt.states.Landlord_Mode.replaceAll('~~', ''), deviceInfo.states.Landlord_Mode, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.cross_ventilation', 'state', exporttxt.states.Cross_Ventilation.replaceAll('~~', ''), deviceInfo.states.Cross_Ventilation, 'number', 'indicator', true, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.states.timer_active', 'state', exporttxt.states.Timer_active.replaceAll('~~', ''), deviceInfo.states.Timer_active, 'number', 'indicator', true, true);
// Create Commands
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.setSpeed", "state", "Speed", 1, "number", "level", true, true, 1, 10);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.powerOn", "state", "Power On", false, "boolean", "button", false, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.powerOff", "state", "Power Off", false, "boolean", "button", false, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.setAuto", "state", "Automatic Mode", false, "boolean", "button", false, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.buttonPower", "state", "Power Button", false, "boolean", "button", false, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.buttonTimer", "state", "Timer Button", false, "boolean", "button", false, true);
await this.setObjectNotExistsAsyncEasy(device.name + ".commands.syncTime", "state", "Sync Time", false, "boolean", "button", false, true);
// Create Commands
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.setSpeed', 'state', 'Speed', 1, 'number', 'level', true, true, 1, 10);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.powerOn', 'state', 'Power On', false, 'boolean', 'button', false, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.powerOff', 'state', 'Power Off', false, 'boolean', 'button', false, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.setAuto', 'state', 'Automatic Mode', false, 'boolean', 'button', false, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.buttonPower', 'state', 'Power Button', false, 'boolean', 'button', false, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.buttonTimer', 'state', 'Timer Button', false, 'boolean', 'button', false, true);
await this.setObjectNotExistsAsyncEasy(device.name + '.commands.syncTime', 'state', 'Sync Time', false, 'boolean', 'button', false, true);
await this.subscribeStatesAsync(device.name + ".commands.*");
}
}
await this.subscribeStatesAsync(device.name + '.commands.*');
}
}
/**
/**
* Is called if a subscribed state changes

@@ -127,48 +127,48 @@ * @param {string} id

*/
async onStateChange(id, state) {
if (!state) return;
if(state.val == false) return;
async onStateChange(id, state) {
if (!state) return;
if(state.val == false) return;
const id_splits = id.split(".");
const realid = id_splits[2] + "." + id_splits[3] + "." + id_splits[4];
const device = await this.GetDeviceByName(id_splits[2]);
const id_splits = id.split('.');
const realid = id_splits[2] + '.' + id_splits[3] + '.' + id_splits[4];
const device = await this.GetDeviceByName(id_splits[2]);
if(id.includes(".setSpeed")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?speed=" + state.val, device.name);
if(!res) return this.log.error("An error has occured while trying to set Device " + device.name + " Speed to " + state.val);
await this.setState(device.name + ".states.speed_in", state.val, true);
await this.setState(device.name + ".states.speed_out", state.val, true);
await this.setState(realid, state.val, true);
} else if(id.includes(".powerOn")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?power=on");
if(!res) return this.log.error("An error has occured while trying to power on device " + device.name);
await this.setState(device.name + ".states.SystemOn", 1, true);
await this.setState(realid, false);
} else if(id.includes(".powerOff")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?power=off");
if(!res) return this.log.error("An error has occured while trying to power off device " + device.name);
await this.setState(device.name + ".states.SystemOn", 0, true);
await this.setState(realid, false);
} else if(id.includes(".setAuto")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?speed=0");
if(!res) return this.log.error("An error has occured while trying to set automatic mode for device " + device.name);
await this.setState(device.name + ".states.speed_in", 0, true);
await this.setState(device.name + ".states.speed_out", 0, true);
await this.setState(realid, false);
} else if(id.includes(".buttonPower")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?button=power");
if(!res) return this.log.error("An error has occured while trying to send power button for device " + device.name);
await this.setState(realid, false);
} else if(id.includes(".buttonTimer")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/?button=timer");
if(!res) return this.log.error("An error has occured while trying to send power button to device " + device.name);
await this.setState(realid, false);
} else if(id.includes(".syncTime")) {
const res = await this.sendHttpRequest("http://" + device.ip + ":" + device.port + "/index.html?TimeSync=1");
if(!res) return this.log.error("An error has occured while trying to sync time for device " + device.name);
await this.setState(realid, false);
}
}
if(id.includes('.setSpeed')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?speed=' + state.val, device.name);
if(!res) return this.log.error('An error has occured while trying to set Device ' + device.name + ' Speed to ' + state.val);
await this.setState(device.name + '.states.speed_in', state.val, true);
await this.setState(device.name + '.states.speed_out', state.val, true);
await this.setState(realid, state.val, true);
} else if(id.includes('.powerOn')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?power=on');
if(!res) return this.log.error('An error has occured while trying to power on device ' + device.name);
await this.setState(device.name + '.states.SystemOn', 1, true);
await this.setState(realid, false);
} else if(id.includes('.powerOff')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?power=off');
if(!res) return this.log.error('An error has occured while trying to power off device ' + device.name);
await this.setState(device.name + '.states.SystemOn', 0, true);
await this.setState(realid, false);
} else if(id.includes('.setAuto')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?speed=0');
if(!res) return this.log.error('An error has occured while trying to set automatic mode for device ' + device.name);
await this.setState(device.name + '.states.speed_in', 0, true);
await this.setState(device.name + '.states.speed_out', 0, true);
await this.setState(realid, false);
} else if(id.includes('.buttonPower')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?button=power');
if(!res) return this.log.error('An error has occured while trying to send power button for device ' + device.name);
await this.setState(realid, false);
} else if(id.includes('.buttonTimer')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/?button=timer');
if(!res) return this.log.error('An error has occured while trying to send power button to device ' + device.name);
await this.setState(realid, false);
} else if(id.includes('.syncTime')) {
const res = await this.sendHttpRequest('http://' + device.ip + ':' + device.port + '/index.html?TimeSync=1');
if(!res) return this.log.error('An error has occured while trying to sync time for device ' + device.name);
await this.setState(realid, false);
}
}
/**
/**
* Creates an object in the object db. Existing objects are overwritten.

@@ -186,47 +186,47 @@ * @param {String} id ID

*/
async setObjectNotExistsAsyncEasy(id, type, name, def, common_type, role, read, write, min = -1, max = -1) {
const object = await this.getObjectAsync(id);
if (object == null) {
if (min != -1 && max != -1) {
await this.setObjectNotExistsAsync(id, { type: type, common: { name: name, def: def, type: common_type, role: role, read: read, write: write, min: min, max: max } });
} else {
await this.setObjectNotExistsAsync(id, { type: type, common: { name: name, def: def, type: common_type, role: role, read: read, write: write } });
}
} else {
if(id.includes(".data.")) {
await this.setStateAsync(id, def, "string");
} else if(id.includes(".parameter.")) {
await this.setStateAsync(id, parseFloat(def), "number");
} else if(id.includes(".states.")) {
await this.setStateAsync(id, parseFloat(def), "number");
}
}
}
async setObjectNotExistsAsyncEasy(id, type, name, def, common_type, role, read, write, min = -1, max = -1) {
const object = await this.getObjectAsync(id);
if (object == null) {
if (min != -1 && max != -1) {
await this.setObjectNotExistsAsync(id, { type: type, common: { name: name, def: def, type: common_type, role: role, read: read, write: write, min: min, max: max } });
} else {
await this.setObjectNotExistsAsync(id, { type: type, common: { name: name, def: def, type: common_type, role: role, read: read, write: write } });
}
} else {
if(id.includes('.data.')) {
await this.setStateAsync(id, def, 'string');
} else if(id.includes('.parameter.')) {
await this.setStateAsync(id, parseFloat(def), 'number');
} else if(id.includes('.states.')) {
await this.setStateAsync(id, parseFloat(def), 'number');
}
}
}
/**
/**
* Returns all devices in config
* @returns All Devices in Config
*/
GetDevices() {
return this.config.devices;
}
GetDevices() {
return this.config.devices;
}
/**
/**
* Get Device Info by Name
* @param {String} name Device name
*/
async GetDeviceByName(name) {
const devices = await this.GetDevices();
if(devices == null || !devices) return null;
let device = null;
for await(const devicen of devices) {
if(devicen.name == name) {
device = devicen;
break;
}
}
return device;
}
async GetDeviceByName(name) {
const devices = await this.GetDevices();
if(devices == null || !devices) return null;
let device = null;
for await(const devicen of devices) {
if(devicen.name == name) {
device = devicen;
break;
}
}
return device;
}
/**
/**
*

@@ -236,35 +236,35 @@ * @param {String} url URL to get Data from

*/
async GetHttpRequest(url, deviceName) {
let response = null;
try {
response = await NodeFetch(url);
} catch(error) {
if (error.code == "ETIMEDOUT") {
this.log.error("An error has occured while trying to get response from device " + deviceName + ". The Connection timed out!");
return null;
}
if (error.code == "ECONNREFUSED") {
this.log.error("An error has occured while trying to get response from device " + deviceName + ". The Connection has been refused!");
return null;
}
this.log.error("An unexpected error has occred while trying to get response from device " + deviceName + ".");
return null;
}
async GetHttpRequest(url, deviceName) {
let response = null;
try {
response = await NodeFetch(url);
} catch(error) {
if (error.code == 'ETIMEDOUT') {
this.log.error('An error has occured while trying to get response from device ' + deviceName + '. The Connection timed out!');
return null;
}
if (error.code == 'ECONNREFUSED') {
this.log.error('An error has occured while trying to get response from device ' + deviceName + '. The Connection has been refused!');
return null;
}
this.log.error('An unexpected error has occred while trying to get response from device ' + deviceName + '.');
return null;
}
let data = null;
try {
data = await response.json();
} catch(error) {
if(error.type == "invalid-json") {
this.log.error("An error has occured while trying to format json data. Did you setup the template correctly? Go to LINK to setup template correctly");
return null;
}
this.log.error("Unexpected Error while trying to format json data! " + error);
return null;
}
if (data == null) return null;
return data;
}
let data = null;
try {
data = await response.json();
} catch(error) {
if(error.type == 'invalid-json') {
this.log.error('An error has occured while trying to format json data. Did you setup the template correctly? Go to LINK to setup template correctly');
return null;
}
this.log.error('Unexpected Error while trying to format json data! ' + error);
return null;
}
if (data == null) return null;
return data;
}
/**
/**
* Send HTTP Request without returning any data

@@ -274,32 +274,32 @@ * @param {String} url URL to send the Command

*/
async sendHttpRequest(url, deviceName) {
let response = null;
try {
response = await NodeFetch(url);
} catch(error) {
if (error.code == "ETIMEDOUT") {
this.log.error("An error has occured while trying to send request to device " + deviceName + ". The Connection timed out!");
return null;
}
if (error.code == "ECONNREFUSED") {
this.log.error("An error has occured while trying to send request to device " + deviceName + ". The Connection has been refused!");
return null;
}
this.log.error("An unexpected error has occred while trying to send request to device " + deviceName + ".");
}
async sendHttpRequest(url, deviceName) {
let response = null;
try {
response = await NodeFetch(url);
} catch(error) {
if (error.code == 'ETIMEDOUT') {
this.log.error('An error has occured while trying to send request to device ' + deviceName + '. The Connection timed out!');
return null;
}
if (error.code == 'ECONNREFUSED') {
this.log.error('An error has occured while trying to send request to device ' + deviceName + '. The Connection has been refused!');
return null;
}
this.log.error('An unexpected error has occred while trying to send request to device ' + deviceName + '.');
}
if (response.status == 200 && response.statusText == "OK") return true;
return false;
}
if (response.status == 200 && response.statusText == 'OK') return true;
return false;
}
}
if (require.main !== module) {
// Export the constructor in compact mode
/**
// Export the constructor in compact mode
/**
* @param {Partial<utils.AdapterOptions>} [options={}]
*/
module.exports = (options) => new Bayernluft(options);
module.exports = (options) => new Bayernluft(options);
} else {
// otherwise start the instance directly
new Bayernluft();
// otherwise start the instance directly
new Bayernluft();
}
{
"name": "iobroker.bayernluft",
"version": "1.2.2",
"version": "2.0.0-alpha.0",
"description": "Connects BayernLuft into IoBroker",

@@ -9,3 +9,6 @@ "author": {

},
"homepage": "https://github.com/Marco15453/ioBroker.bayernluft",
"contributors": [
"mcm1957 <mcm57@gmx.at>"
],
"homepage": "https://github.com/iobroker-community-adapters/ioBroker.bayernluft",
"license": "MIT",

@@ -21,34 +24,37 @@ "keywords": [

"type": "git",
"url": "https://github.com/Marco15453/ioBroker.bayernluft.git"
"url": "https://github.com/iobroker-community-adapters/ioBroker.bayernluft.git"
},
"engines": {
"node": ">= 16"
"node": ">= 18"
},
"dependencies": {
"@iobroker/adapter-core": "^2.6.7",
"node-fetch": "^3.2.10"
"@iobroker/adapter-core": "^3.1.4",
"node-fetch": "^3.3.2"
},
"devDependencies": {
"@alcalzone/release-script": "^3.5.9",
"@alcalzone/release-script-plugin-iobroker": "^3.5.9",
"@alcalzone/release-script-plugin-license": "^3.5.9",
"@alcalzone/release-script-plugin-manual-review": "^3.5.9",
"@iobroker/adapter-dev": "^1.2.0",
"@iobroker/testing": "^4.1.0",
"@tsconfig/node16": "^1.0.3",
"@types/chai": "^4.3.3",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.8",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.13",
"@types/sinon-chai": "^3.2.8",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"eslint": "^8.26.0",
"mocha": "^10.1.0",
"@alcalzone/release-script": "^3.7.0",
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@tsconfig/node14": "^14.1.2",
"@types/chai": "^4.3.11",
"@types/chai-as-promised": "^7.1.8",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.12",
"@types/proxyquire": "^1.3.31",
"@types/sinon": "^17.0.3",
"@types/sinon-chai": "^3.2.12",
"chai": "^4.4.1",
"chai-as-promised": "^7.1.2",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"mocha": "^10.4.0",
"prettier": "^3.2.5",
"proxyquire": "^2.1.3",
"sinon": "^14.0.1",
"sinon": "^18.0.0",
"sinon-chai": "^3.7.0",
"typescript": "~4.6.4"
"typescript": "~5.4.5"
},

@@ -76,5 +82,5 @@ "main": "main.js",

"bugs": {
"url": "https://github.com/Marco15453/ioBroker.bayernluft/issues"
"url": "https://github.com/iobroker-community-adapters/ioBroker.bayernluft/issues"
},
"readmeFilename": "README.md"
}

@@ -67,39 +67,18 @@ ![Logo](admin/bayernluft.png)

## Credits
This adapter would not have been possible without the great work of @Marco15453 (https://github.com/Marco15453), who create V1.x.x of this adapter.
## Changelog
<!--
Placeholder for the next version (at the beginning of the line):
### **WORK IN PROGRESS**
-->
### 1.2.2 (2022-11-04)
* Updated Rest of Old Repo Name
### 2.0.0-alpha.0 (2024-05-17)
* (mcm1957) Adapter has been move to iobroker-community-adapters organization
* (mcm1957) Dependencies have been updated
### 1.2.1 (2022-11-04)
* Updated Repo Name
### 1.2.0 (2022-11-03)
* Removed unused packages
* Fixed Double Requests on Startup
* Fixed the Connection Bug
### 1.1.2 (2022-10-31)
* Updated README
### 1.1.1 (2022-10-31)
* Interval Hotfix
### 1.1.0 (2022-10-31)
* Added Update Interval
### 1.0.2 (2022-10-31)
* Fixed Node-Fetch Import
### 1.0.1 (2022-10-31)
* Small Fixes for Repo
### 1.0.0 (2022-10-31)
* Initial Release (Test Release)
## License
MIT License
Copyright (c) 2024, iobroker-community-adapters <iobroker-community-adapters@gmx.de>
Copyright (c) 2022 Marco15453 <support@marco15453.xyz>

@@ -106,0 +85,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc