iobroker.sonoff 4.0.0 → 4.2.1

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.
@@ -0,0 +1,61 @@
1
+ {
2
+ "Relays & Switches": "Relés e interruptores",
3
+ "Lights & Dimmers": "Luzes e reguladores",
4
+ "Shutters & Covers": "Persianas e toldos",
5
+ "Zigbee bridges": "Pontes Zigbee",
6
+ "Energy Meters": "Contadores de energia",
7
+ "Sensors": "Sensores",
8
+ "Other": "Outros",
9
+ "Settings": "Definições",
10
+ "Rename this device": "Renomear este dispositivo",
11
+ "Enter new name": "Introduzir novo nome",
12
+ "Delete and recreate all data points of this device": "Eliminar e recriar todos os pontos de dados deste dispositivo",
13
+ "This deletes all data points of this device (except its name). They will be recreated automatically the next time the device reports its state. Continue?": "Isto elimina todos os pontos de dados deste dispositivo (exceto o nome). Serão recriados automaticamente da próxima vez que o dispositivo comunicar o seu estado. Continuar?",
14
+ "Open device web interface": "Abrir a interface web do dispositivo",
15
+ "Device ID": "ID do dispositivo",
16
+ "RSSI": "RSSI",
17
+ "Uptime": "Tempo de atividade",
18
+ "Power": "Potência",
19
+ "Power metering": "Medição de potência",
20
+ "Thresholds": "Limiares",
21
+ "Digital inputs": "Entradas digitais",
22
+ "Color": "Cor",
23
+ "Dimmer": "Regulador",
24
+ "Color temperature": "Temperatura de cor",
25
+ "Temperature": "Temperatura",
26
+ "Humidity": "Humidade",
27
+ "Pressure": "Pressão",
28
+ "Illuminance": "Iluminância",
29
+ "CO2": "CO2",
30
+ "TVOC": "TVOC",
31
+ "Dew point": "Ponto de orvalho",
32
+ "Voltage": "Tensão",
33
+ "Current": "Corrente",
34
+ "Neutral current": "Corrente de neutro",
35
+ "Apparent power": "Potência aparente",
36
+ "Reactive power": "Potência reativa",
37
+ "Power factor": "Fator de potência",
38
+ "Frequency": "Frequência",
39
+ "Today": "Hoje",
40
+ "Today (import)": "Hoje (consumo)",
41
+ "Today (export)": "Hoje (injeção)",
42
+ "Yesterday": "Ontem",
43
+ "Total": "Total",
44
+ "Total (import)": "Total (consumo)",
45
+ "Total (export)": "Total (injeção)",
46
+ "Returned energy": "Energia injetada",
47
+ "Power low threshold": "Limiar inferior de potência",
48
+ "Power high threshold": "Limiar superior de potência",
49
+ "Power delta threshold": "Limiar delta de potência",
50
+ "Model": "Modelo",
51
+ "Hostname": "Nome do host",
52
+ "IP address": "Endereço IP",
53
+ "MAC address": "Endereço MAC",
54
+ "Gateway": "Gateway",
55
+ "Subnet mask": "Máscara de sub-rede",
56
+ "Firmware version": "Versão do firmware",
57
+ "Hardware": "Hardware",
58
+ "Build date": "Data de compilação",
59
+ "Core": "Core",
60
+ "SDK": "SDK"
61
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "Relays & Switches": "Реле и выключатели",
3
+ "Lights & Dimmers": "Освещение и диммеры",
4
+ "Shutters & Covers": "Жалюзи и рольставни",
5
+ "Zigbee bridges": "Zigbee-шлюзы",
6
+ "Energy Meters": "Счётчики энергии",
7
+ "Sensors": "Датчики",
8
+ "Other": "Прочее",
9
+ "Settings": "Настройки",
10
+ "Rename this device": "Переименовать это устройство",
11
+ "Enter new name": "Введите новое имя",
12
+ "Delete and recreate all data points of this device": "Удалить и создать заново все точки данных этого устройства",
13
+ "This deletes all data points of this device (except its name). They will be recreated automatically the next time the device reports its state. Continue?": "Будут удалены все точки данных этого устройства (кроме его имени). Они будут созданы заново автоматически, как только устройство в следующий раз сообщит своё состояние. Продолжить?",
14
+ "Open device web interface": "Открыть веб-интерфейс устройства",
15
+ "Device ID": "ID устройства",
16
+ "RSSI": "RSSI",
17
+ "Uptime": "Время работы",
18
+ "Power": "Мощность",
19
+ "Power metering": "Измерение мощности",
20
+ "Thresholds": "Пороговые значения",
21
+ "Digital inputs": "Дискретные входы",
22
+ "Color": "Цвет",
23
+ "Dimmer": "Диммер",
24
+ "Color temperature": "Цветовая температура",
25
+ "Temperature": "Температура",
26
+ "Humidity": "Влажность",
27
+ "Pressure": "Давление",
28
+ "Illuminance": "Освещённость",
29
+ "CO2": "CO2",
30
+ "TVOC": "ЛОС",
31
+ "Dew point": "Точка росы",
32
+ "Voltage": "Напряжение",
33
+ "Current": "Ток",
34
+ "Neutral current": "Ток нейтрали",
35
+ "Apparent power": "Полная мощность",
36
+ "Reactive power": "Реактивная мощность",
37
+ "Power factor": "Коэффициент мощности",
38
+ "Frequency": "Частота",
39
+ "Today": "Сегодня",
40
+ "Today (import)": "Сегодня (потребление)",
41
+ "Today (export)": "Сегодня (отдача)",
42
+ "Yesterday": "Вчера",
43
+ "Total": "Всего",
44
+ "Total (import)": "Всего (потребление)",
45
+ "Total (export)": "Всего (отдача)",
46
+ "Returned energy": "Отданная энергия",
47
+ "Power low threshold": "Нижний порог мощности",
48
+ "Power high threshold": "Верхний порог мощности",
49
+ "Power delta threshold": "Порог изменения мощности",
50
+ "Model": "Модель",
51
+ "Hostname": "Имя хоста",
52
+ "IP address": "IP-адрес",
53
+ "MAC address": "MAC-адрес",
54
+ "Gateway": "Шлюз",
55
+ "Subnet mask": "Маска подсети",
56
+ "Firmware version": "Версия прошивки",
57
+ "Hardware": "Оборудование",
58
+ "Build date": "Дата сборки",
59
+ "Core": "Core",
60
+ "SDK": "SDK"
61
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "Relays & Switches": "Реле та вимикачі",
3
+ "Lights & Dimmers": "Освітлення та димери",
4
+ "Shutters & Covers": "Жалюзі та ролети",
5
+ "Zigbee bridges": "Zigbee-шлюзи",
6
+ "Energy Meters": "Лічильники енергії",
7
+ "Sensors": "Датчики",
8
+ "Other": "Інше",
9
+ "Settings": "Налаштування",
10
+ "Rename this device": "Перейменувати цей пристрій",
11
+ "Enter new name": "Введіть нову назву",
12
+ "Delete and recreate all data points of this device": "Видалити та створити заново всі точки даних цього пристрою",
13
+ "This deletes all data points of this device (except its name). They will be recreated automatically the next time the device reports its state. Continue?": "Буде видалено всі точки даних цього пристрою (крім його назви). Вони будуть створені заново автоматично, щойно пристрій наступного разу повідомить свій стан. Продовжити?",
14
+ "Open device web interface": "Відкрити вебінтерфейс пристрою",
15
+ "Device ID": "ID пристрою",
16
+ "RSSI": "RSSI",
17
+ "Uptime": "Час роботи",
18
+ "Power": "Потужність",
19
+ "Power metering": "Вимірювання потужності",
20
+ "Thresholds": "Порогові значення",
21
+ "Digital inputs": "Дискретні входи",
22
+ "Color": "Колір",
23
+ "Dimmer": "Димер",
24
+ "Color temperature": "Колірна температура",
25
+ "Temperature": "Температура",
26
+ "Humidity": "Вологість",
27
+ "Pressure": "Тиск",
28
+ "Illuminance": "Освітленість",
29
+ "CO2": "CO2",
30
+ "TVOC": "ЛОС",
31
+ "Dew point": "Точка роси",
32
+ "Voltage": "Напруга",
33
+ "Current": "Струм",
34
+ "Neutral current": "Струм нейтралі",
35
+ "Apparent power": "Повна потужність",
36
+ "Reactive power": "Реактивна потужність",
37
+ "Power factor": "Коефіцієнт потужності",
38
+ "Frequency": "Частота",
39
+ "Today": "Сьогодні",
40
+ "Today (import)": "Сьогодні (споживання)",
41
+ "Today (export)": "Сьогодні (віддача)",
42
+ "Yesterday": "Учора",
43
+ "Total": "Разом",
44
+ "Total (import)": "Разом (споживання)",
45
+ "Total (export)": "Разом (віддача)",
46
+ "Returned energy": "Віддана енергія",
47
+ "Power low threshold": "Нижній поріг потужності",
48
+ "Power high threshold": "Верхній поріг потужності",
49
+ "Power delta threshold": "Поріг зміни потужності",
50
+ "Model": "Модель",
51
+ "Hostname": "Ім'я хоста",
52
+ "IP address": "IP-адреса",
53
+ "MAC address": "MAC-адреса",
54
+ "Gateway": "Шлюз",
55
+ "Subnet mask": "Маска підмережі",
56
+ "Firmware version": "Версія прошивки",
57
+ "Hardware": "Обладнання",
58
+ "Build date": "Дата збірки",
59
+ "Core": "Core",
60
+ "SDK": "SDK"
61
+ }
@@ -0,0 +1,61 @@
1
+ {
2
+ "Relays & Switches": "继电器和开关",
3
+ "Lights & Dimmers": "灯光和调光器",
4
+ "Shutters & Covers": "卷帘和遮阳",
5
+ "Zigbee bridges": "Zigbee 网关",
6
+ "Energy Meters": "电能表",
7
+ "Sensors": "传感器",
8
+ "Other": "其他",
9
+ "Settings": "设置",
10
+ "Rename this device": "重命名此设备",
11
+ "Enter new name": "输入新名称",
12
+ "Delete and recreate all data points of this device": "删除并重新创建此设备的所有数据点",
13
+ "This deletes all data points of this device (except its name). They will be recreated automatically the next time the device reports its state. Continue?": "这将删除此设备的所有数据点(名称除外)。当设备下次上报状态时,它们会自动重新创建。是否继续?",
14
+ "Open device web interface": "打开设备网页界面",
15
+ "Device ID": "设备 ID",
16
+ "RSSI": "RSSI",
17
+ "Uptime": "运行时间",
18
+ "Power": "功率",
19
+ "Power metering": "功率测量",
20
+ "Thresholds": "阈值",
21
+ "Digital inputs": "数字输入",
22
+ "Color": "颜色",
23
+ "Dimmer": "调光器",
24
+ "Color temperature": "色温",
25
+ "Temperature": "温度",
26
+ "Humidity": "湿度",
27
+ "Pressure": "气压",
28
+ "Illuminance": "照度",
29
+ "CO2": "CO2",
30
+ "TVOC": "TVOC",
31
+ "Dew point": "露点",
32
+ "Voltage": "电压",
33
+ "Current": "电流",
34
+ "Neutral current": "中性线电流",
35
+ "Apparent power": "视在功率",
36
+ "Reactive power": "无功功率",
37
+ "Power factor": "功率因数",
38
+ "Frequency": "频率",
39
+ "Today": "今日",
40
+ "Today (import)": "今日(用电)",
41
+ "Today (export)": "今日(上网)",
42
+ "Yesterday": "昨日",
43
+ "Total": "总计",
44
+ "Total (import)": "总计(用电)",
45
+ "Total (export)": "总计(上网)",
46
+ "Returned energy": "上网电量",
47
+ "Power low threshold": "功率下限阈值",
48
+ "Power high threshold": "功率上限阈值",
49
+ "Power delta threshold": "功率变化阈值",
50
+ "Model": "型号",
51
+ "Hostname": "主机名",
52
+ "IP address": "IP 地址",
53
+ "MAC address": "MAC 地址",
54
+ "Gateway": "网关",
55
+ "Subnet mask": "子网掩码",
56
+ "Firmware version": "固件版本",
57
+ "Hardware": "硬件",
58
+ "Build date": "构建日期",
59
+ "Core": "Core",
60
+ "SDK": "SDK"
61
+ }
@@ -214,9 +214,30 @@ class MQTTBase {
214
214
  this.processTasks().catch(err => this.adapter.log.error(err));
215
215
  }
