iobroker.lovelace 4.0.5 → 4.0.6

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 CHANGED
@@ -471,6 +471,10 @@ After that checkout modified version in `./build` folder. Then.
471
471
  PLACEHOLDER for next version:
472
472
  ### **WORK IN PROGRESS**
473
473
  -->
474
+ ### 4.0.6 (2023-12-09)
475
+ * (Garfonso) fixed: thermostat card for thermostats without mode / off state
476
+ * (Garfonso) fixed: history and history graph missing for some stuff
477
+
474
478
  ### 4.0.5 (2023-12-09)
475
479
  * (Garfonso) revert shopping list
476
480
  * (Garfonso) prevent invalid date error
@@ -484,9 +488,6 @@ After that checkout modified version in `./build` folder. Then.
484
488
  ### 4.0.2 (2023-12-09)
485
489
  * (Garfonso) fix: crash
486
490
 
487
- ### 4.0.1 (2023-12-08)
488
- * (Garfonso) fix: hideHeader object is writable
489
-
490
491
  ## License
491
492
 
492
493
  Copyright 2019-2023, bluefox <dogafox@gmail.com>
package/io-package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "lovelace",
4
- "version": "4.0.5",
4
+ "version": "4.0.6",
5
5
  "news": {
6
+ "4.0.6": {
7
+ "en": "fixed: thermostat card for thermostats without mode / off state\nfixed: history and history graph missing for some stuff",
8
+ "de": "repariert: thermostatkarte für thermostate ohne modus / aus zustand\nrepariert: history und history diagramm fehlt für einige sachen"
9
+ },
6
10
  "4.0.5": {
7
11
  "en": "revert shopping list (not working right now)\nprevent invalid date error",
8
12
  "de": "Shoppignlist Änderungen rückgängig gemacht (funktionieren nicht)\nungültiger datumsfehler verhindern",
@@ -71,19 +75,6 @@
71
75
  "pl": "Przełom: Przedstawienie do 2023.12.08.1\nZłamanie: wszystkie stany domyślają się do strun. Wyróżnia się kilka wyjątków (np. znaczki czasowe). Wszystko filtruje.\nUżycie lepszych liczb losowych dla tokenów.\nMedia_pause (mini-media-player card play / pause) (ang.).\nWsparcie dla indeksu\nPoprawione wsparcie dla czujnika z urządzenie_class=date\nPrzewidywać się Toolbar from the settings (ang.). Zastosowanie przeglądarki_mod pozwala na kontrolę instancji.\nzremasterowane aktualizacje.\nUżycie przeglądarki_mod do ukrycia bocznego.",
72
76
  "uk": "Перерва: Оновлення переднього до 2023.12.08.1\nПерерва: всі стани за замовчуванням, щоб рядок зараз. Додайте деякі винятки (наприклад, мітки часу). Перевірити фільтри.\nВикористовуйте кращі випадкові номери для жетонів.\nПідтримка медіа_play_pause (міні-медійно-плеєрна картка / пауза) знову.\nПідтримка вхідних_select\nПокращення підтримки датчика з пристроєм_class=date\nВидалити приховати Клапан інструментів з налаштувань. Тепер за допомогою браузера_mod для керування екземпляром.\nвідремонтовані постійні повідомлення.\nВикористовуйте браузер_mod для приховувати бічні панелі.",
73
77
  "zh-cn": "处理:最新战线到2023.12.08.1\n打破:所有国家现在都拖欠会费。 增加一些例外(与时间限制)。 检查你的过滤。.\n使用较随机的数字。.\n支助媒体:互动_pause(媒体角色卡)再次发挥/作用。.\n投入支助\nA. 改善对传感器的支助\n移离掩护 2. 不受环境伤害。 现在使用“代行”来控制。.\n修理了持续通知。.\n使用缩写:为掩护。."
74
- },
75
- "3.0.1": {
76
- "en": "do not crash if no history instance selected.\nnotifications working again.\nrepaired color temperature handling.",
77
- "de": "nicht abstürzen, wenn keine History-Instanz ausgewählt wird.\nBenachrichtigungen funktionieren wieder.\nReparatur der Farbtemperatursteuerung.",
78
- "ru": "не мешайте, если не выбрана пример истории.\nуведомления, которые снова работают.\nотремонтированная обработка цветовой температуры.",
79
- "pt": "não travar se nenhuma instância do histórico selecionada.\nnotificações trabalhando novamente.\ntratamento de temperatura de cor reparado.",
80
- "nl": "niet crashen als geen geschiedenis instance geselecteerd is.\nde berichten werken weer.\ngerepareerde kleurtemperatuur.",
81
- "fr": "ne pas s'écraser si aucune instance historique n'est sélectionnée.\nles notifications fonctionnent à nouveau.\nla manipulation de la température de couleur réparée.",
82
- "it": "non crash se non viene selezionato un'istanza di storia.\nnotifiche che funzionano di nuovo.\ngestione della temperatura del colore riparato.",
83
- "es": "no se estrellen si no se selecciona ningún caso histórico.\nnotificaciones que funcionan de nuevo.\nmanejo de temperatura de color reparado.",
84
- "pl": "nie dochodzi do skutku, jeśli nie zostanie wybrana historia.\nponowne wyniki pracują ponownie.\nremontowany kolorową temperaturę.",
85
- "uk": "не вдається, якщо вибрано екземпляр історії.\nповідомлення про роботу знову.\nобробка кольорової температури.",
86
- "zh-cn": "如果没有选择过历史的事例,就不会发生事故。.\n再次发出通知。.\n修理的气温处理。."
87
78
  }
88
79
  },
