Skip to content

Commit 7a96938

Browse files
authored
Merge pull request #37 from walli545/dev
Release 2.0.0
2 parents 62f464c + 3feb959 commit 7a96938

File tree

119 files changed

+6369
-2437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+6369
-2437
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ module.exports = {
4242
'@typescript-eslint/no-non-null-assertion': 'off', // This is necessary for Map.has()/get()!
4343
'no-var': 'error',
4444
'prefer-const': 'error',
45+
"prettier/prettier": ["error", {
46+
"endOfLine":"auto"
47+
}],
4548
},
4649
overrides: [
4750
{

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ coverage
1717

1818
# i18n intermediate files
1919
admin/i18n/flat.txt
20-
admin/i18n/*/flat.txt
20+
admin/i18n/*/flat.txt
21+
22+
# Upload scripts to dev env
23+
go_dev.sh
24+
go_dev_docker.sh

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ os:
55

66
language: node_js
77
node_js:
8-
- '8'
8+
- 'node'
99
- '10'
1010
- '12'
1111

@@ -26,8 +26,11 @@ before_script:
2626
- 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm; fi'
2727
- npm -v
2828
script:
29+
- npm run lint
2930
- npm run test:package
31+
- nyc --reporter=lcov npm run test:ts
3032
- npm run test:unit
31-
- npm run test:ts
3233
- export DEBUG=testing:*
3334
- npm run test:integration
35+
36+
after_success: codecov

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 walli545 <walli5446@gmail.com>
3+
Copyright (c) 2020 walli545 <walli5446@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,47 @@
55
[![Downloads](https://img.shields.io/npm/dm/iobroker.time-switch.svg)](https://www.npmjs.com/package/iobroker.time-switch)
66
[![Dependency Status](https://img.shields.io/david/walli545/iobroker.time-switch.svg)](https://david-dm.org/walli545/iobroker.time-switch)
77
[![Known Vulnerabilities](https://snyk.io/test/github/walli545/ioBroker.time-switch/badge.svg)](https://snyk.io/test/github/walli545/ioBroker.time-switch)
8+
[![Travis-CI](http://img.shields.io/travis/walli545/ioBroker.time-switch/master.svg)](https://travis-ci.org/walli545/ioBroker.time-switch)
9+
[![codecov](https://codecov.io/gh/walli545/ioBroker.time-switch/branch/master/graph/badge.svg)](https://codecov.io/gh/walli545/ioBroker.time-switch)
810

911
[![NPM](https://nodei.co/npm/iobroker.time-switch.png?downloads=true)](https://nodei.co/npm/iobroker.time-switch/)
1012

11-
**Tests:**: [![Travis-CI](http://img.shields.io/travis/walli545/ioBroker.time-switch/master.svg)](https://travis-ci.org/walli545/ioBroker.time-switch)
1213

1314
## time-switch adapter for ioBroker
1415

1516
This adapter allows the user to switch devices on and off using time schedules.
1617
The schedules can be fully configured by a vis widget.
17-
One schedule switches one ioBroker state and consists of one or more actions that define when and how the state should be switched.
18-
It is possible to configure at which time and on which weekdays the action should be triggered. There can be custom on/off values also.
18+
One schedule switches one or more ioBroker states and consists of one or more triggers that define when and how the state should be switched.
19+
It is possible to configure at which time and on which weekdays the trigger should be triggered. There can be custom on/off values also.
1920
In the widget the schedule can be disabled temporarily and the switched state can be controlled manually.
2021

2122
![Preview](widgets/time-switch/img/prev/prev-device-schedule.jpg)
2223

23-
## How to setup a schedule
24+
## Setup
2425

25-
1. Install the adapter and create an instance (one instance can handle many schedules)
26-
2. Go to the instance settings and click "Add schedule" to create a new schedule (one schedule can switch one ioBroker state).
27-
28-
Keep the schedule OID of the newly created schedule in mind, we will need that later.
29-
3. Now go to the vis editor and open the view where the schedule should be visible.
30-
Create a new "Device-Schedule" widget and adjust it's size and position to fit your layout.
31-
4. Now configure the widget with the following properties found under the "Common" attributes:
32-
33-
- dataId: Open the select OID dialog and select the schedule OID that you remembered earlier. It can be found under "time-switch.0".
34-
- stateId: Select the OID of the state that should be switched by the schedule, e.g. on/off status of a wall plug.
35-
- onValue/offValue: Enter the values that represent the devices on/off state, e.g. 0/1, true/false, ON/OFF, ... .
36-
5. Everything else can be configured in the view part of the widget.
37-
38-
- Enable/Disable automatic switching
39-
- Change the current value of the state
40-
- Add/Delete/Edit actions
41-
- Change the heading of the schedule plan
26+
For setup instructions visit the [wiki](https://github.com/walli545/ioBroker.time-switch/wiki) (German instructions available also).
4227

4328
## Possible features in the future
4429

4530
- Translations for schedule widget
4631
- Astro actions (switch on sunrise, etc.)
4732
- Conditional actions
48-
- Switching for device groups
4933
- Switching of arbitrary values
5034

5135
## Changelog
5236

37+
### 2.0.0
38+
**Attention**: Due to breaking changes in the schedule data structure, schedules created with versions 1.x are not compatible with 2.x.
39+
40+
*Before upgrading, remove all schedules in the instance settings and remove widgets in vis.*
41+
* (walli545)
42+
* Value type can now be configured, this enables switching of real booleans and numbers (#19)
43+
* Added a new state for each schedule to disable/enable automatic switching (#24)
44+
* Added option to hide current value switch in widget (#23)
45+
* Switching of multiple states with one schedule. This allows the creation of groups for devices of the same type.
46+
* Added translations to widget (#35)
47+
* Fixed widget not working on Safari and fully browser
48+
5349
### 1.1.0
5450
* (walli545)
5551
* New option to hide switched oid in widget (#20)
@@ -65,7 +61,7 @@ In the widget the schedule can be disabled temporarily and the switched state ca
6561
## License
6662
MIT License
6763

68-
Copyright (c) 2019 walli545 <walli5446@gmail.com>
64+
Copyright (c) 2020 walli545 <walli5446@gmail.com>
6965

7066
Permission is hereby granted, free of charge, to any person obtaining a copy
7167
of this software and associated documentation files (the "Software"), to deal

admin/i18n/de/translations.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"Add On/Off schedule": "An/Aus Schaltplan hinzufügen",
3+
"Friday": "Freitag",
4+
"Monday": "Montag",
5+
"Saturday": "Samstag",
6+
"Sunday": "Sonntag",
7+
"Thursday": "Donnerstag",
8+
"Tuesday": "Dienstag",
9+
"Wednesday": "Mittwoch",
10+
"addTrigger": "Auslöser hinzufügen",
11+
"allOff": "Alle aus",
12+
"allOn": "Alle an",
13+
"automaticSwitchingEnabled": "Automatisches Schalten aktiviert",
14+
"boolean": "Wahrheitswert",
15+
"cancelEdit": "Bearbeiten abbrechen",
16+
"currentValue": "Aktueller Wert",
17+
"dataId": "Id für Schaltplandaten",
18+
"editName": "Namen bearbeiten",
19+
"editTrigger": "Auslöser bearbeiten",
20+
"enabled": "Aktiv",
21+
"false": "nein",
22+
"manualSwitching": "Manuelles Schalten",
23+
"name": "Name",
24+
"needToEnterValidNumberOff": "Geben Sie eine gültige Zahl als Aus-Wert ein, wenn Typ Zahl ist!",
25+
"needToEnterValidNumberOn": "Geben Sie eine gültige Zahl für den An-Wert ein, wenn Typ Zahl ist!",
26+
"needToEnterValidStringValue": "Ein-/Aus-Wert darf nicht leer sein, wenn der Typ Zeichenfolge ist!",
27+
"needToSelectDataId": "Wählen Sie eine Schaltplandaten Id aus, um das Widget zu verwenden!",
28+
"needToSelectStateId": "Wählen Sie mindestens eine geschaltete State Id aus, um das Widget zu verwenden!",
29+
"needToSelectValidDataId": "Wählen Sie eine gültige Schaltplandaten Id (mit dem Muster 'time-switch.0.onoff.*.data')!",
30+
"number": "Zahl",
31+
"off": "aus",
32+
"offValue": "Wert für aus",
33+
"on": "an",
34+
"onValue": "Wert für an",
35+
"removeSchedule": "Zeitplan entfernen",
36+
"removeTrigger": "Auslöser entfernen",
37+
"saveChanges": "Änderungen speichern",
38+
"saveName": "Name speichern",
39+
"scheduleId": "Schaltplandaten Id",
40+
"showId": "Anzeigen des geschaltenen States",
41+
"showManualSwitch": "Anzeigen der manuellen Schalter",
42+
"stateId": "Id vom geschaltenen State",
43+
"statesCount": "Anzahl geschaltener States",
44+
"string": "Zeichenkette",
45+
"switchedType": "Geschaltener Datentyp",
46+
"switchedValue": "Geschalteter Wert",
47+
"time-switch adapter settings": "Adaptereinstellungen für time-switch",
48+
"trigger": "Auslöser",
49+
"trigger count": "Anzahl Auslöser",
50+
"true": "ja",
51+
"valueType": "Werttyp"
52+
}

admin/i18n/en/translations.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"Add On/Off schedule": "Add On/Off schedule",
3+
"Friday": "Friday",
4+
"Monday": "Monday",
5+
"Saturday": "Saturday",
6+
"Sunday": "Sunday",
7+
"Thursday": "Thursday",
8+
"Tuesday": "Tuesday",
9+
"Wednesday": "Wednesday",
10+
"addTrigger": "Add trigger",
11+
"allOff": "All off",
12+
"allOn": "All on",
13+
"automaticSwitchingEnabled": "Automatic switching enabled",
14+
"boolean": "boolean",
15+
"cancelEdit": "Cancel edit",
16+
"currentValue": "Current value",
17+
"dataId": "Schedule data id",
18+
"editName": "Edit name",
19+
"editTrigger": "Edit trigger",
20+
"enabled": "Enabled",
21+
"false": "false",
22+
"manualSwitching": "Manual switching",
23+
"name": "Name",
24+
"needToEnterValidNumberOff": "Enter a valid number for switched off value when type is number!",
25+
"needToEnterValidNumberOn": "Enter a valid number for switched on value when type is number!",
26+
"needToEnterValidStringValue": "On/Offvalue cannot be empty when type is string!",
27+
"needToSelectDataId": "Select a schedule data id to use the widget!",
28+
"needToSelectStateId": "Select at least one switched state id to use the widget!",
29+
"needToSelectValidDataId": "Select a valid schedule data id (with pattern 'time-switch.0.onoff.*.data')!",
30+
"number": "number",
31+
"off": "Off",
32+
"offValue": "Value for off",
33+
"on": "On",
34+
"onValue": "Value for on",
35+
"removeSchedule": "Remove schedule",
36+
"removeTrigger": "Remove trigger",
37+
"saveChanges": "Save changes",
38+
"saveName": "Save name",
39+
"scheduleId": "Schedule data id",
40+
"showId": "Show switched state id",
41+
"showManualSwitch": "Show manual switch",
42+
"stateId": "Switched state id",
43+
"statesCount": "Count of switched states",
44+
"string": "string",
45+
"switchedType": "Switched type",
46+
"switchedValue": "Switched value",
47+
"time-switch adapter settings": "Adapter settings for time-switch",
48+
"trigger": "Trigger",
49+
"trigger count": "Trigger count",
50+
"true": "true",
51+
"valueType": "Value type"
52+
}

admin/i18n/es/translations.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"Add On/Off schedule": "Agregar horario de encendido / apagado",
3+
"Friday": "viernes",
4+
"Monday": "lunes",
5+
"Saturday": "sábado",
6+
"Sunday": "domingo",
7+
"Thursday": "jueves",
8+
"Tuesday": "martes",
9+
"Wednesday": "miércoles",
10+
"addTrigger": "Agregar disparador",
11+
"allOff": "Todo apagado",
12+
"allOn": "Todo en",
13+
"automaticSwitchingEnabled": "Conmutación automática habilitada",
14+
"boolean": "booleano",
15+
"cancelEdit": "Cancelar edición",
16+
"currentValue": "Valor actual",
17+
"dataId": "Programar ID de datos",
18+
"editName": "Editar nombre",
19+
"editTrigger": "Editar disparador",
20+
"enabled": "Habilitado",
21+
"false": "falso",
22+
"manualSwitching": "Cambio manual",
23+
"name": "Nombre",
24+
"needToEnterValidNumberOff": "¡Ingrese un número válido para el valor apagado cuando type es number!",
25+
"needToEnterValidNumberOn": "¡Ingrese un número válido para el valor activado cuando type es number!",
26+
"needToEnterValidStringValue": "On / Offvalue no puede estar vacío cuando type es string",
27+
"needToSelectDataId": "¡Seleccione una identificación de datos de programación para usar el widget!",
28+
"needToSelectStateId": "¡Seleccione al menos un ID de estado cambiado para usar el widget!",
29+
"needToSelectValidDataId": "¡Seleccione una identificación de datos de programación válida (con el patrón 'time-switch.0.onoff. *. Data')!",
30+
"number": "número",
31+
"off": "Apagado",
32+
"offValue": "Valor para apagado",
33+
"on": "En",
34+
"onValue": "Valor para en",
35+
"removeSchedule": "Eliminar horario",
36+
"removeTrigger": "Eliminar gatillo",
37+
"saveChanges": "Guardar cambios",
38+
"saveName": "Guardar nombre",
39+
"scheduleId": "Programar ID de datos",
40+
"showId": "Mostrar ID de estado cambiado",
41+
"showManualSwitch": "Mostrar interruptor manual",
42+
"stateId": "ID de estado conmutado",
43+
"statesCount": "Conteo de estados conmutados",
44+
"string": "cuerda",
45+
"switchedType": "Tipo conmutado",
46+
"switchedValue": "Valor conmutado",
47+
"time-switch adapter settings": "Ajustes del adaptador para time-switch",
48+
"trigger": "Desencadenar",
49+
"trigger count": "Recuento de disparadores",
50+
"true": "cierto",
51+
"valueType": "Tipo de valor"
52+
}

admin/i18n/fr/translations.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"Add On/Off schedule": "Ajouter un programme On / Off",
3+
"Friday": "Vendredi",
4+
"Monday": "Lundi",
5+
"Saturday": "samedi",
6+
"Sunday": "dimanche",
7+
"Thursday": "Jeudi",
8+
"Tuesday": "Mardi",
9+
"Wednesday": "Mercredi",
10+
"addTrigger": "Ajouter un déclencheur",
11+
"allOff": "Tout éteint",
12+
"allOn": "Tout sur",
13+
"automaticSwitchingEnabled": "Commutation automatique activée",
14+
"boolean": "booléen",
15+
"cancelEdit": "Annuler la modification",
16+
"currentValue": "Valeur actuelle",
17+
"dataId": "Planifier l'identifiant des données",
18+
"editName": "Modifier le nom",
19+
"editTrigger": "Modifier le déclencheur",
20+
"enabled": "Activée",
21+
"false": "faux",
22+
"manualSwitching": "Commutation manuelle",
23+
"name": "Nom",
24+
"needToEnterValidNumberOff": "Entrez un nombre valide pour la valeur désactivée lorsque le type est un nombre!",
25+
"needToEnterValidNumberOn": "Entrez un nombre valide pour la valeur activée lorsque le type est un nombre!",
26+
"needToEnterValidStringValue": "La valeur On / Off ne peut pas être vide lorsque le type est une chaîne",
27+
"needToSelectDataId": "Sélectionnez un identifiant de données de planification pour utiliser le widget!",
28+
"needToSelectStateId": "Sélectionnez au moins un identifiant d'état commuté pour utiliser le widget!",
29+
"needToSelectValidDataId": "Sélectionnez un identifiant de données de planification valide (avec le modèle 'time-switch.0.onoff. *. Data')!",
30+
"number": "nombre",
31+
"off": "De",
32+
"offValue": "Valeur pour off",
33+
"on": "Sur",
34+
"onValue": "Valeur pour on",
35+
"removeSchedule": "Supprimer le calendrier",
36+
"removeTrigger": "Supprimer la gâchette",
37+
"saveChanges": "Sauvegarder les modifications",
38+
"saveName": "Enregistrer le nom",
39+
"scheduleId": "Planifier l'identifiant des données",
40+
"showId": "Afficher l'ID de l'état commuté",
41+
"showManualSwitch": "Afficher le commutateur manuel",
42+
"stateId": "Identifiant d'état commuté",
43+
"statesCount": "Nombre d'états commutés",
44+
"string": "chaîne",
45+
"switchedType": "Type commuté",
46+
"switchedValue": "Valeur commutée",
47+
"time-switch adapter settings": "Paramètres d'adaptateur pour time-switch",
48+
"trigger": "Déclencheur",
49+
"trigger count": "Nombre de déclencheurs",
50+
"true": "vrai",
51+
"valueType": "Type de valeur"
52+
}

0 commit comments

Comments
 (0)