iobroker.smartcontrol 1.3.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -0
- package/README.md +57 -297
- package/admin/css/LICENSE-github-markdown-css.txt +24 -0
- package/admin/css/github-markdown-dark.min.css +8 -0
- package/admin/css/github-markdown.min.css +8 -0
- package/admin/doc-md/table-trigger-motion_de.md +1 -1
- package/admin/doc-md/table-trigger-motion_en.md +1 -1
- package/admin/doc-md/table-trigger-times_de.md +1 -1
- package/admin/doc-md/table-trigger-times_en.md +1 -1
- package/admin/i18n/de/translations.json +109 -0
- package/admin/i18n/en/translations.json +109 -0
- package/admin/i18n/es/translations.json +109 -0
- package/admin/i18n/fr/translations.json +109 -0
- package/admin/i18n/it/translations.json +109 -0
- package/admin/i18n/nl/translations.json +109 -0
- package/admin/i18n/pl/translations.json +109 -0
- package/admin/i18n/pt/translations.json +109 -0
- package/admin/i18n/ru/translations.json +109 -0
- package/admin/i18n/zh-cn/translations.json +109 -0
- package/admin/index_m.js +207 -3
- package/admin/style.css +76 -8
- package/admin/tsconfig.json +45 -0
- package/io-package.json +44 -31
- package/lib/boolean-value.js +30 -0
- package/lib/constants.js +299 -65
- package/lib/cron-schedule.js +59 -0
- package/lib/helper.js +380 -373
- package/lib/midnight-reschedule.js +31 -0
- package/lib/motion-zone-timer.js +55 -0
- package/lib/num-comparator.js +70 -0
- package/lib/tools.js +12 -6
- package/lib/trigger-class.js +527 -282
- package/main.js +954 -626
- package/package.json +48 -32
- package/.github/ISSUE_TEMPLATE/BugReport.md +0 -36
- package/.github/ISSUE_TEMPLATE/Enhancement.md +0 -19
- package/.github/auto-merge.yml +0 -17
- package/.github/dependabot.yml +0 -12
- package/.github/workflows/dependabot-auto-merge.yml +0 -23
- package/.github/workflows/test-and-release.yml +0 -99
- package/.releaseconfig.json +0 -3
- package/main.test.js +0 -30
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.smartcontrol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Control devices smarter: by grouping, including triggers like motion, opening window, etc. and set target devices accordingly",
|
|
5
|
-
"author":
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
5
|
+
"author": "Mic-M <iob.micm@gmail.com>",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"iobroker-community-adapters <iobroker-community-adapters@gmx.de>"
|
|
8
|
+
],
|
|
9
9
|
"homepage": "https://github.com/iobroker-community-adapters/ioBroker.smartcontrol",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"keywords": [
|
|
12
|
+
"ioBroker",
|
|
12
13
|
"smart",
|
|
13
14
|
"control",
|
|
14
15
|
"rooms",
|
|
@@ -24,46 +25,61 @@
|
|
|
24
25
|
"type": "git",
|
|
25
26
|
"url": "https://github.com/iobroker-community-adapters/ioBroker.smartcontrol"
|
|
26
27
|
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.19.0"
|
|
30
|
+
},
|
|
27
31
|
"dependencies": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"node-schedule": "^2.1.0",
|
|
32
|
+
"@iobroker/adapter-core": "^3.4.3",
|
|
33
|
+
"axios": "^1.6.8",
|
|
34
|
+
"cron-parser": "^4.8.1",
|
|
35
|
+
"node-schedule": "^2.1.1",
|
|
33
36
|
"suncalc2": "^1.8.1"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"@alcalzone/release-script": "^
|
|
37
|
-
"@alcalzone/release-script-plugin-iobroker": "^
|
|
38
|
-
"@alcalzone/release-script-plugin-license": "^
|
|
39
|
-
"@alcalzone/release-script-plugin-manual-review": "^
|
|
40
|
-
"@iobroker/
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
43
|
-
"@types/
|
|
44
|
-
"@types/
|
|
45
|
-
"@types/
|
|
46
|
-
"@types/
|
|
47
|
-
"@types/
|
|
48
|
-
"@types/
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
39
|
+
"@alcalzone/release-script": "^5.2.1",
|
|
40
|
+
"@alcalzone/release-script-plugin-iobroker": "^5.2.0",
|
|
41
|
+
"@alcalzone/release-script-plugin-license": "^5.2.2",
|
|
42
|
+
"@alcalzone/release-script-plugin-manual-review": "^5.2.0",
|
|
43
|
+
"@iobroker/eslint-config": "^2.3.4",
|
|
44
|
+
"@iobroker/testing": "^6.3.4",
|
|
45
|
+
"@tsconfig/node22": "^22.0.7",
|
|
46
|
+
"@types/chai": "^4.3.11",
|
|
47
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
48
|
+
"@types/gulp": "^4.0.17",
|
|
49
|
+
"@types/jquery": "^3.5.32",
|
|
50
|
+
"@types/mocha": "^10.0.6",
|
|
51
|
+
"@types/node": "^20.14.9",
|
|
52
|
+
"@types/proxyquire": "^1.3.31",
|
|
53
|
+
"@types/sinon": "^10.0.16",
|
|
54
|
+
"@types/sinon-chai": "^3.2.12",
|
|
55
|
+
"chai": "^4.5.0",
|
|
56
|
+
"chai-as-promised": "^7.1.2",
|
|
52
57
|
"gulp": "^4.0.2",
|
|
53
|
-
"mocha": "^
|
|
58
|
+
"mocha": "^12.0.3",
|
|
54
59
|
"proxyquire": "^2.1.3",
|
|
55
|
-
"sinon": "^
|
|
60
|
+
"sinon": "^15.2.0",
|
|
56
61
|
"sinon-chai": "^3.7.0"
|
|
57
62
|
},
|
|
58
63
|
"main": "main.js",
|
|
64
|
+
"files": [
|
|
65
|
+
"admin/",
|
|
66
|
+
"lib/",
|
|
67
|
+
"main.js",
|
|
68
|
+
"io-package.json",
|
|
69
|
+
"LICENSE"
|
|
70
|
+
],
|
|
59
71
|
"scripts": {
|
|
60
|
-
"test:js": "mocha --
|
|
72
|
+
"test:js": "mocha --config test/mocharc.custom.json \"{!(node_modules|test)/**/*.test.js,*.test.js,test/**/test!(PackageFiles|Startup).js}\"",
|
|
61
73
|
"test:package": "mocha test/package --exit",
|
|
62
|
-
"test:unit": "
|
|
74
|
+
"test:unit": "npm run test:js",
|
|
63
75
|
"test:integration": "mocha test/integration --exit",
|
|
64
76
|
"test": "npm run test:js && npm run test:package",
|
|
65
|
-
"lint": "eslint",
|
|
66
|
-
"release": "release-script"
|
|
77
|
+
"lint": "eslint -c eslint.config.mjs .",
|
|
78
|
+
"release": "release-script",
|
|
79
|
+
"release-patch": "release-script patch --yes --no-update-lockfile",
|
|
80
|
+
"release-minor": "release-script minor --yes --no-update-lockfile",
|
|
81
|
+
"release-major": "release-script major --yes --no-update-lockfile",
|
|
82
|
+
"update-packages": "ncu --upgrade && cd src && ncu --upgrade && cd .."
|
|
67
83
|
},
|
|
68
84
|
"bugs": {
|
|
69
85
|
"url": "https://github.com/iobroker-community-adapters/ioBroker.smartcontrol/issues"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Something is not working as it should
|
|
4
|
-
title: ''
|
|
5
|
-
labels: 'bug'
|
|
6
|
-
assignees: 'Mic-M'
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
**!!! Before you start !!!**
|
|
10
|
-
1. Verify if there is not already an issue requesting the same
|
|
11
|
-
2. Is this really a bug of current code or an enhancement (feature) request ?
|
|
12
|
-
|
|
13
|
-
**Describe the bug**
|
|
14
|
-
A clear and concise description of what the bug is.
|
|
15
|
-
|
|
16
|
-
**To Reproduce**
|
|
17
|
-
Steps to reproduce the behavior:
|
|
18
|
-
1. Go to '...'
|
|
19
|
-
2. Click on '...'
|
|
20
|
-
3. Scroll down to '....'
|
|
21
|
-
4. See error
|
|
22
|
-
|
|
23
|
-
**Expected behavior**
|
|
24
|
-
A clear and concise description of what you expected to happen.
|
|
25
|
-
|
|
26
|
-
**Screenshots & Log files**
|
|
27
|
-
If applicable, add screenshots and log files to help explain your problem.
|
|
28
|
-
|
|
29
|
-
**Versions:**
|
|
30
|
-
- Adapter version: <adapter-version>
|
|
31
|
-
- JS-Controller version: <js-controller-version> <!-- determine this with `iobroker -v` on the console -->
|
|
32
|
-
- Node version: <node-version> <!-- determine this with `node -v` on the console -->
|
|
33
|
-
- Operating system: <os-name>
|
|
34
|
-
|
|
35
|
-
**Additional context**
|
|
36
|
-
Add any other context about the problem here.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Enhancement Request
|
|
3
|
-
about: Request new functionality
|
|
4
|
-
title: ''
|
|
5
|
-
labels: 'enhancement'
|
|
6
|
-
assignees: 'Mic-M'
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
**!!! Before you start !!!!**
|
|
10
|
-
Verify if there is not already an issue requesting the same Enhancement.
|
|
11
|
-
|
|
12
|
-
**Describe desired Enhancement !**
|
|
13
|
-
A clear description of the desired functionality
|
|
14
|
-
|
|
15
|
-
**Why should we put effort in it ?**
|
|
16
|
-
Please add some additional information why this Enhancement should be integrated
|
|
17
|
-
|
|
18
|
-
**Additional context**
|
|
19
|
-
Add any other context about the request here.
|
package/.github/auto-merge.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Configure here which dependency updates should be merged automatically.
|
|
2
|
-
# The recommended configuration is the following:
|
|
3
|
-
- match:
|
|
4
|
-
# Only merge patches for production dependencies
|
|
5
|
-
dependency_type: production
|
|
6
|
-
update_type: "semver:patch"
|
|
7
|
-
- match:
|
|
8
|
-
# Except for security fixes, here we allow minor patches
|
|
9
|
-
dependency_type: production
|
|
10
|
-
update_type: "security:minor"
|
|
11
|
-
- match:
|
|
12
|
-
# and development dependencies can have a minor update, too
|
|
13
|
-
dependency_type: development
|
|
14
|
-
update_type: "semver:minor"
|
|
15
|
-
|
|
16
|
-
# The syntax is based on the legacy dependabot v1 automerged_updates syntax, see:
|
|
17
|
-
# https://dependabot.com/docs/config-file/#automerged_updates
|
package/.github/dependabot.yml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Automatically merge Dependabot PRs when version comparison is within the range
|
|
2
|
-
# that is configured in .github/auto-merge.yml
|
|
3
|
-
|
|
4
|
-
name: Auto-Merge Dependabot PRs
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
auto-merge:
|
|
11
|
-
if: github.actor == 'dependabot[bot]'
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout code
|
|
15
|
-
uses: actions/checkout@v2
|
|
16
|
-
|
|
17
|
-
- name: Check if PR should be auto-merged
|
|
18
|
-
uses: ahmadnassri/action-dependabot-auto-merge@v2
|
|
19
|
-
with:
|
|
20
|
-
# This must be a personal access token with push access
|
|
21
|
-
github-token: ${{ secrets.AUTO_MERGE_TOKEN }}
|
|
22
|
-
# By default, squash and merge, so Github chooses nice commit messages
|
|
23
|
-
command: squash and merge
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
name: Test and Release
|
|
2
|
-
|
|
3
|
-
# Run this job on all pushes and pull requests
|
|
4
|
-
# as well as tags with a semantic version
|
|
5
|
-
on:
|
|
6
|
-
push:
|
|
7
|
-
branches:
|
|
8
|
-
- "main"
|
|
9
|
-
tags:
|
|
10
|
-
# normal versions
|
|
11
|
-
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
12
|
-
# pre-releases
|
|
13
|
-
- "v[0-9]+.[0-9]+.[0-9]+-**"
|
|
14
|
-
pull_request: {}
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
# Performs quick checks before the expensive test runs
|
|
18
|
-
check-and-lint:
|
|
19
|
-
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
20
|
-
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
|
|
23
|
-
strategy:
|
|
24
|
-
matrix:
|
|
25
|
-
node-version: [16.x]
|
|
26
|
-
|
|
27
|
-
steps:
|
|
28
|
-
- name: Checkout code
|
|
29
|
-
uses: actions/checkout@v3
|
|
30
|
-
|
|
31
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
32
|
-
uses: actions/setup-node@v3
|
|
33
|
-
with:
|
|
34
|
-
node-version: ${{ matrix.node-version }}
|
|
35
|
-
|
|
36
|
-
- name: Install Dependencies
|
|
37
|
-
run: npm ci
|
|
38
|
-
|
|
39
|
-
- name: Lint source code
|
|
40
|
-
run: npm run lint
|
|
41
|
-
- name: Test package files
|
|
42
|
-
run: npm run test:package
|
|
43
|
-
|
|
44
|
-
# Runs adapter tests on all supported node versions and OSes
|
|
45
|
-
adapter-tests:
|
|
46
|
-
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
47
|
-
|
|
48
|
-
needs: [check-and-lint]
|
|
49
|
-
|
|
50
|
-
runs-on: ${{ matrix.os }}
|
|
51
|
-
strategy:
|
|
52
|
-
matrix:
|
|
53
|
-
node-version: [14.x, 16.x]
|
|
54
|
-
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
55
|
-
|
|
56
|
-
steps:
|
|
57
|
-
- name: Checkout code
|
|
58
|
-
uses: actions/checkout@v3
|
|
59
|
-
|
|
60
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
61
|
-
uses: actions/setup-node@v3
|
|
62
|
-
with:
|
|
63
|
-
node-version: ${{ matrix.node-version }}
|
|
64
|
-
|
|
65
|
-
- name: Install Dependencies
|
|
66
|
-
run: npm ci
|
|
67
|
-
|
|
68
|
-
- name: Run unit tests
|
|
69
|
-
run: npm run test:unit
|
|
70
|
-
|
|
71
|
-
- name: Run integration tests (unix only)
|
|
72
|
-
if: startsWith(runner.OS, 'windows') == false
|
|
73
|
-
run: DEBUG=testing:* npm run test:integration
|
|
74
|
-
|
|
75
|
-
- name: Run integration tests (windows only)
|
|
76
|
-
if: startsWith(runner.OS, 'windows')
|
|
77
|
-
run: set DEBUG=testing:* & npm run test:integration
|
|
78
|
-
|
|
79
|
-
# Deploys the final package to NPM
|
|
80
|
-
deploy:
|
|
81
|
-
needs: [check-and-lint, adapter-tests]
|
|
82
|
-
|
|
83
|
-
# Trigger this step only when a commit on any branch is tagged with a version number
|
|
84
|
-
if: |
|
|
85
|
-
contains(github.event.head_commit.message, '[skip ci]') == false &&
|
|
86
|
-
github.event_name == 'push' &&
|
|
87
|
-
startsWith(github.ref, 'refs/tags/v')
|
|
88
|
-
|
|
89
|
-
runs-on: ubuntu-latest
|
|
90
|
-
|
|
91
|
-
steps:
|
|
92
|
-
- uses: ioBroker/testing-action-deploy@v1
|
|
93
|
-
with:
|
|
94
|
-
node-version: '16.x'
|
|
95
|
-
# Uncomment the following line if your adapter cannot be installed using 'npm ci'
|
|
96
|
-
# install-command: 'npm install'
|
|
97
|
-
build: false
|
|
98
|
-
npm-token: ${{ secrets.NPM_TOKEN }}
|
|
99
|
-
github-token: ${{ secrets.GITHUB_TOKEN }}
|
package/.releaseconfig.json
DELETED
package/main.test.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is a dummy TypeScript test file using chai and mocha
|
|
5
|
-
*
|
|
6
|
-
* It's automatically excluded from npm and its build output is excluded from both git and npm.
|
|
7
|
-
* It is advised to test all your modules with accompanying *.test.js-files
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// tslint:disable:no-unused-expression
|
|
11
|
-
|
|
12
|
-
const { expect } = require('chai');
|
|
13
|
-
// import { functionToTest } from "./moduleToTest";
|
|
14
|
-
|
|
15
|
-
describe('module to test => function to test', () => {
|
|
16
|
-
// initializing logic
|
|
17
|
-
const expected = 5;
|
|
18
|
-
|
|
19
|
-
it(`should return ${expected}`, () => {
|
|
20
|
-
const result = 5;
|
|
21
|
-
// assign result a value from functionToTest
|
|
22
|
-
expect(result).to.equal(expected);
|
|
23
|
-
// or using the should() syntax
|
|
24
|
-
result.should.equal(expected);
|
|
25
|
-
});
|
|
26
|
-
// ... more tests => it
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// ... more test suites => describe
|