Initial commit

This commit is contained in:
2019-01-16 09:07:10 +08:00
commit 0cc08f136d
32 changed files with 7021 additions and 0 deletions
+139
View File
@@ -0,0 +1,139 @@
module.exports = {
Action: {type: 'number', role: 'value', read: true, write: true},
AirQuality: {type: 'number', role: 'value', read: true, write: false, unit: '%'},
A0: {type: 'number', role: 'value', read: true, write: false},
A1: {type: 'number', role: 'value', read: true, write: false},
A2: {type: 'number', role: 'value', read: true, write: false},
A3: {type: 'number', role: 'value', read: true, write: false},
ANALOG: {type: 'object', role: 'state', read: true, write: false},
Analog0: {type: 'number', role: 'value', read: true, write: false},
Analog1: {type: 'number', role: 'value', read: true, write: false},
Analog2: {type: 'number', role: 'value', read: true, write: false},
Analog3: {type: 'number', role: 'value', read: true, write: false},
Arm: {type: 'number', role: 'value', read: true, write: true},
'Approx. Altitude': {type: 'number', role: 'value.altitude', read: true, write: false, unit: 'm'},
Bits: {type: 'number', role: 'value', read: true, write: false},
Blue: {type: 'number', role: 'level.color.blue', read: true, write: true, min: 0, max: 100},
Boiler: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Burner: {type: 'number', role: 'value', read: true, write: false},
CT: {type: 'number', role: 'level.color.temp', read: true, write: true},
CW: {type: 'number', role: 'level.color.coldwhite', read: true, write: true},
CW_POWER: {type: 'boolean', role: 'switch.light', read: true, write: true, storeMap: true},
CarbonDioxide: {type: 'number', role: 'value.CO2', read: true, write: false, unit: 'ppm'},
Channel: {type: 'array', role: 'level', read: true, write: true},
Collector: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Color: {type: 'string', role: 'level.color.rgb', read: true, write: true},
Counter1: {type: 'number', role: 'value', read: true, write: false},
Counter2: {type: 'number', role: 'value', read: true, write: false},
Counter3: {type: 'number', role: 'value', read: true, write: false},
Counter4: {type: 'number', role: 'value', read: true, write: false},
Current: {type: 'number', role: 'value.current', read: true, write: false, unit: 'A'},
Data: {type: 'string', role: 'state', read: true, write: true},
Days: {type: 'string', role: 'state', read: true, write: true},
Dimmer: {type: 'number', role: 'level.dimmer', read: true, write: true},
Distance: {type: 'number', role: 'value', read: true, write: false, unit: 'cm'},
Druck: {type: 'number', role: 'value.pressure', read: true, write: false, unit: 'P'},
Factor: {type: 'number', role: 'value', read: true, write: false},
Fade: {type: 'boolean', role: 'switch', read: true, write: true},
Faktor: {type: 'number', role: 'value', read: true, write: false},
Feuchtigkeit: {type: 'number', role: 'value.humidity', read: true, write: false, unit: '%'},
Green: {type: 'number', role: 'level.color.green', read: true, write: true, min: 0, max: 100},
Hostname: {type: 'string', role: 'state', read: true, write: false},
Hue: {type: 'number', role: 'level.color.hue', read: true, write: true, min: 0}, // max ??
Humidity: {type: 'number', role: 'value.humidity', read: true, write: false, unit: '%'},
HSBColor: {type: 'string', role: 'value.hsb', read: true, write: true},
IPAddress: {type: 'string', role: 'state', read: true, write: false},
IPaddress: {type: 'string', role: 'state', read: true, write: false},
Illuminance: {type: 'number', role: 'value.illuminance', read: true, write: false, unit: 'lx'},
IrReceived: {type: 'object', role: 'state', read: true, write: false},
IRSend: {type: 'string', role: 'state', read: true, write: true},
Latitude: {type: 'number', role: 'value.gps.latitude', read: true, write: false, unit: '°'},
Laufzeit: {type: 'number', role: 'value.duration', read: true, write: false, unit: 'hours'}, /// ?
LedBar: {type: 'number', role: 'value', read: true, write: true},
LED_Mode: {type: 'number', role: 'value', read: true, write: true},
Leistung: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'W'},
Light: {type: 'number', role: 'value', read: true, write: false, unit: 'lx'},
Longitude: {type: 'number', role: 'value.gps.longitude', read: true, write: false, unit: '°'},
modeLedExor: {type: 'boolean', role: 'switch', read: true, write: true, def: false, desc: 'exor for white LEDs and color leds => if the white LEDs are switched on, color LEDs are switched off and vice versa'},
modeReadColors:{type: 'boolean', role: 'switch', read: true, write: true, def: true, desc: 'allow for color read from MQTT'},
Mode: {type: 'number', role: 'value', read: true, write: true},
Module: {type: 'string', role: 'state', read: true, write: false},
Noise: {type: 'number', role: 'value', read: true, write: false, unit: 'dB'},
Output: {type: 'number', role: 'value', read: true, write: true},
Outsidetemp: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
'PM2.5': {type: 'number', role: 'value', read: true, write: false, unit: 'ug/m3'},
PM10: {type: 'number', role: 'value', read: true, write: false, unit: 'ug/m3'},
POWER1: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER2: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER3: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER4: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER5: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER6: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER7: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER8: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
POWER: {type: 'boolean', role: 'switch', read: true, write: true, storeMap: true},
Protocol: {type: 'string', role: 'state', read: true, write: true},
Power: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'W'},
Power_curr: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'W'},
Pressure: {type: 'number', role: 'value.pressure', read: true, write: false, unit: 'P'},
Punkt: {type: 'number', role: 'value', read: true, write: false, unit: '?'}, /// ?
RGB_POWER: {type: 'boolean', role: 'switch.light', read: true, write: true, storeMap: true},
RSSI: {type: 'number', role: 'value.rssi', read: true, write: false},
Red: {type: 'number', role: 'level.color.red', read: true, write: true, min: 0, max: 100},
Repeat: {type: 'number', role: 'value', read: true, write: true},
RestartReason: {type: 'string', role: 'state', read: true, write: false},
Returns: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Roomtemp: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Saturation: {type: 'number', role: 'level.color.saturation', read: true, write: true, min: 0}, // max: 100 ??
Scheme: {type: 'number', role: 'value', read: true, write: false},
SeaPressure: {type: 'number', role: 'value.pressure', read: true, write: false, unit: 'P'},
Solarpump: {type: 'number', role: 'value', read: true, write: false},
Solarstorage: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Spannung: {type: 'number', role: 'value.voltage', read: true, write: false, unit: 'V'},
Speed: {type: 'number', role: 'value', read: true, write: false},
Status: {type: 'number', role: 'value', read: true, write: false},
Strom: {type: 'number', role: 'value.current', read: true, write: false, unit: 'A'},
Switch1: {type: 'boolean', role: 'switch', read: true, write: false},
Switch2: {type: 'boolean', role: 'switch', read: true, write: false},
Switch3: {type: 'boolean', role: 'switch', read: true, write: false},
Switch4: {type: 'boolean', role: 'switch', read: true, write: false},
TVOC: {type: 'number', role: 'value.tvoc', read: true, write: false, unit: 'ppb'},
Temperatur: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Temperature: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Time: {type: 'string', role: 'state', read: true, write: true},
Timer1: {type: 'object', role: 'state', read: true, write: true},
Timer2: {type: 'object', role: 'state', read: true, write: true},
Timer3: {type: 'object', role: 'state', read: true, write: true},
Timer4: {type: 'object', role: 'state', read: true, write: true},
Timer5: {type: 'object', role: 'state', read: true, write: true},
Timer6: {type: 'object', role: 'state', read: true, write: true},
Timer7: {type: 'object', role: 'state', read: true, write: true},
Timer8: {type: 'object', role: 'state', read: true, write: true},
Timer9: {type: 'object', role: 'state', read: true, write: true},
Timer10: {type: 'object', role: 'state', read: true, write: true},
Timer11: {type: 'object', role: 'state', read: true, write: true},
Timer12: {type: 'object', role: 'state', read: true, write: true},
Timer13: {type: 'object', role: 'state', read: true, write: true},
Timer14: {type: 'object', role: 'state', read: true, write: true},
Timer15: {type: 'object', role: 'state', read: true, write: true},
Timer16: {type: 'object', role: 'state', read: true, write: true},
Today: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
Total: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
Total_in: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
Total_out: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
Uptime: {type: 'string', role: 'state', read: true, write: false},
UvLevel: {type: 'number', role: 'value', read: true, write: false},
VCC: {type: 'number', role: 'value.voltage', read: true, write: false, unit: 'V'},
Vcc: {type: 'number', role: 'value.voltage', read: true, write: false, unit: 'V'},
Version: {type: 'string', role: 'state', read: true, write: false},
Voltage: {type: 'number', role: 'value.voltage', read: true, write: false, unit: 'V'},
Window: {type: 'number', role: 'value', read: true, write: true},
WW: {type: 'number', role: 'level.color.white', read: true, write: true},
WW_POWER: {type: 'boolean', role: 'switch.light', read: true, write: true, storeMap: true},
Wakeup: {type: 'string', role: 'state', read: true, write: true},
Warmwater: {type: 'number', role: 'value.temperature', read: true, write: false, unit: '°C'},
Yesterday: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
eCO2: {type: 'number', role: 'value.eco2', read: true, write: false, unit: 'ppm'},
gestern: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'},
heute: {type: 'number', role: 'value.power.consumption', read: true, write: false, unit: 'kWh'}
};
+1643
View File
File diff suppressed because it is too large Load Diff
+83
View File
@@ -0,0 +1,83 @@
'use strict';
const fs = require('fs');
const path = require('path');
let controllerDir;
let appName;
/**
* returns application name
*
* The name of the application can be different and this function finds it out.
*
* @returns {string}
*/
function getAppName() {
const parts = __dirname.replace(/\\/g, '/').split('/');
return parts[parts.length - 2].split('.')[0];
}
/**
* looks for js-controller home folder
*
* @param {boolean} isInstall
* @returns {string}
*/
function getControllerDir(isInstall) {
// Find the js-controller location
const possibilities = [
'iobroker.js-controller',
'ioBroker.js-controller',
];
/** @type {string} */
let controllerPath;
for (const pkg of possibilities) {
try {
const possiblePath = require.resolve(pkg);
if (fs.existsSync(possiblePath)) {
controllerPath = possiblePath;
break;
}
} catch (e) { /* not found */ }
}
if (!controllerPath) {
if (!isInstall) {
console.log('Cannot find js-controller');
process.exit(10);
} else {
process.exit();
}
}
// we found the controller
return path.dirname(controllerPath);
}
/**
* reads controller base settings
*
* @alias getConfig
* @returns {object}
*/
function getConfig() {
let configPath;
if (fs.existsSync(
configPath = path.join(controllerDir, 'conf', appName + '.json')
)) {
return JSON.parse(fs.readFileSync(configPath, 'utf8'));
} else if (fs.existsSync(
configPath = path.join(controllerDir, 'conf', + appName.toLowerCase() + '.json')
)) {
return JSON.parse(fs.readFileSync(configPath, 'utf8'));
} else {
throw new Error('Cannot find ' + controllerDir + '/conf/' + appName + '.json');
}
}
appName = getAppName();
controllerDir = getControllerDir(typeof process !== 'undefined' && process.argv && process.argv.indexOf('--install') !== -1);
const adapter = require(path.join(controllerDir, 'lib/adapter.js'));
exports.controllerDir = controllerDir;
exports.getConfig = getConfig;
exports.Adapter = adapter;
exports.appName = appName;