89
80
  "title": "Visualization with Lovelace-UI",
@@ -476,6 +476,15 @@ function fillClimateEntityFromStates(states, objects, entity, iobType) {
476
476
  attr.historyParser = (id, val) => { return translateModeNameForLovelace(attr.states ? (attr.states[val] || val) : val); };
477
477
  }
478
478
 
479
+ //add minimal hvac_modes, if none were found from the states above:
480
+ if (!entity.attributes.hvac_modes) {
481
+ if (iobType === typeDetector.Types.airCondition) {
482
+ entity.attributes.hvac_modes = ['cool'];
483
+ } else {
484
+ entity.attributes.hvac_modes = ['heat'];
485
+ }
486
+ }
487
+
479
488
  //defaults:
480
489
  entity.attributes.min_temp = 7;
481
490
  entity.attributes.max_temp = 35;
@@ -1,3 +1,54 @@
1
+ exports.numericDeviceClasses = [
2
+ 'voltage',
3
+ 'sulphur_dioxide',
4
+ 'carbon_dioxide',
5
+ 'current',
6
+ 'volume_storage',
7
+ 'volume',
8
+ 'ozone',
9
+ 'speed',
10
+ 'atmospheric_pressure',
11
+ 'carbon_monoxide',
12
+ 'aqi',
13
+ 'pm25',
14
+ 'nitrogen_monoxide',
15
+ 'power_factor',
16
+ 'pm1',
17
+ 'precipitation',
18
+ 'volatile_organic_compounds',
19
+ 'humidity',
20
+ 'pressure',
21
+ 'battery',
22
+ 'irradiance',
23
+ 'wind_speed',
24
+ 'pm10',
25
+ 'ph',
26
+ 'reactive_power',
27
+ 'temperature',
28
+ 'precipitation_intensity',
29
+ 'sound_pressure',
30
+ 'data_rate',
31
+ 'frequency',
32
+ 'volatile_organic_compounds_parts',
33
+ 'energy',
34
+ 'apparent_power',
35
+ 'weight',
36
+ 'duration',
37
+ 'gas',
38
+ 'water',
39
+ 'power',
40
+ 'monetary',
41
+ 'signal_strength',
42
+ 'data_size',
43
+ 'energy_storage',
44
+ 'nitrogen_dioxide',
45
+ 'nitrous_oxide',
46
+ 'illuminance',
47
+ 'moisture',
48
+ 'distance'
49
+ ];
50
+
51
+ const numericDeviceClassesIob = exports.numericDeviceClasses.concat(['timestamp']);
1
52
 
2
53
  exports.iobState2EntityState = function (entity, val, attribute) {
3
54
  let type = entity.context.type;
@@ -10,8 +61,8 @@ exports.iobState2EntityState = function (entity, val, attribute) {
10
61
  return val ? 'on' : 'off';
11
62
  } else if (type === 'binary_sensor') {
12
63
  return val ? 'on' : 'off';
13
- } else if (typeof val === 'number' && entity.attributes && ['timestamp'].includes(entity.attributes.device_class)) {
14
- return val; //do not convert timestamps.
64
+ } else if (typeof val === 'number' && entity.attributes && (numericDeviceClassesIob.includes(entity.attributes.device_class) || entity.attributes.unit_of_measurement)) {
65
+ return val; //do not convert timestamps or values that have a unit of measurement..
15
66
  } else if (typeof val === 'number' && entity.attributes && ['date'].includes(entity.attributes.device_class)) {
16
67
  const dateStr = new Date(val).toDateString(); //convert to date string
17
68
  return dateStr === 'Invalid Date' ? 'unknown' : dateStr;
package/lib/server.js CHANGED
@@ -31,6 +31,7 @@ const entityData = require('./dataSingleton');
31
31
  const bindings = require('./bindings');
32
32
  const getFriendlyName = require('./entities/friendly_name').getFriendlyName;
33
33
  const iobState2EntityState = require('./converters/genericConverter').iobState2EntityState;
34
+ const NUMERIC_DEVICE_CLASSES = require('./converters/genericConverter').numericDeviceClasses;
34
35
  const HistoryModule = require('./modules/history');
35
36
  const ConversationModule = require('./modules/conversation');
36
37
  const LogbookModule = require('./modules/logbook');
@@ -2472,6 +2473,9 @@ class WebServer {
2472
2473
  };
2473
2474
  ws.send(JSON.stringify(t));
2474
2475
  });
2476
+ } else if (message.type === 'sensor/numeric_device_classes') {
2477
+ //it seems frontend now asks backend for what device_classes are numeric. Ok. Let's use that. ;-)
2478
+ this._sendResponse(ws, message.id, { numeric_device_classes: NUMERIC_DEVICE_CLASSES });
2475
2479
  } else if (message.type.startsWith('browser_mod')) {
2476
2480
  await this._browserMod.processBrowserModMessage(ws, message);
2477
2481
  } else if (message.type.startsWith('history/')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.lovelace",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI",
5
5
  "author": {
6
6
  "name": "bluefox",