diff --git a/.eslintrc b/.eslintrc index 7d5e132..1ecc4eb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,7 @@ "sourceType": "module" }, "rules": { - "quotes": ["error", "double"], + "quotes": ["error", "single"], "indent": ["error", 2, { "SwitchCase": 1 }], "linebreak-style": ["error", "unix"], "semi": ["error", "always"], diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..a962f07 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,31 @@ +--- +yaml-files: + - "*.yaml" + - "*.yml" + - ".yamllint" + +rules: + braces: enable + brackets: enable + colons: enable + commas: enable + comments: + level: warning + comments-indentation: + level: warning + document-end: disable + document-start: disable + empty-lines: enable + empty-values: disable + hyphens: enable + indentation: enable + key-duplicates: enable + key-ordering: disable + line-length: enable + new-line-at-end-of-file: enable + new-lines: enable + octal-values: disable + quoted-strings: disable + trailing-spaces: enable + truthy: + level: warning diff --git a/README.md b/README.md index 96b284c..5e3e56d 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,16 @@ Whole setup instruction is available on plugin configuration page in homebridge. ### Supported devices and accessories -**Devices** + +**Device list** * F1145-10 PC * F750 CU 3x400V +* VVM 500 +* F2120-12 +* F1245-6 E PC EM +* F370 CU 3x400V +* VVM 320 E +* F2040-12 *If your device is not on the list please install the plugin, configure it and you will see error log in homebridge with details how to create "add new device" issue* @@ -52,6 +59,14 @@ Whole setup instruction is available on plugin configuration page in homebridge. @@ -62,6 +77,12 @@ Whole setup instruction is available on plugin configuration page in homebridge. diff --git a/config/F1145-10-PC.yaml b/config/F1145-10-PC.yaml index 82193b0..8c2cd56 100644 --- a/config/F1145-10-PC.yaml +++ b/config/F1145-10-PC.yaml @@ -1,50 +1,3 @@ accessories: - - id: hot-water - services: - - type: HeaterCooler - characteristics: - - type: CurrentTemperature - id: 40014 - refresh: true - - type: Active - id: 48132 - refresh: true - manage: - id: 48132 - - type: CurrentHeaterCoolerState - id: 43115 - attribute: displayValue - refresh: true - parser: notEmpty - mapper: - - true: 2 - - false: 1 - props: - maxValue: 2 - minValue: 1 - validValues: [1, 2] - - type: TargetHeaterCoolerState - value: 0 - props: - maxValue: 0 - minValue: 0 - validValues: [0] - - type: TemperatureDisplayUnits - id: 40014 - attribute: unit - mapper: - - "°F": 1 - - "default": 0 - props: - perms: ["pr"] - refresh: true - - type: Name - value: temperature.current.name - translate: true - - type: HeatingThresholdTemperature - config: - key: temporaryLuxMaxTemperature - default: 53 - props: - maxValue: 70 - refresh: true + - outdoor-temperature-40004 + - hot-water diff --git a/config/F1245-6-E-PC-EM.yaml b/config/F1245-6-E-PC-EM.yaml new file mode 100644 index 0000000..8c2cd56 --- /dev/null +++ b/config/F1245-6-E-PC-EM.yaml @@ -0,0 +1,3 @@ +accessories: + - outdoor-temperature-40004 + - hot-water diff --git a/config/F2040.yaml b/config/F2040.yaml new file mode 100644 index 0000000..257da83 --- /dev/null +++ b/config/F2040.yaml @@ -0,0 +1,2 @@ +accessories: + - outdoor-temperature-44362 diff --git a/config/F2120.yaml b/config/F2120.yaml new file mode 100644 index 0000000..257da83 --- /dev/null +++ b/config/F2120.yaml @@ -0,0 +1,2 @@ +accessories: + - outdoor-temperature-44362 diff --git a/config/F370-CU-3x400V.yaml b/config/F370-CU-3x400V.yaml new file mode 100644 index 0000000..8c2cd56 --- /dev/null +++ b/config/F370-CU-3x400V.yaml @@ -0,0 +1,3 @@ +accessories: + - outdoor-temperature-40004 + - hot-water diff --git a/config/F750-CU-3x400V.yaml b/config/F750-CU-3x400V.yaml index 82193b0..8c2cd56 100644 --- a/config/F750-CU-3x400V.yaml +++ b/config/F750-CU-3x400V.yaml @@ -1,50 +1,3 @@ accessories: - - id: hot-water - services: - - type: HeaterCooler - characteristics: - - type: CurrentTemperature - id: 40014 - refresh: true - - type: Active - id: 48132 - refresh: true - manage: - id: 48132 - - type: CurrentHeaterCoolerState - id: 43115 - attribute: displayValue - refresh: true - parser: notEmpty - mapper: - - true: 2 - - false: 1 - props: - maxValue: 2 - minValue: 1 - validValues: [1, 2] - - type: TargetHeaterCoolerState - value: 0 - props: - maxValue: 0 - minValue: 0 - validValues: [0] - - type: TemperatureDisplayUnits - id: 40014 - attribute: unit - mapper: - - "°F": 1 - - "default": 0 - props: - perms: ["pr"] - refresh: true - - type: Name - value: temperature.current.name - translate: true - - type: HeatingThresholdTemperature - config: - key: temporaryLuxMaxTemperature - default: 53 - props: - maxValue: 70 - refresh: true + - outdoor-temperature-40004 + - hot-water diff --git a/config/VVM-320-E.yaml b/config/VVM-320-E.yaml new file mode 100644 index 0000000..8c2cd56 --- /dev/null +++ b/config/VVM-320-E.yaml @@ -0,0 +1,3 @@ +accessories: + - outdoor-temperature-40004 + - hot-water diff --git a/config/VVM-500.yaml b/config/VVM-500.yaml new file mode 100644 index 0000000..8c2cd56 --- /dev/null +++ b/config/VVM-500.yaml @@ -0,0 +1,3 @@ +accessories: + - outdoor-temperature-40004 + - hot-water diff --git a/config/common.yaml b/config/common.yaml index e027e28..1114115 100644 --- a/config/common.yaml +++ b/config/common.yaml @@ -1,26 +1,90 @@ -global: - accessory: - id: nibe- +accessory: + id: nibe- + services: + - type: AccessoryInformation + characteristics: + - type: Manufacturer + value: Nibe + - type: Model + id: 1 + attribute: displayValue + - type: SerialNumber + id: 2 + attribute: displayValue +accessoriesConfiguration: + - id: outdoor-temperature-40004 + name: outdoor-temperature services: + - type: TemperatureSensor + characteristics: + - type: CurrentTemperature + id: 40004 + refresh: true + - type: Name + value: temperature.current.name + translate: true + - id: outdoor-temperature-44362 + name: outdoor-temperature + services: + - type: TemperatureSensor + characteristics: + - type: CurrentTemperature + id: 44362 + refresh: true + - type: Name + value: temperature.current.name + translate: true - type: AccessoryInformation characteristics: - - type: Manufacturer - value: Nibe - - type: Model - id: 1 - attribute: displayValue - type: SerialNumber - id: 2 - attribute: displayValue - -accessories: - - id: outdoor-temperature + value: "00000000" + - id: hot-water + name: hot-water services: - - type: TemperatureSensor + - type: HeaterCooler characteristics: - type: CurrentTemperature - id: 40004 + id: 40014 + refresh: true + - type: Active + id: 48132 + refresh: true + manage: + id: 48132 + - type: CurrentHeaterCoolerState + id: 43115 + attribute: displayValue + refresh: true + parser: notEmpty + mapper: + - true: 2 + - false: 1 + props: + maxValue: 2 + minValue: 1 + validValues: [1, 2] + - type: TargetHeaterCoolerState + value: 0 + props: + maxValue: 0 + minValue: 0 + validValues: [0] + - type: TemperatureDisplayUnits + id: 40014 + attribute: unit + mapper: + - "°F": 1 + - "default": 0 + props: + perms: ["pr"] refresh: true - type: Name value: temperature.current.name translate: true + - type: HeatingThresholdTemperature + config: + key: temporaryLuxMaxTemperature + default: 53 + props: + maxValue: 70 + refresh: true diff --git a/gulpfile.ts b/gulpfile.ts index c7d2e87..ae53847 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -1,20 +1,20 @@ -import { dest, parallel, series, src } from "gulp"; -import * as ts from "gulp-typescript"; -import gulpif from "gulp-if"; -import htmlmin from "gulp-htmlmin"; -import imagemin from "gulp-imagemin"; -import del from "del"; -import gulpESLintNew from "gulp-eslint-new"; -import nodemon from "gulp-nodemon"; -import jest from "gulp-jest"; +import { dest, parallel, series, src } from 'gulp'; +import * as ts from 'gulp-typescript'; +import gulpif from 'gulp-if'; +import htmlmin from 'gulp-htmlmin'; +import imagemin from 'gulp-imagemin'; +import del from 'del'; +import gulpESLintNew from 'gulp-eslint-new'; +import nodemon from 'gulp-nodemon'; +import jest from 'gulp-jest'; -const tsProject = ts.createProject("tsconfig.json", { rootDir: "src/" }); -const destDir = "dist/"; -const isHtml = (file) => file.extname === ".html"; -const isImage = (file) => file.extname === ".png"; +const tsProject = ts.createProject('tsconfig.json', { rootDir: 'src/' }); +const destDir = 'dist/'; +const isHtml = (file) => file.extname === '.html'; +const isImage = (file) => file.extname === '.png'; -exports.uiBuild = () => src("homebridge-ui/**") +exports.uiBuild = () => src('homebridge-ui/**') .pipe(gulpif(isHtml, htmlmin({ collapseWhitespace: true, minifyCSS: true, @@ -23,19 +23,19 @@ exports.uiBuild = () => src("homebridge-ui/**") .pipe(gulpif(isImage, imagemin())) .pipe(dest(`${destDir}homebridge-ui/`)); -exports.yamlBuild = () => src("+(config|lang)/*.yaml") +exports.yamlBuild = () => src('+(config|lang)/*.yaml') .pipe(dest(`${destDir}`)); -exports.typescriptBuild = () => src("src/**/*.ts") +exports.typescriptBuild = () => src('src/**/*.ts') .pipe(tsProject()) .pipe(dest(`${destDir}`)); -exports.eslint = () => src(["src/**/*.ts", "gulpfile.ts"]) +exports.eslint = () => src(['src/**/*.ts', 'gulpfile.ts']) .pipe(gulpESLintNew()) .pipe(gulpESLintNew.format()) .pipe(gulpESLintNew.failAfterError()); -exports.eslintFix = () => src(["src/**/*.ts", "gulpfile.ts"]) +exports.eslintFix = () => src(['src/**/*.ts', 'gulpfile.ts']) .pipe(gulpESLintNew({ fix: true })) .pipe(gulpESLintNew.fix()); @@ -44,11 +44,11 @@ exports.clean = () => del([`${destDir}`]); exports.build = parallel(exports.yamlBuild, exports.typescriptBuild, exports.uiBuild); exports.watch = (done) => nodemon({ - exec: "homebridge -I -D", - signal: "SIGTERM", - ext: "ts html yaml", + exec: 'homebridge -I -D', + signal: 'SIGTERM', + ext: 'ts html yaml', ignore: [`${destDir}**`], - env: { "NODE_OPTIONS": "--trace-warnings" }, + env: { 'NODE_OPTIONS': '--trace-warnings' }, done: done, tasks: function (changedFiles) { const tasks = Array(); @@ -56,15 +56,15 @@ exports.watch = (done) => nodemon({ return tasks; } changedFiles.forEach(function (file) { - const fileExt = file.split(".").pop(); - if (fileExt === "ts" && !~tasks.indexOf("typescriptBuild")) { - tasks.push("typescriptBuild"); + const fileExt = file.split('.').pop(); + if (fileExt === 'ts' && !~tasks.indexOf('typescriptBuild')) { + tasks.push('typescriptBuild'); } - if (fileExt === "html" && !~tasks.indexOf("uiBuild")) { - tasks.push("uiBuild"); + if (fileExt === 'html' && !~tasks.indexOf('uiBuild')) { + tasks.push('uiBuild'); } - if (fileExt === "yaml" && !~tasks.indexOf("yamlBuild")) { - tasks.push("yamlBuild"); + if (fileExt === 'yaml' && !~tasks.indexOf('yamlBuild')) { + tasks.push('yamlBuild'); } }); return tasks; @@ -72,14 +72,14 @@ exports.watch = (done) => nodemon({ }); exports.jest = () => { - process.env.NODE_ENV = "test"; + process.env.NODE_ENV = 'test'; - return src("tests/**/*.test.ts") + return src('tests/**/*.test.ts') .pipe(jest({ - preset: "ts-jest", - testEnvironment: "node", - transform: { "^.+\\.ts?$": "ts-jest" }, - transformIgnorePatterns: ["/node_modules/"], + preset: 'ts-jest', + testEnvironment: 'node', + transform: { '^.+\\.ts?$': 'ts-jest' }, + transformIgnorePatterns: ['/node_modules/'], })); }; diff --git a/homebridge-ui/public/index.html b/homebridge-ui/public/index.html index 8a2e760..ee08de6 100644 --- a/homebridge-ui/public/index.html +++ b/homebridge-ui/public/index.html @@ -1,5 +1,6 @@