iobroker.lovelace 4.1.2 → 4.1.4
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/README.md +8 -6
- package/io-package.json +63 -9
- package/lib/converters/light.js +30 -0
- package/lib/dataSingleton.js +1 -0
- package/lib/modules/browser_mod.js +1 -1
- package/lib/modules/logbook.js +10 -8
- package/lib/server.js +24 -20
- package/main.js +2 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -473,6 +473,14 @@ After that checkout modified version in `./build` folder. Then.
|
|
|
473
473
|
PLACEHOLDER for next version:
|
|
474
474
|
### **WORK IN PROGRESS**
|
|
475
475
|
-->
|
|
476
|
+
### 4.1.4 (2024-02-10)
|
|
477
|
+
* (Garfonso) improved fix: lamp icons now turn gray on switch off.
|
|
478
|
+
|
|
479
|
+
### 4.1.3 (2024-02-10)
|
|
480
|
+
* (Garfonso) prevent warning for browser_mod/recall_id service call
|
|
481
|
+
* (Garfonso) fix: lamp icons now turn gray on switch off.
|
|
482
|
+
* (Garfonso) fix: notifications via sendTo work again.
|
|
483
|
+
|
|
476
484
|
### 4.1.2 (2024-01-09)
|
|
477
485
|
* (Garfonso) fix: time in timestamp display
|
|
478
486
|
|
|
@@ -485,12 +493,6 @@ After that checkout modified version in `./build` folder. Then.
|
|
|
485
493
|
### 4.1.0 (2023-12-18)
|
|
486
494
|
* (Garfons) add an option to show users on login screen (off by default)
|
|
487
495
|
|
|
488
|
-
### 4.0.12 (2023-12-15)
|
|
489
|
-
* (Garfonso) fix lint errors
|
|
490
|
-
|
|
491
|
-
### 4.0.11 (2023-12-15)
|
|
492
|
-
* (Garfonso) updated dependencies
|
|
493
|
-
|
|
494
496
|
## License
|
|
495
497
|
|
|
496
498
|
Copyright 2019-2024, bluefox <dogafox@gmail.com>
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "lovelace",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.4",
|
|
5
5
|
"news": {
|
|
6
|
+
"4.1.4": {
|
|
7
|
+
"en": "improved fix: lamp icons now turn gray on switch off.",
|
|
8
|
+
"de": "verbesserter fix: lampensymbole werden nun grau beim ausschalten."
|
|
9
|
+
},
|
|
10
|
+
"4.1.3": {
|
|
11
|
+
"en": "prevent warning for browser_mod/recall_id service call\nfix: lamp icons now turn gray on switch off.\nfix: notifications via sendTo work again.",
|
|
12
|
+
"de": "Verhindere warnung für browser_mod/recall_id service call\nfix: Lampensymbole werden nun grau beim ausschalten.\nfix: Benachrichtigung mittels sendTo funktionieren wieder."
|
|
13
|
+
},
|
|
6
14
|
"4.1.2": {
|
|
7
15
|
"en": "fix: time in timestamp display",
|
|
8
16
|
"de": "fix: zeit im zeitstempel-display",
|
|
@@ -49,14 +57,6 @@
|
|
|
49
57
|
"pl": "zależności aktualizacji",
|
|
50
58
|
"uk": "оновлені залежності",
|
|
51
59
|
"zh-cn": "二. 最新依赖"
|
|
52
|
-
},
|
|
53
|
-
"4.0.10": {
|
|
54
|
-
"en": "brought back shopping list. Now also supports shopping/todo lists from manual entities.\nfix: browser console errors\nfix: login & authorization\nadded: user images & names on login screen",
|
|
55
|
-
"de": "Einkaufsliste funktioniert wieder. Zusätzliche Shopping/Todo-Listen können als manuellen Entities angelegt werden.\nfix: browser fehler\nfix: anmeldung & autorisierung\nhinzugefügt: benutzerbilder & namen auf login-bildschirm"
|
|
56
|
-
},
|
|
57
|
-
"4.0.9": {
|
|
58
|
-
"en": "fixed: timestamp in legacy history data",
|
|
59
|
-
"de": "fixed: zeitstempel in alten History daten"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"title": "Visualization with Lovelace-UI",
|
|
@@ -175,6 +175,60 @@
|
|
|
175
175
|
"agree",
|
|
176
176
|
"cancel"
|
|
177
177
|
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"condition": {
|
|
181
|
+
"operand": "and",
|
|
182
|
+
"rules": [
|
|
183
|
+
"oldVersion<=3.0.0",
|
|
184
|
+
"newVersion>=4.0.0"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"title": {
|
|
188
|
+
"en": "Visualisation Update",
|
|
189
|
+
"de": "Aktualisierung der Visualisierung",
|
|
190
|
+
"ru": "Обновление визуализации",
|
|
191
|
+
"pt": "Atualização da visualização",
|
|
192
|
+
"nl": "Visualisatie Update",
|
|
193
|
+
"fr": "Mise à jour de la visualisation",
|
|
194
|
+
"it": "Aggiornamento della visualizzazione",
|
|
195
|
+
"es": "Actualización de Visualización",
|
|
196
|
+
"pl": "Visualizacja",
|
|
197
|
+
"uk": "Оновлення візуалізації",
|
|
198
|
+
"zh-cn": "更新"
|
|
199
|
+
},
|
|
200
|
+
"text": {
|
|
201
|
+
"en": "The update to version 4.x will change the frontend version from 20221026.0 to 20231208.2. This implies many months of Lovelace development in a single update. You will likely need to update or fix your themes and custom cards. Make sure to review your visualization after this update. Seek help in the forum or Discord if needed.",
|
|
202
|
+
"de": "Das Update auf Version 4.x wird die Frontend Version von 20221026.0 auf 20231208.2 ändern. Dies bedeutet 10 Monate Entwicklung von Lovelace in einem Update. Sie müssen wahrscheinlich Ihre Themen und benutzerdefinierten Karten aktualisieren oder reparieren. Achten Sie darauf, Ihre Visualisierung nach diesem Update zu überprüfen. Fragen Sie im Forum oder Discord nach Hilfe.",
|
|
203
|
+
"ru": "Обновление до версии 4.x изменит версию интерфейса с 20221026.0 на 20231208.2. Это означает многомесячную разработку Lovelace в рамках одного обновления. Вам, вероятно, придется обновить или исправить свои темы и пользовательские карты. Обязательно проверьте свою визуализацию после этого обновления. Задавайте вопросы на форуме или в Discord, если вам нужна помощь.",
|
|
204
|
+
"pt": "A atualização para a versão 4.x irá alterar a versão do frontend de 20221026.0 para 20231208.2. Isso significa muitos meses de desenvolvimento do Lovelace em uma única atualização. Você provavelmente precisará atualizar ou corrigir seus temas e cartões personalizados. Certifique-se de verificar sua visualização após esta atualização. Procure ajuda no fórum ou no Discord, se necessário.",
|
|
205
|
+
"nl": "De update naar versie 4.x zal de frontend-versie veranderen van 20221026.0 naar 20231208.2. Dit betekent vele maanden ontwikkeling van Lovelace in één update. Waarschijnlijk moet u uw thema's en aangepaste kaarten bijwerken of herstellen. Controleer na deze update uw visualisatie. Vraag om hulp op het forum of Discord indien nodig.",
|
|
206
|
+
"fr": "La mise à jour vers la version 4.x changera la version du frontend de 20221026.0 à 20231208.2. Cela signifie plusieurs mois de développement de Lovelace en une seule mise à jour. Vous devrez probablement mettre à jour ou réparer vos thèmes et cartes personnalisées. Assurez-vous de vérifier votre visualisation après cette mise à jour. Demandez de l'aide sur le forum ou sur Discord si nécessaire.",
|
|
207
|
+
"it": "L'aggiornamento alla versione 4.x cambierà la versione del frontend da 20221026.0 a 20231208.2. Ciò significa molti mesi di sviluppo di Lovelace in un singolo aggiornamento. Probabilmente sarà necessario aggiornare o correggere i temi e le carte personalizzate. Assicurati di controllare la tua visualizzazione dopo questo aggiornamento. Chiedi aiuto sul forum o su Discord se necessario.",
|
|
208
|
+
"es": "La actualización a la versión 4.x cambiará la versión del frontend de 20221026.0 a 20231208.2. Esto significa muchos meses de desarrollo de Lovelace en una sola actualización. Probablemente necesitarás actualizar o corregir tus temas y tarjetas personalizadas. Asegúrate de revisar tu visualización después de esta actualización. Busca ayuda en el foro o en Discord si es necesario.",
|
|
209
|
+
"pl": "Aktualizacja do wersji 4.x zmieni wersję frontendu z 20221026.0 na 20231208.2. Oznacza to wiele miesięcy rozwoju Lovelace w jednej aktualizacji. Prawdopodobnie będziesz musiał zaktualizować lub naprawić swoje motywy i niestandardowe karty. Upewnij się, że sprawdzisz swoją wizualizację po tej aktualizacji. Szukaj pomocy na forum lub Discord, jeśli to konieczne.",
|
|
210
|
+
"uk": "Оновлення до версії 4.x змінить версію фронтенду з 20221026.0 на 20231208.2. Це означає багато місяців розробки Lovelace у одному оновленні. Ймовірно, вам доведеться оновити або виправити свої теми та власні картки. Переконайтеся, що після цього оновлення ви переглянете свою візуалізацію. Звертайтеся за допомогою на форумі або в Discord, якщо потрібно.",
|
|
211
|
+
"zh-cn": "升级到4.x版本将把前端版本从20221026.0更改为20231208.2。这意味着在一个更新中进行了数月的Lovelace开发。您可能需要更新或修复您的主题和自定义卡片。请确保在此更新后检查您的可视化。如有需要,请在论坛或Discord上寻求帮助。"
|
|
212
|
+
},
|
|
213
|
+
"link": "https://forum.iobroker.net/topic/59435/test-lovelace-4-x/408?_=1705695186248",
|
|
214
|
+
"level": "warn",
|
|
215
|
+
"linkText": {
|
|
216
|
+
"en": "A few issues with themes were already discussed here.",
|
|
217
|
+
"de": "Hier wurden bereits einige Themen diskutiert.",
|
|
218
|
+
"ru": "Здесь уже обсуждались несколько вопросов с темами.",
|
|
219
|
+
"pt": "Algumas questões com temas já foram discutidas aqui.",
|
|
220
|
+
"nl": "Een paar problemen met ze werden hier al besproken.",
|
|
221
|
+
"fr": "Quelques questions avec des thèmes ont déjà été discutées ici.",
|
|
222
|
+
"it": "Sono già state discusse alcune questioni con temi.",
|
|
223
|
+
"es": "Algunos temas con temas ya se discutieron aquí.",
|
|
224
|
+
"pl": "Omawiano tam kilka tematów.",
|
|
225
|
+
"uk": "Тут вже обговорювалися кілька питань з темами.",
|
|
226
|
+
"zh-cn": "这里已经讨论了几个专题的问题。."
|
|
227
|
+
},
|
|
228
|
+
"buttons": [
|
|
229
|
+
"agree",
|
|
230
|
+
"cancel"
|
|
231
|
+
]
|
|
178
232
|
}
|
|
179
233
|
],
|
|
180
234
|
"dependencies": [
|
package/lib/converters/light.js
CHANGED
|
@@ -42,8 +42,38 @@ const SUPPORT_EFFECT = 4;
|
|
|
42
42
|
//const SUPPORT_FLASH = 8;
|
|
43
43
|
//const SUPPORT_TRANSITION = 32;
|
|
44
44
|
|
|
45
|
+
const attributesToNullOnOff = ['color_mode', 'brightness', 'color_temp', 'hs_color', 'rgb_color', 'rgbw_color', 'xy_color', 'effect'];
|
|
46
|
+
|
|
45
47
|
function _lightAdvancedAddState(states, objects, entity) {
|
|
46
48
|
const getState = states.stateRead;
|
|
49
|
+
|
|
50
|
+
//for advanced lights, clear attributes, so frontend doesn't still show them.
|
|
51
|
+
entity.context.STATE.storedValues = {};
|
|
52
|
+
entity.context.STATE.getParser = (entity, attr, state) => {
|
|
53
|
+
if (!state) {
|
|
54
|
+
state = {val: null};
|
|
55
|
+
}
|
|
56
|
+
const oldState = entity.state;
|
|
57
|
+
entity.state = state.val ? 'on' : 'off';
|
|
58
|
+
if (!state.val && oldState === 'on') {
|
|
59
|
+
for (const attr of attributesToNullOnOff) {
|
|
60
|
+
if (entity.attributes[attr] !== undefined) {
|
|
61
|
+
entity.context.STATE.storedValues[attr] = entity.attributes[attr];
|
|
62
|
+
entity.attributes[attr] = null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
adapterData.log.debug(`Stored old values for next switch on: ${JSON.stringify(entity.context.STATE.storedValues)}`);
|
|
66
|
+
}
|
|
67
|
+
if (state.val && oldState !== 'on') {
|
|
68
|
+
for (const attr of attributesToNullOnOff) {
|
|
69
|
+
if (entity.attributes[attr] === null) { //make sure the attribute was not yet read from somewhere else
|
|
70
|
+
entity.attributes[attr] = entity.context.STATE.storedValues[attr];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
adapterData.log.debug(`Restored old values from previous switch off: ${JSON.stringify(entity.context.STATE.storedValues)}`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
47
77
|
//prevent zigbee 'available' to become getId:
|
|
48
78
|
if (getState && getState.startsWith('zigbee.') && (getState.endsWith('.available') || getState.endsWith('.device_query'))) {
|
|
49
79
|
entity.context.STATE.getId = states.state;
|
package/lib/dataSingleton.js
CHANGED
|
@@ -5,6 +5,7 @@ module.exports = {
|
|
|
5
5
|
iobID2entity: {}, //find entities (array) by ioBroker-object id.
|
|
6
6
|
entityId2Entity: {}, //find entity by entity_id.
|
|
7
7
|
adapter: {}, //adapter object
|
|
8
|
+
server: {}, //lovelace-web server object
|
|
8
9
|
log: {}, //log object
|
|
9
10
|
lang: 'en', //configured language
|
|
10
11
|
words: {}, //translation via words.json
|
|
@@ -323,7 +323,7 @@ class BrowserModModule {
|
|
|
323
323
|
// console.log('Incoming browser_mod message:');
|
|
324
324
|
// console.dir(message, {depth: null});
|
|
325
325
|
|
|
326
|
-
if (!message.browserID) {
|
|
326
|
+
if (!message.browserID && method !== 'recall_id') {
|
|
327
327
|
this.adapter.log.warn('No browser ID in browser_mod request: ' + JSON.stringify(message));
|
|
328
328
|
return;
|
|
329
329
|
}
|
package/lib/modules/logbook.js
CHANGED
|
@@ -154,14 +154,16 @@ class LogbookModule {
|
|
|
154
154
|
this.sendLogbookResponse(ws, message.id, startTime, endTime, results, true);
|
|
155
155
|
setTimeout(() => this.sendLogbookResponse(ws, message.id, startTime, endTime, []), 300);
|
|
156
156
|
//keep subscription and id:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
if (ws._subscribes.logbook) {
|
|
158
|
+
const subscription = ws._subscribes.logbook.find(entry => entry.id === Number(message.id));
|
|
159
|
+
if (subscription) {
|
|
160
|
+
subscription.idsToWatch = subscription.idsToWatch.concat(idsToWatch);
|
|
161
|
+
} else {
|
|
162
|
+
ws._subscribes.logbook.push({
|
|
163
|
+
id: Number(message.id),
|
|
164
|
+
idsToWatch: idsToWatch
|
|
165
|
+
});
|
|
166
|
+
}
|
|
165
167
|
}
|
|
166
168
|
} catch (e) {
|
|
167
169
|
this.adapter.log.error('Could not create logbook answer: ' + e.stack);
|
package/lib/server.js
CHANGED
|
@@ -135,6 +135,7 @@ class WebServer {
|
|
|
135
135
|
entityData.adapter = this.adapter;
|
|
136
136
|
entityData.log = this.adapter.log;
|
|
137
137
|
entityData.words = this.words;
|
|
138
|
+
entityData.server = this;
|
|
138
139
|
|
|
139
140
|
this._subscribed = [];
|
|
140
141
|
this._server = options.server;
|
|
@@ -807,26 +808,7 @@ class WebServer {
|
|
|
807
808
|
return; //nothing happened -> do not notify UI.
|
|
808
809
|
}
|
|
809
810
|
|
|
810
|
-
|
|
811
|
-
type: 'event',
|
|
812
|
-
event: {
|
|
813
|
-
a: {
|
|
814
|
-
},
|
|
815
|
-
event_type: 'subscribe_entities',
|
|
816
|
-
origin: 'LOCAL',
|
|
817
|
-
time_fired: (state ? state.ts : Date.now()) / 1000
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
t.event.a[entity.entity_id] = this._getShortEntity(entity);
|
|
821
|
-
|
|
822
|
-
this._wss && this._wss.clients.forEach(ws => {
|
|
823
|
-
if (ws._subscribes && ws._subscribes.subscribe_entities) {
|
|
824
|
-
ws._subscribes.subscribe_entities.forEach(id => {
|
|
825
|
-
t.id = id;
|
|
826
|
-
ws.send(JSON.stringify(t));
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
});
|
|
811
|
+
this.updateEntityInFrontend(entity, state);
|
|
830
812
|
|
|
831
813
|
});
|
|
832
814
|
}
|
|
@@ -839,6 +821,28 @@ class WebServer {
|
|
|
839
821
|
}
|
|
840
822
|
}
|
|
841
823
|
|
|
824
|
+
updateEntityInFrontend(entity, state) {
|
|
825
|
+
const t = {
|
|
826
|
+
type: 'event',
|
|
827
|
+
event: {
|
|
828
|
+
a: {},
|
|
829
|
+
event_type: 'subscribe_entities',
|
|
830
|
+
origin: 'LOCAL',
|
|
831
|
+
time_fired: (state ? state.ts : Date.now()) / 1000
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
t.event.a[entity.entity_id] = this._getShortEntity(entity);
|
|
835
|
+
|
|
836
|
+
this._wss && this._wss.clients.forEach(ws => {
|
|
837
|
+
if (ws._subscribes && ws._subscribes.subscribe_entities) {
|
|
838
|
+
ws._subscribes.subscribe_entities.forEach(id => {
|
|
839
|
+
t.id = id;
|
|
840
|
+
ws.send(JSON.stringify(t));
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
|
|
842
846
|
// ------------------------------- END OF CONVERTERS ---------------------------------------- //
|
|
843
847
|
|
|
844
848
|
async _processIobState(ids, objects, id, roomName, funcName, result, forcedEntityId) {
|
package/main.js
CHANGED
|
@@ -62,7 +62,8 @@ function startAdapter(options) {
|
|
|
62
62
|
if (obj.command === 'browse') {
|
|
63
63
|
obj.callback && adapter.sendTo(obj.from, obj.command, adapter.apiServer.getHassStates(), obj.callback);
|
|
64
64
|
} else if (obj.command === 'send') {
|
|
65
|
-
|
|
65
|
+
//*cough*
|
|
66
|
+
adapter.apiServer.onStateChange(adapter.namespace + '.notifications.add', {val: obj.message, ack: false}).then(list =>
|
|
66
67
|
obj.callback && adapter.sendTo(obj.from, obj.command, list, obj.callback));
|
|
67
68
|
} else if (obj.command === 'checkIdForDuplicates') {
|
|
68
69
|
if (obj.callback) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.lovelace",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"description": "With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "bluefox",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@iobroker/adapter-core": "^3.0.4",
|
|
23
|
-
"axios": "^1.6.
|
|
23
|
+
"axios": "^1.6.7",
|
|
24
24
|
"body-parser": "^1.20.2",
|
|
25
25
|
"express": "^4.18.2",
|
|
26
26
|
"iobroker.type-detector": "^3.0.5",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/mocha": "^10.0.6",
|
|
47
47
|
"@types/node": "^16.18.69 < 17",
|
|
48
48
|
"@types/proxyquire": "^1.3.31",
|
|
49
|
-
"@types/sinon": "^17.0.
|
|
49
|
+
"@types/sinon": "^17.0.3",
|
|
50
50
|
"@types/sinon-chai": "^3.2.12",
|
|
51
51
|
"chai": "^4.3.10",
|
|
52
52
|
"chai-as-promised": "^7.1.1",
|