216
216
  }
217
+ /**
218
+ * Finds the device channel (the `iobId` of its client) a state belongs to. That is not simply the
219
+ * first segment after "<namespace>.": the state can be nested (e.g. "STATE.POWER1" with "Create
220
+ * object tree" on), and a client ID may contain dots itself, as `FORBIDDEN_CHARS` keeps them. So
221
+ * the longest leading path that belongs to a known client wins - the first segment is only the
222
+ * fallback for a client that is not connected.
223
+ *
224
+ * @param id full state ID, e.g. "sonoff.0.DVES_123456.STATE.POWER1"
225
+ */
226
+ getChannelId(id) {
227
+ const parts = id.substring(this.adapter.namespace.length + 1).split('.');
228
+ // The last segment is the data point itself, never part of the channel
229
+ for (let i = parts.length - 1; i > 1; i--) {
230
+ const channelId = parts.slice(0, i).join('.');
231
+ if (this.mappingClients[channelId]) {
232
+ return channelId;
233
+ }
234
+ }
235
+ return parts[0];
236
+ }
217
237
  async onStateChangedColors(id, state, channelId, stateId) {
218
238
  if (!channelId) {
219
239
  const parts = id.split('.');
240
+ channelId = this.getChannelId(id);
220
241
  stateId = parts.pop() || '';
221
242
  if (stateId === 'level' ||
222
243
  stateId === 'state' ||
@@ -225,7 +246,6 @@ class MQTTBase {
225
246
  stateId === 'green') {
226
247
  stateId = `${parts.pop()}.${stateId}`;
227
248
  }
228
- channelId = parts.splice(2, parts.length).join('.');
229
249
  }
230
250
  const ledModeIdExor = `${this.adapter.namespace}.${channelId}.modeLedExor`;
231
251
  if (this.cachedModeExor[ledModeIdExor] === undefined) {
@@ -555,9 +575,8 @@ class MQTTBase {
555
575
  this.adapter.log.debug(`onStateChange ${id}: ${JSON.stringify(state)}`);
556
576
  if (state && !state.ack) {
557
577
  // find client.id
558
- const parts = id.split('.');
559
- const stateId = parts.pop() || '';
560
- const channelId = parts.splice(2, parts.length).join('.');
578
+ const channelId = this.getChannelId(id);
579
+ const stateId = id.split('.').pop() || '';
561
580
  // Check if this is a Zigbee device state change
562
581
  // Pattern: ZbReceived_DEVICEID_ATTRIBUTE (e.g., ZbReceived_0x0856_Power)
563
582
  const zbMatch = stateId.match(/^ZbReceived_([^_]+)_(Power|Dimmer)$/);
@@ -610,6 +629,31 @@ class MQTTBase {
610
629
  }
611
630
  }
612
631
  }
632
+ /**
633
+ * Forgets everything that was cached about the objects of one device, so the next message from it
634
+ * recreates them. `processTasks` creates every object only once per adapter run
635
+ * (`cacheAddedObjects`), so data points that were deleted from outside - e.g. by the device
636
+ * manager's "delete and recreate all data points" action - would otherwise never come back until
637
+ * the adapter is restarted.
638
+ *
639
+ * @param deviceId full ID of the device channel, e.g. "sonoff.0.DVES_123456"
640
+ */
641
+ forgetObjects(deviceId) {
642
+ const prefix = `${deviceId}.`;
643
+ const caches = [
644
+ this.cacheAddedObjects,
645
+ this.cachedModeExor,
646
+ this.cachedReadColors,
647
+ this.cachePowerObjects,
648
+ ];
649
+ for (const cache of caches) {
650
+ for (const id of Object.keys(cache)) {
651
+ if (id === deviceId || id.startsWith(prefix)) {
652
+ delete cache[id];
653
+ }
654
+ }
655
+ }
656
+ }
613
657
  async processTasks(callback) {
614
658
  if (callback) {
615
659
  this.taskCallbacks.push(callback);
@@ -1180,10 +1224,13 @@ class MQTTBase {
1180
1224
  }
1181
1225
  else if (parts[0] === 'stat' && stateId === 'STATUS10') {
1182
1226
  // stat/device/STATUS10 = {"StatusSNS":{"Time":"...","Switch2":"ON","Switch3":"OFF",...}}
1227
+ // This is the same data as the periodic tele/.../SENSOR telemetry, just requested on demand,
1228
+ // so it must land under the exact same state IDs - using "SENSOR" here too (with OBJ_TREE
1229
+ // on) avoids creating a second, duplicate copy of e.g. the ENERGY reading.
1183
1230
  try {
1184
1231
  const data = JSON.parse(val);
1185
1232
  if (data.StatusSNS && typeof data.StatusSNS === 'object') {
1186
- this.checkData(client, packet.topic, NO_PREFIX, data.StatusSNS);
1233
+ this.checkData(client, packet.topic, this.config.OBJ_TREE ? 'SENSOR' : NO_PREFIX, data.StatusSNS);
1187
1234
  }
1188
1235
  }
1189
1236
  catch (e) {