Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dutchman
committed
Aug 14, 2019
0 parents
commit 2034c98
Showing
30 changed files
with
6,839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
"tab", | ||
{ | ||
"SwitchCase": 1 | ||
} | ||
], | ||
"no-console": "off", | ||
"no-var": "error", | ||
"prefer-const": "error", | ||
"quotes": [ | ||
"error", | ||
"single", | ||
{ | ||
"avoidEscape": true, | ||
"allowTemplateLiterals": true | ||
} | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 2018 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: Bug report | ||
about: Something is not working as it should | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '...' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots & Logfiles** | ||
If applicable, add screenshots and logfiles to help explain your problem. | ||
|
||
**Versions:** | ||
- Adapter version: <adapter-version> | ||
- JS-Controller version: <js-controller-version> <!-- determine this with `iobroker -v` on the console --> | ||
- Node version: <node-version> <!-- determine this with `node -v` on the console --> | ||
- Operating system: <os-name> | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.git | ||
.idea | ||
node_modules | ||
nbproject | ||
|
||
# npm package files | ||
iobroker.*.tgz | ||
|
||
Thumbs.db | ||
|
||
# i18n intermediate files | ||
admin/i18n/flat.txt | ||
admin/i18n/*/flat.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.git | ||
.idea | ||
node_modules/ | ||
nbproject/ | ||
.vs*/ | ||
Thumbs.db | ||
gulpfile.js | ||
|
||
test/ | ||
travis/ | ||
.travis.yml | ||
appveyor.yml | ||
.travis.yaml | ||
appveyor.yaml | ||
|
||
.eslintrc.json | ||
.eslintrc.js | ||
|
||
# npm package files | ||
iobroker.*.tgz | ||
package-lock.json | ||
|
||
# i18n intermediate files | ||
admin/i18n | ||
|
||
# maintenance scripts | ||
maintenance/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
os: | ||
- linux | ||
- osx | ||
- windows | ||
|
||
language: node_js | ||
node_js: | ||
- '8' | ||
- '10' | ||
|
||
env: | ||
- CXX=g++-4.8 | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.9 | ||
|
||
before_install: | ||
- 'if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then CC=gcc-4.9; fi' | ||
- 'if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then CC=g++-4.9; fi' | ||
before_script: | ||
- export NPMVERSION=$(echo "$($(which npm) -v)"|cut -c1) | ||
- 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm; fi' | ||
- npm -v | ||
script: | ||
- npm run test:package | ||
- npm run test:unit | ||
- export DEBUG=testing:* | ||
- npm run test:integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"eslint.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 DutchmanNL <rdrozda86@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
![Logo](admin/wlanthermo-nano.png) | ||
# ioBroker.wlanthermo-nano | ||
|
||
[![NPM version](http://img.shields.io/npm/v/iobroker.wlanthermo-nano.svg)](https://www.npmjs.com/package/iobroker.wlanthermo-nano) | ||
[![Downloads](https://img.shields.io/npm/dm/iobroker.wlanthermo-nano.svg)](https://www.npmjs.com/package/iobroker.wlanthermo-nano) | ||
[![Dependency Status](https://img.shields.io/david/iobroker-community-adapters/iobroker.wlanthermo-nano.svg)](https://david-dm.org/iobroker-community-adapters/iobroker.wlanthermo-nano) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/iobroker-community-adapters/ioBroker.wlanthermo-nano/badge.svg)](https://snyk.io/test/github/iobroker-community-adapters/ioBroker.wlanthermo-nano) | ||
|
||
[![NPM](https://nodei.co/npm/iobroker.wlanthermo-nano.png?downloads=true)](https://nodei.co/npm/iobroker.wlanthermo-nano/) | ||
|
||
**Tests:**: [![Travis-CI](http://img.shields.io/travis/iobroker-community-adapters/ioBroker.wlanthermo-nano/master.svg)](https://travis-ci.org/iobroker-community-adapters/ioBroker.wlanthermo-nano) | ||
|
||
## wlanthermo-nano adapter for ioBroker | ||
|
||
WLANThermo Nano, the digital advantage for your barbecue sport | ||
|
||
## Developer manual | ||
This section is intended for the developer. It can be deleted later | ||
|
||
### Getting started | ||
|
||
You are almost done, only a few steps left: | ||
1. Create a new repository on GitHub with the name `ioBroker.wlanthermo-nano` | ||
|
||
1. Push all files to the GitHub repo. The creator has already set up the local repository for you: | ||
```bash | ||
git push origin master | ||
``` | ||
1. Head over to [main.js](main.js) and start programming! | ||
|
||
### Scripts in `package.json` | ||
Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>` | ||
| Script name | Description | | ||
|-------------|----------------------------------------------------------| | ||
| `test:js` | Executes the tests you defined in `*.test.js` files. | | ||
| `test:package` | Ensures your `package.json` and `io-package.json` are valid. | | ||
| `test` | Performs a minimal test run on package files and your tests. | | ||
| `coverage` | Generates code coverage using your test files. | | ||
|
||
### Writing tests | ||
When done right, testing code is invaluable, because it gives you the | ||
confidence to change your code while knowing exactly if and when | ||
something breaks. A good read on the topic of test-driven development | ||
is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92. | ||
Although writing tests before the code might seem strange at first, but it has very | ||
clear upsides. | ||
|
||
The template provides you with basic tests for the adapter startup and package files. | ||
It is recommended that you add your own tests into the mix. | ||
|
||
### Publishing the adapter | ||
See the documentation of [ioBroker.repositories](https://github.com/ioBroker/ioBroker.repositories#requirements-for-adapter-to-get-added-to-the-latest-repository). | ||
|
||
### Test the adapter manually on a local ioBroker installation | ||
In order to install the adapter locally without publishing, the following steps are recommended: | ||
1. Create a tarball from your dev directory: | ||
```bash | ||
npm pack | ||
``` | ||
1. Upload the resulting file to your ioBroker host | ||
1. Install it locally (The paths are different on Windows): | ||
```bash | ||
cd /opt/iobroker | ||
npm i /path/to/tarball.tgz | ||
``` | ||
|
||
For later updates, the above procedure is not necessary. Just do the following: | ||
1. Overwrite the changed files in the adapter directory (`/opt/iobroker/node_modules/iobroker.wlanthermo-nano`) | ||
1. Execute `iobroker upload wlanthermo-nano` on the ioBroker host | ||
|
||
## Changelog | ||
|
||
### 0.0.1 | ||
* (DutchmanNL) initial release | ||
|
||
## License | ||
MIT License | ||
|
||
Copyright (c) 2019 DutchmanNL <rdrozda86@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare let systemDictionary: Record<string, Record<string, string>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<html> | ||
|
||
<head> | ||
|
||
<!-- Load ioBroker scripts and styles--> | ||
<link rel="stylesheet" type="text/css" href="../../css/adapter.css" /> | ||
<link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css"> | ||
|
||
<script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script> | ||
<script type="text/javascript" src="../../socket.io/socket.io.js"></script> | ||
|
||
<script type="text/javascript" src="../../js/translate.js"></script> | ||
<script type="text/javascript" src="../../lib/js/materialize.js"></script> | ||
<script type="text/javascript" src="../../js/adapter-settings.js"></script> | ||
|
||
<!-- Load our own files --> | ||
<link rel="stylesheet" type="text/css" href="style.css" /> | ||
<script type="text/javascript" src="words.js"></script> | ||
|
||
<script type="text/javascript"> | ||
// This will be called by the admin adapter when the settings page loads | ||
function load(settings, onChange) { | ||
// example: select elements with id=key and class=value and insert value | ||
if (!settings) return; | ||
$('.value').each(function () { | ||
var $key = $(this); | ||
var id = $key.attr('id'); | ||
if ($key.attr('type') === 'checkbox') { | ||
// do not call onChange direct, because onChange could expect some arguments | ||
$key.prop('checked', settings[id]) | ||
.on('change', () => onChange()) | ||
; | ||
} else { | ||
// do not call onChange direct, because onChange could expect some arguments | ||
$key.val(settings[id]) | ||
.on('change', () => onChange()) | ||
.on('keyup', () => onChange()) | ||
; | ||
} | ||
}); | ||
onChange(false); | ||
// reinitialize all the Materialize labels on the page if you are dynamically adding inputs: | ||
if (M) M.updateTextFields(); | ||
} | ||
|
||
// This will be called by the admin adapter when the user presses the save button | ||
function save(callback) { | ||
// example: select elements with class=value and build settings object | ||
var obj = {}; | ||
$('.value').each(function () { | ||
var $this = $(this); | ||
if ($this.attr('type') === 'checkbox') { | ||
obj[$this.attr('id')] = $this.prop('checked'); | ||
} else { | ||
obj[$this.attr('id')] = $this.val(); | ||
} | ||
}); | ||
callback(obj); | ||
} | ||
</script> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<div class="m adapter-container"> | ||
|
||
<div class="row"> | ||
<div class="col s12 m4 l2"> | ||
<img src="wlanthermo-nano.png" class="logo"> | ||
</div> | ||
</div> | ||
|
||
<!-- Put your content here --> | ||
|
||
<!-- For example columns with settings: --> | ||
<div class="row"> | ||
<div class="col s6 input-field"> | ||
<input type="checkbox" class="value" id="option1" /> | ||
<label for="option1" class="translate">option1</label> | ||
</div> | ||
|
||
<div class="col s6 input-field"> | ||
<input type="text" class="value" id="option2" /> | ||
<label for="option2" class="translate">option2</label> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* You can delete those if you want. I just found them very helpful */ | ||
* { | ||
box-sizing: border-box | ||
} | ||
.m { | ||
/* Don't cut off dropdowns! */ | ||
overflow: initial; | ||
} | ||
|
||
/* Add your styles here */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": [ | ||
"./**/*.d.ts", | ||
"./**/*.js" | ||
] | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.