iobroker.hass 1.0.1 → 1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-2020 bluefox <dogafox@gmail.com>
3
+ Copyright (c) 2018-2022 bluefox <dogafox@gmail.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,15 +1,85 @@
1
1
  ![Logo](admin/hass.png)
2
2
  # ioBroker.hass
3
3
 
4
+ ![Number of Installations](http://iobroker.live/badges/hass-installed.svg)
5
+ ![Number of Installations](http://iobroker.live/badges/hass-stable.svg)
4
6
  [![NPM version](http://img.shields.io/npm/v/iobroker.hass.svg)](https://www.npmjs.com/package/iobroker.hass)
7
+
8
+ ![Test and Release](https://github.com/ioBroker/ioBroker.hass/workflows/Test%20and%20Release/badge.svg)
9
+ [![Translation status](https://weblate.iobroker.net/widgets/adapters/-/hass/svg-badge.svg)](https://weblate.iobroker.net/engage/adapters/?utm_source=widget)
5
10
  [![Downloads](https://img.shields.io/npm/dm/iobroker.hass.svg)](https://www.npmjs.com/package/iobroker.hass)
6
11
 
12
+ **This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers.** For more details and for information how to disable the error reporting see [Sentry-Plugin Documentation](https://github.com/ioBroker/plugin-sentry#plugin-sentry)! Sentry reporting is used starting with js-controller 3.0.
13
+
7
14
 
8
15
  This adapter allows the connecting of Home Assistant to ioBroker.
9
16
 
10
17
  ## Usage
11
18
  Create a long term token in HASS and use it as PW (copy it also in the repeat field).
12
19
 
20
+ Then it should read out all attributes for all devices. Services might be controllable (e.g. "turn_on"). To control services you have two options:
21
+ * Set the state with an ack=false value which is not a string (e.g. Boolean true) then it will be triggered also in HASS without additional service data
22
+ * Set the state with an ack=false String value which is a stringified JSON object to call the service and use the JSON object as service data
23
+
24
+ For the last option on a light.turn_off with e.g. `{"transition":10,"flash":"short"}` these two service data details are sent with the call to HASS. The available fields with their data definition can be seen in the JSON definition of the ioBroker object in the native.fields section and would look like the following in the above example:
25
+
26
+ `
27
+ ...
28
+ native: {
29
+ "fields": {
30
+ "transition": {
31
+ "name": "Transition",
32
+ "description": "Duration it takes to get to next state.",
33
+ "selector": {
34
+ "number": {
35
+ "min": 0,
36
+ "max": 300,
37
+ "unit_of_measurement": "seconds"
38
+ }
39
+ }
40
+ },
41
+ "flash": {
42
+ "name": "Flash",
43
+ "description": "If the light should flash.",
44
+ "advanced": true,
45
+ "selector": {
46
+ "select": {
47
+ "options": [
48
+ "long",
49
+ "short"
50
+ ]
51
+ }
52
+ }
53
+ }
54
+ },
55
+ "entity_id": "light.mi_control_hub_light",
56
+ "attr": "turn_off",
57
+ "type": "light"
58
+ }
59
+ ...
60
+ `
61
+
62
+ For some services like set_speed it is required to call with a JSON object like `{speed: "high"}` in general to provide required values. In this case the field definition look e.g. like:
63
+
64
+ ```
65
+ ...
66
+ native: {
67
+ "fields": {
68
+ "speed": {
69
+ "name": "Speed",
70
+ "description": "Speed setting.",
71
+ "required": true,
72
+ "example": "low",
73
+ "selector": {
74
+ "text": null
75
+ }
76
+ }
77
+ }
78
+ ...
79
+ }
80
+ ...
81
+ ```
82
+
13
83
  ## Configuration
14
84
  There is a good article about connection.
15
85
 
@@ -23,6 +93,11 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
23
93
  -->
24
94
 
25
95
  ## Changelog
96
+ ### 1.1.0 (2022-03-24)
97
+ * IMPORTANT: You need to re-enter the password once after installing this version!
98
+ * (Apollon77) Implement Service triggers to use any value to trigger or stringified JSON to call with fields
99
+ * (Apollon77) Optimize unload handling
100
+ * (Apollon7) Add Sentry for crash reporting
26
101
 
27
102
  ### 1.0.1 (2021-09-04)
28
103
  * IMPORTANT: js-controller 2.0 is needed st least!
@@ -38,7 +113,7 @@ Please check it https://www.smarthomejetzt.de/mit-iobroker-auf-eine-home-assista
38
113
  ## License
39
114
  The MIT License (MIT)
40
115
 
41
- Copyright (c) 2018-2020 bluefox <dogafox@gmail.com>
116
+ Copyright (c) 2018-2022 bluefox <dogafox@gmail.com>
42
117
 
43
118
  Permission is hereby granted, free of charge, to any person obtaining a copy
44
119
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "IP-Adresse des Heimassistenten:",
3
+ "Home assistant WS Port:": "Home Assistant WS-Port:",
4
+ "Password repeat:": "Passwort wiederholen:",
5
+ "Password:": "Passwort:",
6
+ "Passwords missmatch!": "Passwörter stimmen nicht überein!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "Home assistant IP:",
3
+ "Home assistant WS Port:": "Home assistant WS Port:",
4
+ "Password repeat:": "Password repeat:",
5
+ "Password:": "Password:",
6
+ "Passwords missmatch!": "Passwords missmatch!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "IP del asistente de hogar:",
3
+ "Home assistant WS Port:": "Asistente doméstico Puerto WS:",
4
+ "Password repeat:": "Repite la contraseña:",
5
+ "Password:": "Clave:",
6
+ "Passwords missmatch!": "¡Las contraseñas no coinciden!",
7
+ "Secure:": "¿HTTPS?:"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "IP de l'assistant à domicile :",
3
+ "Home assistant WS Port:": "Port WS de l'assistant domestique :",
4
+ "Password repeat:": "Répéter le mot de passe :",
5
+ "Password:": "Mot de passe:",
6
+ "Passwords missmatch!": "Les mots de passe ne correspondent pas !",
7
+ "Secure:": "HTTPS ?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "IP assistente domestico:",
3
+ "Home assistant WS Port:": "Porta WS dell'assistente domestico:",
4
+ "Password repeat:": "Ripeti password:",
5
+ "Password:": "Parola d'ordine:",
6
+ "Passwords missmatch!": "Le password non corrispondono!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "Thuisassistent IP:",
3
+ "Home assistant WS Port:": "Thuisassistent WS Poort:",
4
+ "Password repeat:": "Wachtwoord herhalen:",
5
+ "Password:": "Wachtwoord:",
6
+ "Passwords missmatch!": "Wachtwoorden komen niet overeen!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "Adres IP asystenta domowego:",
3
+ "Home assistant WS Port:": "Asystent domowy Port WS:",
4
+ "Password repeat:": "Powtórz hasło:",
5
+ "Password:": "Hasło:",
6
+ "Passwords missmatch!": "Niezgodność haseł!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "IP do assistente doméstico:",
3
+ "Home assistant WS Port:": "Assistente doméstico Porta WS:",
4
+ "Password repeat:": "Repetição de senha:",
5
+ "Password:": "Senha:",
6
+ "Passwords missmatch!": "As senhas não correspondem!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "Домашний помощник IP:",
3
+ "Home assistant WS Port:": "Домашний помощник WS Порт:",
4
+ "Password repeat:": "Повтор пароля:",
5
+ "Password:": "Пароль:",
6
+ "Passwords missmatch!": "Пароли не совпадают!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "Home assistant IP:": "家庭助理IP:",
3
+ "Home assistant WS Port:": "家庭助理 WS 端口:",
4
+ "Password repeat:": "密码重复:",
5
+ "Password:": "密码:",
6
+ "Passwords missmatch!": "密码不匹配!",
7
+ "Secure:": "HTTPS?"
8
+ }
@@ -1,75 +1,108 @@
1
- <html>
2
- <head>
3
- <link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
4
- <link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
5
-
6
- <script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
7
- <script type="text/javascript" src="../../socket.io/socket.io.js"></script>
8
- <script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
9
- <script type="text/javascript" src="../../js/translate.js"></script>
10
- <script type="text/javascript" src="../../js/adapter-settings.js"></script>
11
- <script type="text/javascript" src="words.js"></script>
12
-
13
- <script type="text/javascript">
14
-
15
- function load(settings, onChange) {
16
- if (!settings) return;
17
-
18
- if (settings.password === undefined) settings.password = '';
19
- if (settings.prompt === undefined) settings.prompt = 'hass>';
20
-
21
- $('.value').each(function () {
22
- var key = $(this).attr('id');
23
- var $value = $('#' + key + '.value');
24
- if ($value.attr('type') === 'checkbox') {
25
- $value.prop('checked', settings[key]).change(function() {
26
- onChange();
27
- });
28
- } else {
29
- $value.val(settings[key]).change(function() {
30
- onChange();
31
- }).keyup(function() {
32
- onChange();
33
- });
34
- }
35
- });
36
- // Signal to admin, that no changes yet
37
- onChange(false);
38
- }
39
-
40
- function save(callback) {
41
- var obj = {};
42
-
43
- if ($('#password').val() !== $('#passwordRepeat').val()) {
44
- showMessage(_('Passwords missmatch!'), _('Warning'), 'alert');
45
- return;
46
- }
47
-
48
- $('.value').each(function () {
49
- var $this = $(this);
50
- if ($this.attr('type') === 'checkbox') {
51
- obj[$this.attr('id')] = $this.prop('checked');
52
- } else {
53
- obj[$this.attr('id')] = $this.val();
54
- }
55
- });
56
- callback(obj);
57
- }
58
- </script>
59
- </head>
60
- <body>
61
- <div id="adapter-container">
62
- <table><tr>
63
- <td><img src="hass.png" alt="logo"/></td>
64
- <td><h3 class="translate">Home assistant adapter settings</h3></td>
65
- </tr></table>
66
- <table>
67
- <tr><td><label class="translate" for="host">Home assistant IP:</label></td><td class="admin-icon"></td><td><input class="value" id="host" /></td></tr>
68
- <tr><td><label class="translate" for="port">Home assistant WS Port:</label></td><td class="admin-icon"></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
69
- <tr><td><label class="translate" for="password">Password:</label></td><td class="admin-icon"></td><td><input class="value" id="password" type="password"/></td></tr>
70
- <tr><td><label class="translate" for="passwordRepeat">Password repeat:</label></td><td class="admin-icon"></td><td><input type="password" id="passwordRepeat"/></td></tr>
71
- <tr><td><label class="translate" for="secure">Secure:</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox"/></td></tr>
72
- </table>
73
- </div>
74
- </body>
75
- </html>
1
+ <html>
2
+ <head>
3
+ <!-- Materialze style -->
4
+ <link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
5
+ <link rel="stylesheet" type="text/css" href="../../lib/css/materialize.css">
6
+
7
+ <script type="text/javascript" src="../../lib/js/jquery-3.2.1.min.js"></script>
8
+ <script type="text/javascript" src="../../socket.io/socket.io.js"></script>
9
+
10
+ <script type="text/javascript" src="../../js/translate.js"></script>
11
+ <script type="text/javascript" src="../../lib/js/materialize.js"></script>
12
+ <script type="text/javascript" src="../../js/adapter-settings.js"></script>
13
+ <script type="text/javascript" src="words.js"></script>
14
+
15
+ <script type="text/javascript">
16
+
17
+ function load(settings, onChange) {
18
+ if (!settings) return;
19
+
20
+ if (settings.password === undefined) settings.password = '';
21
+ settings.passwordRepeat = settings.password;
22
+
23
+ $('.value').each(function () {
24
+ var key = $(this).attr('id');
25
+ var $value = $('#' + key + '.value');
26
+ if ($value.attr('type') === 'checkbox') {
27
+ $value.prop('checked', settings[key]).change(function() {
28
+ onChange();
29
+ });
30
+ } else {
31
+ $value.val(settings[key]).change(function() {
32
+ onChange();
33
+ }).keyup(function() {
34
+ onChange();
35
+ });
36
+ }
37
+ });
38
+ // Signal to admin, that no changes yet
39
+ onChange(false);
40
+ }
41
+
42
+ function save(callback) {
43
+ var obj = {};
44
+
45
+ if ($('#password').val() !== $('#passwordRepeat').val()) {
46
+ showMessage(_('Passwords missmatch!'), _('Warning'), 'alert');
47
+ return;
48
+ }
49
+
50
+ $('.value').each(function () {
51
+ var $this = $(this);
52
+ if ($this.attr('type') === 'checkbox') {
53
+ obj[$this.attr('id')] = $this.prop('checked');
54
+ } else {
55
+ obj[$this.attr('id')] = $this.val();
56
+ }
57
+ });
58
+ delete obj.passwordRepeat;
59
+
60
+ callback(obj);
61
+ }
62
+ </script>
63
+ </head>
64
+ <body>
65
+ <div class="m adapter-container">
66
+ <div class="row">
67
+ <div class="col s12 m4 l2">
68
+ <img src="hass.png" class="logo">
69
+ </div>
70
+ </div>
71
+
72
+ <div class="row">
73
+ <div class="col s12 m8 l8">
74
+ <div class="col s4 input-field">
75
+ <input type="text" class="value" id="host" />
76
+ <label for="host" class="translate">Home assistant IP:</label>
77
+ </div>
78
+ <div class="col s4 input-field">
79
+ <input type="text" class="value" id="port" size="5" maxlength="5"/>
80
+ <label for="port" class="translate">Home assistant WS Port:</label>
81
+ </div>
82
+ </div>
83
+ </div>
84
+
85
+ <div class="row">
86
+ <div class="col s12 m8 l8">
87
+ <div class="col s6 m4 input-field">
88
+ <input type="text" class="value" id="password" />
89
+ <label for="password" class="translate">Password:</label>
90
+ </div>
91
+ <div class="col s6 m4 input-field">
92
+ <input type="text" class="value" id="passwordRepeat" />
93
+ <label for="passwordRepeat" class="translate">Password repeat:</label>
94
+ </div>
95
+ </div>
96
+ </div>
97
+
98
+ <div class="row">
99
+ <div class="col s12 m8 l8">
100
+ <div class="col s6 m4 input-field">
101
+ <input id="secure" type="checkbox" class="value" />
102
+ <span for="secure" class="translate">Secure:</span>
103
+ </div>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ </body>
108
+ </html>
package/admin/words.js CHANGED
@@ -1,19 +1,11 @@
1
+ /*global systemDictionary:true */
2
+ 'use strict';
3
+
1
4
  systemDictionary = {
2
- "FHEM adapter settings":{"de": "FHEM Adapter Einstellungen", "ru": "Настройки драйвера FHEM"},
3
- "FHEM Telnet IP:": {"de": "FHEM Telnet IP:", "ru": "FHEM Telnet IP:"},
4
- "FHEM Telnet Port:": {"en": "FHEM Telnet Port:", "de": "FHEM Telnet Port:", "ru": "FHEM Telnet порт:"},
5
- "Password:": {"en": "Password:", "de": "Kennwort:", "ru": "Пароль:"},
6
- "Password repeat:": {"en": "Password repeat:", "de": "Kennwort-Woederholung:", "ru": "Подтверждение пароля:"},
7
- "Passwords missmatch!": {"en": "Passwords missmatch!", "de": "Kennworte sind unterschiedlich!", "ru": "Пароли не совпадают!"},
8
- "Prompt:": {"en": "Prompt:", "de": "Prompt:", "ru": "Промпт:"},
9
- "tooltip_password": {
10
- "en": "Optional. Only if FHEM requires password.",
11
- "de": "Optional. Nur falls in FHEM konfiguriert",
12
- "ru": "Не обязательно. Только если настроено в FHEM"
13
- },
14
- "tooltip_prompt": {
15
- "en": "You can change standard prompt from 'hass>' to something else.",
16
- "de": "Man kann hier ein eigenes Prompt setzen. Default ist 'hass>'",
17
- "ru": "Можно задать собственный промпт. По умолчанию 'hass>'"
18
- }
19
- };
5
+ "Home assistant IP:": { "en": "Home assistant IP:", "de": "IP-Adresse des Heimassistenten:", "ru": "Домашний помощник IP:", "pt": "IP do assistente doméstico:", "nl": "Thuisassistent IP:", "fr": "IP de l'assistant à domicile :", "it": "IP assistente domestico:", "es": "IP del asistente de hogar:", "pl": "Adres IP asystenta domowego:", "zh-cn": "家庭助理IP:"},
6
+ "Home assistant WS Port:": { "en": "Home assistant WS Port:", "de": "Home Assistant WS-Port:", "ru": "Домашний помощник WS Порт:", "pt": "Assistente doméstico Porta WS:", "nl": "Thuisassistent WS Poort:", "fr": "Port WS de l'assistant domestique :", "it": "Porta WS dell'assistente domestico:", "es": "Asistente doméstico Puerto WS:", "pl": "Asystent domowy Port WS:", "zh-cn": "家庭助理 WS 端口:"},
7
+ "Password repeat:": { "en": "Password repeat:", "de": "Passwort wiederholen:", "ru": "Повтор пароля:", "pt": "Repetição de senha:", "nl": "Wachtwoord herhalen:", "fr": "Répéter le mot de passe :", "it": "Ripeti password:", "es": "Repite la contraseña:", "pl": "Powtórz hasło:", "zh-cn": "密码重复:"},
8
+ "Password:": { "en": "Password:", "de": "Passwort:", "ru": "Пароль:", "pt": "Senha:", "nl": "Wachtwoord:", "fr": "Mot de passe:", "it": "Parola d'ordine:", "es": "Clave:", "pl": "Hasło:", "zh-cn": "密码:"},
9
+ "Passwords missmatch!": { "en": "Passwords missmatch!", "de": "Passwörter stimmen nicht überein!", "ru": "Пароли не совпадают!", "pt": "As senhas não correspondem!", "nl": "Wachtwoorden komen niet overeen!", "fr": "Les mots de passe ne correspondent pas !", "it": "Le password non corrispondono!", "es": "¡Las contraseñas no coinciden!", "pl": "Niezgodność haseł!", "zh-cn": "密码不匹配!"},
10
+ "Secure:": { "en": "HTTPS?", "de": "HTTPS?", "ru": "HTTPS?", "pt": "HTTPS?", "nl": "HTTPS?", "fr": "HTTPS ?", "it": "HTTPS?", "es": "¿HTTPS?", "pl": "HTTPS?", "zh-cn": "HTTPS?"},
11
+ };
package/io-package.json CHANGED
@@ -1,133 +1,203 @@
1
1
  {
2
- "common": {
3
- "name": "hass",
4
- "version": "1.0.1",
5
- "title": "Home Assistant",
6
- "titleLang": {
7
- "en": "Home Assistant",
8
- "de": "Home-Assistent",
9
- "ru": "Домашний помощник",
10
- "pt": "Home Assistant",
11
- "nl": "Thuisassistent",
12
- "fr": "Assistante à domicile",
13
- "it": "Assistente domiciliare",
14
- "es": "Asistente de hogar",
15
- "pl": "Asystent domowy",
16
- "zh-cn": "家庭助理"
17
- },
18
- "desc": {
19
- "en": "Home Assistant connection for ioBroker",
20
- "de": "Home Assistant Verbindung für ioBroker",
21
- "ru": "Подключение Home Assistant для ioBroker",
22
- "pt": "Conexão do Home Assistant para ioBroker",
23
- "nl": "Home Assistant-verbinding voor ioBroker",
24
- "fr": "Connexion Home Assistant pour ioBroker",
25
- "it": "Connessione Home Assistant per ioBroker",
26
- "es": "Conexión de Home Assistant para ioBroker",
27
- "pl": "Połączenie Home Assistant dla ioBroker"
28
- },
29
- "news": {
30
- "1.0.1": {
31
- "en": "IMPORTANT: js-controller 2.0 is needed st least!\nFix start issue\n(Apollon77/Garfonso) Fix issue where value could not be set in hass",
32
- "de": "WICHTIG: js-controller 2.0 wird am wenigsten benötigt!\nStartproblem beheben\n(Apollon77/Garfonso) Problem behoben, bei dem der Wert nicht in Hass festgelegt werden konnte",
33
- "ru": "ВАЖНО: js-controller 2.0 нужен как минимум!\nИсправить проблему с запуском\n(Apollon77 / Garfonso) Исправлена ошибка, из-за которой значение не могло быть установлено в hass.",
34
- "pt": "IMPORTANTE: o js-controller 2.0 é o mínimo necessário!\nCorrigir problema inicial\n(Apollon77 / Garfonso) Correção do problema em que o valor não podia ser definido em hass",
35
- "nl": "BELANGRIJK: js-controller 2.0 is minimaal nodig!\nStartprobleem oplossen\n(Apollon77/Garfonso) Probleem opgelost waarbij de waarde niet kon worden ingesteld in hass",
36
- "fr": "IMPORTANT : js-controller 2.0 est au moins nécessaire !\nRésoudre le problème de démarrage\n(Apollon77/Garfonso) Correction d'un problème où la valeur ne pouvait pas être définie dans hass",
37
- "it": "IMPORTANTE: come minimo è necessario js-controller 2.0!\nRisolvi il problema di avvio\n(Apollon77/Garfonso) Risolto il problema per cui il valore non poteva essere impostato in hass",
38
- "es": "IMPORTANTE: ¡js-controller 2.0 es lo menos necesario!\nSolucionar problema de inicio\n(Apollon77 / Garfonso) Se solucionó el problema por el cual no se podía establecer el valor en hass",
39
- "pl": "WAŻNE: js-controller 2.0 jest potrzebny przynajmniej!\nNapraw problem z uruchomieniem\n(Apollon77/Garfonso) Napraw problem, w którym nie można było ustawić wartości w hass",
40
- "zh-cn": "重要提示:至少需要 js-controller 2.0!\n修复启动问题\n(Apollon77/Garfonso) 修复无法在 hass 中设置值的问题"
41
- },
42
- "1.0.0": {
43
- "en": "added the support of compact mode",
44
- "de": "fügte die Unterstützung des Kompaktmodus hinzu",
45
- "ru": "добавлена поддержка компактного режима",
46
- "pt": "adicionado o suporte do modo compacto",
47
- "nl": "de ondersteuning van de compacte modus toegevoegd",
48
- "fr": "ajouté le support du mode compact",
49
- "it": "aggiunto il supporto della modalità compatta",
50
- "es": "agregó el soporte del modo compacto",
51
- "pl": "dodano obsługę trybu kompaktowego",
52
- "zh-cn": "增加了对紧凑模式的支持"
53
- },
54
- "0.1.0": {
55
- "en": "initial version",
56
- "de": "erste Version",
57
- "ru": "Первоначальная версия",
58
- "pt": "versão inicial",
59
- "nl": "eerste versie",
60
- "fr": "version initiale",
61
- "it": "versione iniziale",
62
- "es": "versión inicial",
63
- "pl": "początkowa wersja"
64
- }
65
- },
66
- "localLink": "http://%host%:8123",
67
- "platform": "Javascript/Node.js",
68
- "mode": "daemon",
69
- "icon": "hass.png",
70
- "enabled": true,
71
- "compact": true,
72
- "materialize": true,
73
- "license": "MIT",
74
- "extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.hass/master/admin/hass.png",
75
- "keywords": [
76
- "HASS",
77
- "Home",
78
- "assistant"
79
- ],
80
- "readme": "https://github.com/ioBroker/ioBroker.hass/blob/master/README.md",
81
- "loglevel": "info",
82
- "type": "iot-systems",
83
- "authors": [
84
- "bluefox <dogafox@gmail.com>"
85
- ],
86
- "dependencies": [
87
- {
88
- "js-controller": ">=2.0.0"
89
- }
90
- ],
91
- "connectionType": "local",
92
- "dataSource": "push",
93
- "tier": 2
2
+ "common": {
3
+ "name": "hass",
4
+ "version": "1.1.0",
5
+ "title": "Home Assistant",
6
+ "titleLang": {
7
+ "en": "Home Assistant",
8
+ "de": "Home-Assistent",
9
+ "ru": "Домашний помощник",
10
+ "pt": "Home Assistant",
11
+ "nl": "Thuisassistent",
12
+ "fr": "Assistante à domicile",
13
+ "it": "Assistente domiciliare",
14
+ "es": "Asistente de hogar",
15
+ "pl": "Asystent domowy",
16
+ "zh-cn": "家庭助理"
17
+ },
18
+ "desc": {
19
+ "en": "Home Assistant connection for ioBroker",
20
+ "de": "Home Assistant Verbindung für ioBroker",
21
+ "ru": "Подключение Home Assistant для ioBroker",
22
+ "pt": "Conexão do Home Assistant para ioBroker",
23
+ "nl": "Home Assistant-verbinding voor ioBroker",
24
+ "fr": "Connexion Home Assistant pour ioBroker",
25
+ "it": "Connessione Home Assistant per ioBroker",
26
+ "es": "Conexión de Home Assistant para ioBroker",
27
+ "pl": "Połączenie Home Assistant dla ioBroker",
28
+ "zh-cn": "ioBroker 的家庭助理连接"
94
29
  },
95
- "native": {
96
- "host": "127.0.0.1",
97
- "port": 8123,
98
- "password": "",
99
- "secure": false
30
+ "news": {
31
+ "1.1.0": {
32
+ "en": "IMPORTANT: You need to re-enter the password once after installing this version!\nImplement Service triggers to use any value to trigger or stringified JSON to call with fields\nOptimize unload handling\nAdd Sentry for crash reporting",
33
+ "de": "WICHTIG: Nach der Installation dieser Version müssen Sie das Passwort einmalig neu eingeben!\nImplementieren Sie Dienstauslöser, um einen beliebigen Wert zum Auslösen oder stringifiziertes JSON zum Aufrufen mit Feldern zu verwenden\nEntladehandling optimieren\nFügen Sie Sentry für Absturzberichte hinzu",
34
+ "ru": "ВАЖНО: Вам необходимо повторно ввести пароль один раз после установки этой версии!\nРеализовать триггеры службы, чтобы использовать любое значение для запуска или строкового JSON для вызова с полями.\nОптимизация обработки разгрузки\nДобавьте Sentry для отчетов о сбоях",
35
+ "pt": "IMPORTANTE: Você precisa redigitar a senha uma vez depois de instalar esta versão!\nImplemente gatilhos de serviço para usar qualquer valor para acionar ou JSON stringified para chamar com campos\nOtimize o manuseio de descarga\nAdicionar Sentinela para relatórios de falhas",
36
+ "nl": "BELANGRIJK: u moet het wachtwoord één keer opnieuw invoeren na het installeren van deze versie!\nImplementeer servicetriggers om elke waarde te gebruiken om te activeren of stringified JSON om met velden aan te roepen\nOptimaliseer de losverwerking\nSentry toevoegen voor crashrapportage",
37
+ "fr": "IMPORTANT : Vous devez ressaisir le mot de passe une fois après l'installation de cette version !\nImplémentez des déclencheurs de service pour utiliser n'importe quelle valeur pour déclencher ou JSON stringifié pour appeler avec des champs\nOptimiser la gestion des déchargements\nAjouter Sentry pour les rapports de plantage",
38
+ "it": "IMPORTANTE: è necessario reinserire la password una volta dopo aver installato questa versione!\nImplementa i trigger del servizio per utilizzare qualsiasi valore per attivare o JSON in formato stringa per chiamare con i campi\nOttimizza la gestione dello scarico\nAggiungi Sentinella per la segnalazione degli arresti anomali",
39
+ "es": "IMPORTANTE: ¡Debe volver a ingresar la contraseña una vez después de instalar esta versión!\nImplementar disparadores de servicio para usar cualquier valor para disparar o JSON en cadena para llamar con campos\nOptimizar el manejo de descarga\nAgregar Sentry para informes de fallas",
40
+ "pl": "WAŻNE: Po zainstalowaniu tej wersji należy raz ponownie wprowadzić hasło!\nZaimplementuj wyzwalacze usługi, aby używać dowolnej wartości do wyzwalania lub skróconego JSON do wywołania z polami\nZoptymalizuj obsługę rozładunku\nDodaj Sentry do zgłaszania awarii",
41
+ "zh-cn": "重要提示:安装此版本后需要重新输入一次密码!\n实现服务触发器以使用任何值触发或字符串化 JSON 以使用字段调用\n优化卸载处理\n添加 Sentry 以进行崩溃报告"
42
+ },
43
+ "1.0.1": {
44
+ "en": "IMPORTANT: js-controller 2.0 is needed st least!\nFix start issue\n(Apollon77/Garfonso) Fix issue where value could not be set in hass",
45
+ "de": "WICHTIG: js-controller 2.0 wird am wenigsten benötigt!\nStartproblem beheben\n(Apollon77/Garfonso) Problem behoben, bei dem der Wert nicht in Hass festgelegt werden konnte",
46
+ "ru": "ВАЖНО: js-controller 2.0 нужен как минимум!\nИсправить проблему с запуском\n(Apollon77 / Garfonso) Исправлена ошибка, из-за которой значение не могло быть установлено в hass.",
47
+ "pt": "IMPORTANTE: o js-controller 2.0 é o mínimo necessário!\nCorrigir problema inicial\n(Apollon77 / Garfonso) Correção do problema em que o valor não podia ser definido em hass",
48
+ "nl": "BELANGRIJK: js-controller 2.0 is minimaal nodig!\nStartprobleem oplossen\n(Apollon77/Garfonso) Probleem opgelost waarbij de waarde niet kon worden ingesteld in hass",
49
+ "fr": "IMPORTANT : js-controller 2.0 est au moins nécessaire !\nRésoudre le problème de démarrage\n(Apollon77/Garfonso) Correction d'un problème où la valeur ne pouvait pas être définie dans hass",
50
+ "it": "IMPORTANTE: come minimo è necessario js-controller 2.0!\nRisolvi il problema di avvio\n(Apollon77/Garfonso) Risolto il problema per cui il valore non poteva essere impostato in hass",
51
+ "es": "IMPORTANTE: ¡js-controller 2.0 es lo menos necesario!\nSolucionar problema de inicio\n(Apollon77 / Garfonso) Se solucionó el problema por el cual no se podía establecer el valor en hass",
52
+ "pl": "WAŻNE: js-controller 2.0 jest potrzebny przynajmniej!\nNapraw problem z uruchomieniem\n(Apollon77/Garfonso) Napraw problem, w którym nie można było ustawić wartości w hass",
53
+ "zh-cn": "重要提示:至少需要 js-controller 2.0!\n修复启动问题\n(Apollon77/Garfonso) 修复无法在 hass 中设置值的问题"
54
+ },
55
+ "1.0.0": {
56
+ "en": "added the support of compact mode",
57
+ "de": "fügte die Unterstützung des Kompaktmodus hinzu",
58
+ "ru": "добавлена поддержка компактного режима",
59
+ "pt": "adicionado o suporte do modo compacto",
60
+ "nl": "de ondersteuning van de compacte modus toegevoegd",
61
+ "fr": "ajouté le support du mode compact",
62
+ "it": "aggiunto il supporto della modalità compatta",
63
+ "es": "agregó el soporte del modo compacto",
64
+ "pl": "dodano obsługę trybu kompaktowego",
65
+ "zh-cn": "增加了对紧凑模式的支持"
66
+ },
67
+ "0.1.0": {
68
+ "en": "initial version",
69
+ "de": "erste Version",
70
+ "ru": "Первоначальная версия",
71
+ "pt": "versão inicial",
72
+ "nl": "eerste versie",
73
+ "fr": "version initiale",
74
+ "it": "versione iniziale",
75
+ "es": "versión inicial",
76
+ "pl": "początkowa wersja",
77
+ "zh-cn": "初始版本"
78
+ }
100
79
  },
101
- "objects": [],
102
- "instanceObjects": [
103
- {
104
- "_id": "info",
105
- "type": "channel",
106
- "common": {
107
- "name": "Information"
108
- },
109
- "native": {}
80
+ "localLink": "http://%host%:8123",
81
+ "platform": "Javascript/Node.js",
82
+ "mode": "daemon",
83
+ "icon": "hass.png",
84
+ "enabled": true,
85
+ "compact": true,
86
+ "materialize": true,
87
+ "license": "MIT",
88
+ "extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.hass/master/admin/hass.png",
89
+ "keywords": [
90
+ "HASS",
91
+ "Home",
92
+ "assistant"
93
+ ],
94
+ "readme": "https://github.com/ioBroker/ioBroker.hass/blob/master/README.md",
95
+ "loglevel": "info",
96
+ "type": "iot-systems",
97
+ "authors": [
98
+ "bluefox <dogafox@gmail.com>"
99
+ ],
100
+ "dependencies": [
101
+ {
102
+ "js-controller": ">=3.0.0"
103
+ }
104
+ ],
105
+ "globalDependencies": [
106
+ {
107
+ "admin": ">=5.1.28"
108
+ }
109
+ ],
110
+ "plugins": {
111
+ "sentry": {
112
+ "dsn": "https://1b2a1e8335f84cc49a67dd5ac2b07573@sentry.iobroker.net/182"
113
+ }
114
+ },
115
+ "connectionType": "local",
116
+ "dataSource": "push",
117
+ "tier": 2,
118
+ "messages": [
119
+ {
120
+ "condition": {
121
+ "operand": "and",
122
+ "rules": [
123
+ "oldVersion<1.1.0",
124
+ "newVersion>=1.1.0"
125
+ ]
126
+ },
127
+ "title": {
128
+ "en": "Re-enter the password after Update!",
129
+ "de": "Passwort muss nach dem Update erneut eingegeben werden!",
130
+ "ru": "Повторно введите пароль после обновления!",
131
+ "pt": "Digite novamente a senha após Atualizar!",
132
+ "nl": "Voer het wachtwoord opnieuw in na Update!",
133
+ "fr": "Entrez à nouveau le mot de passe après la mise à jour !",
134
+ "it": "Reinserire la password dopo l'aggiornamento!",
135
+ "es": "Vuelva a ingresar la contraseña después de ¡Actualizar!",
136
+ "pl": "Wprowadź hasło ponownie po aktualizacji!",
137
+ "zh-cn": "更新后重新输入密码!"
110
138
  },
111
- {
112
- "_id": "info.connection",
113
- "type": "state",
114
- "common": {
115
- "role": "indicator.connected",
116
- "name": "If connected to HASS server",
117
- "type": "boolean",
118
- "read": true,
119
- "write": false,
120
- "def": false
121
- },
122
- "native": {}
139
+ "text": {
140
+ "en": "After installing this update the password/token used to access the HASS installation needs to be re-entered in the Instance-Settings!",
141
+ "de": "Nach der Installation dieses Updates muss das Passwort/Token für den Zugriff auf die HASS-Installation in den Instanz-Einstellungen erneut eingegeben werden!",
142
+ "ru": "После установки этого обновления пароль/токен, используемый для доступа к установке HASS, необходимо повторно ввести в настройках экземпляра!",
143
+ "pt": "Depois de instalar esta atualização, a senha/token usado para acessar a instalação do HASS precisa ser reinserido nas configurações da instância!",
144
+ "nl": "Na het installeren van deze update moet het wachtwoord/token dat wordt gebruikt om toegang te krijgen tot de HASS-installatie opnieuw worden ingevoerd in de Instance-Settings!",
145
+ "fr": "Après l'installation de cette mise à jour, le mot de passe/jeton utilisé pour accéder à l'installation HASS doit être ressaisi dans les paramètres d'instance !",
146
+ "it": "Dopo aver installato questo aggiornamento, la password/token utilizzato per accedere all'installazione HASS deve essere reinserito nelle impostazioni dell'istanza!",
147
+ "es": "¡Después de instalar esta actualización, la contraseña/token utilizada para acceder a la instalación de HASS debe volver a ingresarse en la configuración de la instancia!",
148
+ "pl": "Po zainstalowaniu tej aktualizacji hasło/token używane do uzyskania dostępu do instalacji HASS należy ponownie wprowadzić w ustawieniach instancji!",
149
+ "zh-cn": "安装此更新后,用于访问 HASS 安装的密码/令牌需要在实例设置中重新输入!"
123
150
  },
124
- {
125
- "_id": "entities",
126
- "type": "channel",
127
- "common": {
128
- "name": "HASS entities"
129
- },
130
- "native": {}
131
- }
151
+ "level": "warn",
152
+ "buttons": [
153
+ "agree",
154
+ "cancel"
155
+ ]
156
+ }
132
157
  ]
133
- }
158
+ },
159
+ "native": {
160
+ "host": "127.0.0.1",
161
+ "port": 8123,
162
+ "password": "",
163
+ "secure": false
164
+ },
165
+ "protectedNative": [
166
+ "password"
167
+ ],
168
+ "encryptedNative": [
169
+ "password"
170
+ ],
171
+ "objects": [],
172
+ "instanceObjects": [
173
+ {
174
+ "_id": "info",
175
+ "type": "channel",
176
+ "common": {
177
+ "name": "Information"
178
+ },
179
+ "native": {}
180
+ },
181
+ {
182
+ "_id": "info.connection",
183
+ "type": "state",
184
+ "common": {
185
+ "role": "indicator.connected",
186
+ "name": "If connected to HASS server",
187
+ "type": "boolean",
188
+ "read": true,
189
+ "write": false,
190
+ "def": false
191
+ },
192
+ "native": {}
193
+ },
194
+ {
195
+ "_id": "entities",
196
+ "type": "channel",
197
+ "common": {
198
+ "name": "HASS entities"
199
+ },
200
+ "native": {}
201
+ }
202
+ ]
203
+ }
package/lib/hass.js CHANGED
@@ -92,7 +92,7 @@ function HASS(options, log) {
92
92
  }
93
93
  }
94
94
 
95
- function callService(socket, service, domain, serviceData, callback) {
95
+ function callService(socket, service, domain, serviceData, target, callback) {
96
96
  if (socket && typeof socket.send === 'function') {
97
97
  const id = currentId++;
98
98
  requests[id] = {type: 'call_service', cb: callback, ts: Date.now()};
@@ -101,7 +101,8 @@ function HASS(options, log) {
101
101
  type: 'call_service',
102
102
  domain: domain || '',
103
103
  service: service,
104
- service_data: serviceData
104
+ service_data: serviceData,
105
+ target
105
106
  }));
106
107
  } else {
107
108
  callback && callback('not connected');
@@ -228,11 +229,11 @@ function HASS(options, log) {
228
229
  }
229
230
  };
230
231
 
231
- this.callService = function (service, domain, serviceData, callback) {
232
+ this.callService = function (service, domain, serviceData, target, callback) {
232
233
  if (!connected) {
233
234
  typeof callback === 'function' && callback('not connected');
234
235
  } else {
235
- callService(this.socket, service, domain, serviceData, callback);
236
+ callService(this.socket, service, domain, serviceData, target, callback);
236
237
  }
237
238
  };
238
239
 
package/lib/tools.js ADDED
@@ -0,0 +1,92 @@
1
+ const axios = require("axios");
2
+
3
+ /**
4
+ * Tests whether the given variable is a real object and not an Array
5
+ * @param {any} it The variable to test
6
+ * @returns {it is Record<string, any>}
7
+ */
8
+ function isObject(it) {
9
+ // This is necessary because:
10
+ // typeof null === 'object'
11
+ // typeof [] === 'object'
12
+ // [] instanceof Object === true
13
+ return Object.prototype.toString.call(it) === "[object Object]";
14
+ }
15
+
16
+ /**
17
+ * Tests whether the given variable is really an Array
18
+ * @param {any} it The variable to test
19
+ * @returns {it is any[]}
20
+ */
21
+ function isArray(it) {
22
+ if (Array.isArray != null)
23
+ return Array.isArray(it);
24
+ return Object.prototype.toString.call(it) === "[object Array]";
25
+ }
26
+
27
+ /**
28
+ * Choose the right tranalation API
29
+ * @param {string} text The text to translate
30
+ * @param {string} targetLang The target languate
31
+ * @param {string} yandex api key
32
+ * @returns {Promise<string>}
33
+ */
34
+ async function translateText(text, targetLang, yandex) {
35
+ if (targetLang === "en") {
36
+ return text;
37
+ }
38
+ if (yandex) {
39
+ return await translateYandex(text, targetLang, yandex);
40
+ } else {
41
+ return await translateGoogle(text, targetLang);
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Translates text with Yandex API
47
+ * @param {string} text The text to translate
48
+ * @param {string} targetLang The target languate
49
+ * @param {string} yandex api key
50
+ * @returns {Promise<string>}
51
+ */
52
+ async function translateYandex(text, targetLang, yandex) {
53
+ if (targetLang === "zh-cn") {
54
+ targetLang = "zh";
55
+ }
56
+ try {
57
+ const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${yandex}&text=${encodeURIComponent(text)}&lang=en-${targetLang}`;
58
+ const response = await axios({url, timeout: 15000});
59
+ if (response.data && response.data['text']) {
60
+ return response.data['text'][0];
61
+ }
62
+ throw new Error("Invalid response for translate request");
63
+ } catch (e) {
64
+ throw new Error(`Could not translate to "${targetLang}": ${e}`);
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Translates text with Google API
70
+ * @param {string} text The text to translate
71
+ * @param {string} targetLang The target languate
72
+ * @returns {Promise<string>}
73
+ */
74
+ async function translateGoogle(text, targetLang) {
75
+ try {
76
+ const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
77
+ const response = await axios({url, timeout: 15000});
78
+ if (isArray(response.data)) {
79
+ // we got a valid response
80
+ return response.data[0][0][0];
81
+ }
82
+ throw new Error("Invalid response for translate request");
83
+ } catch (e) {
84
+ throw new Error(`Could not translate to "${targetLang}": ${e}`);
85
+ }
86
+ }
87
+
88
+ module.exports = {
89
+ isArray,
90
+ isObject,
91
+ translateText
92
+ };
package/main.js CHANGED
@@ -12,6 +12,8 @@ let connected = false;
12
12
  let hass;
13
13
  let adapter;
14
14
  const hassObjects = {};
15
+ let delayTimeout = null;
16
+ let stopped = false;
15
17
 
16
18
  function startAdapter(options) {
17
19
  options = options || {};
@@ -35,6 +37,17 @@ function startAdapter(options) {
35
37
  } else {
36
38
  const serviceData = {};
37
39
  const fields = hassObjects[id].native.fields;
40
+ const target = {};
41
+
42
+ let requestFields = {};
43
+ if (typeof state.val === 'string') {
44
+ try {
45
+ requestFields = JSON.parse(state.val);
46
+ } catch (err) {
47
+ adapter.log.info(`Ignore data for service call ${id} is no valid JSON: ${err.message}`);
48
+ requestFields = {};
49
+ }
50
+ }
38
51
 
39
52
  for (const field in fields) {
40
53
  if (!fields.hasOwnProperty(field)) {
@@ -42,15 +55,15 @@ function startAdapter(options) {
42
55
  }
43
56
 
44
57
  if (field === 'entity_id') {
45
- serviceData.entity_id = hassObjects[id].native.entity_id
46
- } else {
47
- serviceData[field] = state.val;
58
+ target.entity_id = hassObjects[id].native.entity_id
59
+ } else if (requestFields[field] !== undefined) {
60
+ serviceData[field] = requestFields[field];
48
61
  }
49
62
  }
50
63
  serviceData.entity_id = hassObjects[id].native.entity_id
51
64
 
52
65
  adapter.log.debug(`Send to HASS for service ${hassObjects[id].native.attr} with ${hassObjects[id].native.domain || hassObjects[id].native.type} and data ${JSON.stringify(serviceData)}`)
53
- hass.callService(hassObjects[id].native.attr, hassObjects[id].native.domain || hassObjects[id].native.type, serviceData, err =>
66
+ hass.callService(hassObjects[id].native.attr, hassObjects[id].native.domain || hassObjects[id].native.type, serviceData, target, err =>
54
67
  err && adapter.log.error('Cannot control ' + id + ': ' + err));
55
68
  }
56
69
  }
@@ -65,6 +78,8 @@ function startAdapter(options) {
65
78
  }
66
79
 
67
80
  function stop(callback) {
81
+ stopped = true;
82
+ delayTimeout && clearTimeout(delayTimeout);
68
83
  hass && hass.close();
69
84
  callback && callback();
70
85
  }
@@ -318,7 +333,8 @@ function parseStates(entities, services, callback) {
318
333
  common: {
319
334
  desc: service[s].description,
320
335
  read: false,
321
- write: true
336
+ write: true,
337
+ type: 'mixed'
322
338
  },
323
339
  native: {
324
340
  object_id: entity.object_id,
@@ -355,6 +371,10 @@ function main() {
355
371
 
356
372
  hass.on('state_changed', entity => {
357
373
  adapter.log.debug(`HASS-Message: State Changed: ${JSON.stringify(entity)}`);
374
+ if (!entity || typeof entity.entity_id !== 'string') {
375
+ return;
376
+ }
377
+
358
378
  const id = adapter.namespace + '.entities.' + entity.entity_id + '.';
359
379
  const lc = entity.last_changed ? new Date(entity.last_changed).getTime() : undefined;
360
380
  const ts = entity.last_updated ? new Date(entity.last_updated).getTime() : undefined;
@@ -386,14 +406,22 @@ function main() {
386
406
  return;
387
407
  }
388
408
  //adapter.log.debug(JSON.stringify(config));
389
- setTimeout(() =>
390
- hass.getStates((err, states) => {
409
+ delayTimeout = setTimeout(() => {
410
+ delayTimeout = null;
411
+ !stopped && hass.getStates((err, states) => {
412
+ if (stopped) {
413
+ return;
414
+ }
391
415
  if (err) {
392
416
  return adapter.log.error('Cannot read states: ' + err);
393
417
  }
394
418
  //adapter.log.debug(JSON.stringify(states));
395
- setTimeout(() =>
396
- hass.getServices((err, services) => {
419
+ delayTimeout = setTimeout(() => {
420
+ delayTimeout = null;
421
+ !stopped && hass.getServices((err, services) => {
422
+ if (stopped) {
423
+ return;
424
+ }
397
425
  if (err) {
398
426
  adapter.log.error('Cannot read states: ' + err);
399
427
  } else {
@@ -403,8 +431,8 @@ function main() {
403
431
  adapter.subscribeStates('*');
404
432
  });
405
433
  }
406
- }), 100);
407
- }), 100);
434
+ })}, 100);
435
+ })}, 100);
408
436
  });
409
437
  }
410
438
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.hass",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Home Assistant",
5
5
  "author": {
6
6
  "name": "bluefox",
@@ -26,19 +26,25 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "websocket": "^1.0.34",
29
- "ws": "^8.2.1",
30
- "@iobroker/adapter-core": "^2.5.1"
29
+ "ws": "^8.5.0",
30
+ "@iobroker/adapter-core": "^2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@alcalzone/release-script": "^2.2.1",
33
+ "@alcalzone/release-script": "^3.5.6",
34
+ "@alcalzone/release-script-plugin-iobroker": "^3.5.7",
35
+ "@alcalzone/release-script-plugin-license": "^3.5.3",
36
+ "axios": "^0.26.1",
34
37
  "gulp": "^4.0.2",
35
- "mocha": "^9.1.1",
36
- "chai": "^4.3.4"
38
+ "mocha": "^9.2.2",
39
+ "chai": "^4.3.6"
37
40
  },
38
41
  "main": "main.js",
39
42
  "scripts": {
40
43
  "test": "node node_modules/mocha/bin/mocha --exit",
41
- "release": "node node_modules/@alcalzone/release-script/bin/release.js"
44
+ "release": "release-script",
45
+ "release-patch": "release-script patch --yes",
46
+ "release-minor": "release-script minor --yes",
47
+ "release-major": "release-script major --yes"
42
48
  },
43
49
  "bugs": {
44
50
  "url": "https://github.com/ioBroker/ioBroker.hass/issues"
package/admin/index.html DELETED
@@ -1,76 +0,0 @@
1
- <html>
2
- <head>
3
- <link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
4
- <link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
5
-
6
- <script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
7
- <script type="text/javascript" src="../../socket.io/socket.io.js"></script>
8
- <script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>
9
- <script type="text/javascript" src="../../js/translate.js"></script>
10
- <script type="text/javascript" src="../../js/adapter-settings.js"></script>
11
- <script type="text/javascript" src="words.js"></script>
12
-
13
- <script type="text/javascript">
14
-
15
- function load(settings, onChange) {
16
- if (!settings) return;
17
-
18
- if (settings.password === undefined) settings.password = '';
19
- if (settings.prompt === undefined) settings.prompt = 'hass>';
20
-
21
- $('.value').each(function () {
22
- var key = $(this).attr('id');
23
- var $value = $('#' + key + '.value');
24
- if ($value.attr('type') === 'checkbox') {
25
- $value.prop('checked', settings[key]).change(function() {
26
- onChange();
27
- });
28
- } else {
29
- $value.val(settings[key]).change(function() {
30
- onChange();
31
- }).keyup(function() {
32
- onChange();
33
- });
34
- }
35
- });
36
- // Signal to admin, that no changes yet
37
- onChange(false);
38
- }
39
-
40
- function save(callback) {
41
- var obj = {};
42
-
43
- if ($('#password').val() !== $('#passwordRepeat').val()) {
44
- showMessage(_('Passwords missmatch!'), _('Warning'), 'alert');
45
- return;
46
- }
47
-
48
- $('.value').each(function () {
49
- var $this = $(this);
50
- if ($this.attr('type') === 'checkbox') {
51
- obj[$this.attr('id')] = $this.prop('checked');
52
- } else {
53
- obj[$this.attr('id')] = $this.val();
54
- }
55
- });
56
- callback(obj);
57
- }
58
- </script>
59
-
60
- </head>
61
- <body>
62
- <div id="adapter-container">
63
- <table><tr>
64
- <td><img src="hass.png"/></td>
65
- <td><h3 class="translate">FHEM adapter settings</h3></td>
66
- </tr></table>
67
- <table>
68
- <tr><td><label class="translate" for="host">Home assistant IP:</label></td><td class="admin-icon"></td><td><input class="value" id="host" /></td></tr>
69
- <tr><td><label class="translate" for="port">Home assistant WS Port:</label></td><td class="admin-icon"></td><td><input class="value" id="port" size="5" maxlength="5"/></td></tr>
70
- <tr><td><label class="translate" for="password">Password:</label></td><td class="admin-icon"></td><td><input class="value" id="password" type="password"/></td></tr>
71
- <tr><td><label class="translate" for="passwordRepeat">Password repeat:</label></td><td class="admin-icon"></td><td><input type="password" id="passwordRepeat"/></td></tr>
72
- <tr><td><label class="translate" for="secure">Secure:</label></td><td class="admin-icon"></td><td><input class="value" id="secure" type="checkbox"/></td></tr>
73
- </table>
74
- </div>
75
- </body>
76
- </html>