iobroker.flowers 0.3.7 → 0.3.9
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 +6 -0
- package/io-package.json +29 -16
- package/main.js +76 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,6 +83,12 @@ Only one watering cycle runs at a time per plant. Configure the duration in Sett
|
|
|
83
83
|
|
|
84
84
|
## Changelog
|
|
85
85
|
|
|
86
|
+
### 0.3.9 (2026-04-30)
|
|
87
|
+
- (sadam6752-tech) Fix button state roles: set `read=false` for `sendDailyReport` and `sendWeeklyReport` buttons (required by ioBroker role spec)
|
|
88
|
+
|
|
89
|
+
### 0.3.8 (2026-04-30)
|
|
90
|
+
- (sadam6752-tech) Auto-cleanup: remove ioBroker objects for plants deleted from config on adapter start
|
|
91
|
+
|
|
86
92
|
### 0.3.7 (2026-04-30)
|
|
87
93
|
- (sadam6752-tech) Fix E8915: add dependabot cooldown (`default-days: 7`) for npm ecosystem
|
|
88
94
|
- (sadam6752-tech) Update CI/CD: `check-and-lint` and `deploy` steps to Node.js 24.x
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "flowers",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.9",
|
|
5
5
|
"news": {
|
|
6
|
+
"0.3.9": {
|
|
7
|
+
"en": "Fix button state roles: set read=false for sendDailyReport and sendWeeklyReport buttons",
|
|
8
|
+
"de": "Button-Rollen korrigiert: read=false für sendDailyReport und sendWeeklyReport gesetzt",
|
|
9
|
+
"ru": "Исправлены роли кнопок: установлен read=false для sendDailyReport и sendWeeklyReport",
|
|
10
|
+
"fr": "Correction rôles boutons: read=false défini pour sendDailyReport et sendWeeklyReport",
|
|
11
|
+
"it": "Corretti ruoli pulsanti: impostato read=false per sendDailyReport e sendWeeklyReport",
|
|
12
|
+
"es": "Corrección roles botones: read=false establecido para sendDailyReport y sendWeeklyReport",
|
|
13
|
+
"pl": "Poprawiono role przycisków: ustawiono read=false dla sendDailyReport i sendWeeklyReport",
|
|
14
|
+
"pt": "Correção roles botões: read=false definido para sendDailyReport e sendWeeklyReport",
|
|
15
|
+
"nl": "Knop-rollen gecorrigeerd: read=false ingesteld voor sendDailyReport en sendWeeklyReport",
|
|
16
|
+
"uk": "Виправлено ролі кнопок: встановлено read=false для sendDailyReport та sendWeeklyReport",
|
|
17
|
+
"zh-cn": "修复按钮状态角色:为sendDailyReport和sendWeeklyReport按钮设置read=false"
|
|
18
|
+
},
|
|
19
|
+
"0.3.8": {
|
|
20
|
+
"en": "Auto-cleanup: remove ioBroker objects for plants deleted from config on adapter start",
|
|
21
|
+
"de": "Auto-Bereinigung: ioBroker-Objekte für aus der Konfiguration gelöschte Pflanzen werden beim Adapterstart entfernt",
|
|
22
|
+
"ru": "Автоочистка: объекты ioBroker для удалённых из конфига растений удаляются при старте адаптера",
|
|
23
|
+
"fr": "Nettoyage automatique: suppression des objets ioBroker pour les plantes supprimées de la config au démarrage",
|
|
24
|
+
"it": "Pulizia automatica: rimozione oggetti ioBroker per piante eliminate dalla config all'avvio",
|
|
25
|
+
"es": "Limpieza automática: eliminación de objetos ioBroker para plantas borradas de la config al iniciar",
|
|
26
|
+
"pl": "Auto-czyszczenie: usuwanie obiektów ioBroker dla roślin usuniętych z konfiguracji przy starcie",
|
|
27
|
+
"pt": "Limpeza automática: remoção de objetos ioBroker para plantas removidas da config no arranque",
|
|
28
|
+
"nl": "Auto-opruiming: ioBroker-objecten voor verwijderde planten worden bij adapterstart verwijderd",
|
|
29
|
+
"uk": "Автоочищення: об'єкти ioBroker для видалених з конфігу рослин видаляються при старті адаптера",
|
|
30
|
+
"zh-cn": "自动清理:适配器启动时删除配置中已移除植物的ioBroker对象"
|
|
31
|
+
},
|
|
6
32
|
"0.3.7": {
|
|
7
33
|
"en": "Fix E8915: add dependabot cooldown (default-days: 7); update CI/CD to Node.js 24; remove redundant eslint devDependency; add CHANGELOG_OLD.md",
|
|
8
34
|
"de": "E8915 behoben: Dependabot-Cooldown hinzugefügt; CI/CD auf Node.js 24 aktualisiert; redundante eslint devDependency entfernt; CHANGELOG_OLD.md hinzugefügt",
|
|
@@ -67,19 +93,6 @@
|
|
|
67
93
|
"nl": "Objecthiërarchie gecorrigeerd (device/channel/state), correcte state-rollen, verbeterde opruiming bij ontladen",
|
|
68
94
|
"uk": "Виправлено ієрархію об'єктів (device/channel/state), правильні ролі станів, покращено очищення при вивантаженні",
|
|
69
95
|
"zh-cn": "修复对象层次结构(device/channel/state),正确的状态角色,改进卸载清理"
|
|
70
|
-
},
|
|
71
|
-
"0.3.2": {
|
|
72
|
-
"en": "Custom profiles: users can create own plant profiles in Profiles tab",
|
|
73
|
-
"de": "Benutzerdefinierte Profile: eigene Pflanzenprofile in der Profiles-Registerkarte erstellen",
|
|
74
|
-
"ru": "Пользовательские профили: создание собственных профилей растений во вкладке Profiles",
|
|
75
|
-
"fr": "Profils personnalisés: créer ses propres profils de plantes dans l'onglet Profiles",
|
|
76
|
-
"it": "Profili personalizzati: crea profili piante personalizzati nella scheda Profiles",
|
|
77
|
-
"es": "Perfiles personalizados: crear perfiles de plantas propios en la pestaña Profiles",
|
|
78
|
-
"pl": "Własne profile: tworzenie własnych profili roślin w zakładce Profiles",
|
|
79
|
-
"pt": "Perfis personalizados: criar perfis de plantas próprios na aba Profiles",
|
|
80
|
-
"nl": "Aangepaste profielen: eigen plantenprofielen aanmaken in het tabblad Profiles",
|
|
81
|
-
"uk": "Користувацькі профілі: створення власних профілів рослин у вкладці Profiles",
|
|
82
|
-
"zh-cn": "自定义配置文件:在配置文件选项卡中创建自己的植物配置文件"
|
|
83
96
|
}
|
|
84
97
|
},
|
|
85
98
|
"titleLang": {
|
|
@@ -219,7 +232,7 @@
|
|
|
219
232
|
"role": "button",
|
|
220
233
|
"name": "Send daily report now",
|
|
221
234
|
"type": "boolean",
|
|
222
|
-
"read":
|
|
235
|
+
"read": false,
|
|
223
236
|
"write": true,
|
|
224
237
|
"def": false
|
|
225
238
|
},
|
|
@@ -232,7 +245,7 @@
|
|
|
232
245
|
"role": "button",
|
|
233
246
|
"name": "Send weekly report now",
|
|
234
247
|
"type": "boolean",
|
|
235
|
-
"read":
|
|
248
|
+
"read": false,
|
|
236
249
|
"write": true,
|
|
237
250
|
"def": false
|
|
238
251
|
},
|
package/main.js
CHANGED
|
@@ -37,6 +37,9 @@ class FlowersAdapter extends utils.Adapter {
|
|
|
37
37
|
this.notif = new NotificationManager(this, lang);
|
|
38
38
|
this.monitor = new MonitorService(this, this.notif, lang);
|
|
39
39
|
|
|
40
|
+
// Clean up objects for plants that no longer exist in config
|
|
41
|
+
await this._cleanupRemovedPlants();
|
|
42
|
+
|
|
40
43
|
// Subscribe to sensor states
|
|
41
44
|
await this.monitor.subscribeAll();
|
|
42
45
|
|
|
@@ -137,6 +140,79 @@ class FlowersAdapter extends utils.Adapter {
|
|
|
137
140
|
callback();
|
|
138
141
|
}
|
|
139
142
|
|
|
143
|
+
// ── Cleanup removed plants ─────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Delete ioBroker objects for plants that are no longer in the config.
|
|
147
|
+
* Called on adapter start to keep the object tree in sync with config.
|
|
148
|
+
*/
|
|
149
|
+
async _cleanupRemovedPlants() {
|
|
150
|
+
try {
|
|
151
|
+
// Build set of safe names for currently configured plants
|
|
152
|
+
const configuredNames = new Set(
|
|
153
|
+
(this.config.plants || []).map((p) =>
|
|
154
|
+
p.name.replace(/[^a-zA-Z0-9_]/g, "_").toLowerCase(),
|
|
155
|
+
),
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Get all existing objects under plants.*
|
|
159
|
+
const existingObjects = await this.getObjectViewAsync("system", "state", {
|
|
160
|
+
startkey: `${this.namespace}.plants.`,
|
|
161
|
+
endkey: `${this.namespace}.plants.\u9999`,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (!existingObjects || !existingObjects.rows) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Collect plant channel names that exist in objects but not in config
|
|
169
|
+
const toDelete = new Set();
|
|
170
|
+
for (const row of existingObjects.rows) {
|
|
171
|
+
const id = row.id; // e.g. flowers.0.plants.ficus.humidity
|
|
172
|
+
const relative = id.slice(`${this.namespace}.`.length); // plants.ficus.humidity
|
|
173
|
+
const parts = relative.split(".");
|
|
174
|
+
if (parts.length >= 2) {
|
|
175
|
+
const plantSafeName = parts[1];
|
|
176
|
+
if (!configuredNames.has(plantSafeName)) {
|
|
177
|
+
toDelete.add(plantSafeName);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Delete states, channel and device objects for each removed plant
|
|
183
|
+
for (const safeName of toDelete) {
|
|
184
|
+
this.log.info(
|
|
185
|
+
`flowers: removing objects for deleted plant "${safeName}"`,
|
|
186
|
+
);
|
|
187
|
+
// Delete all states under plants.<safeName>
|
|
188
|
+
for (const sensor of ["humidity", "temperature", "battery"]) {
|
|
189
|
+
try {
|
|
190
|
+
await this.delObjectAsync(`plants.${safeName}.${sensor}`);
|
|
191
|
+
} catch {
|
|
192
|
+
// ignore if not exists
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Delete device object plants.<safeName>
|
|
196
|
+
try {
|
|
197
|
+
await this.delObjectAsync(`plants.${safeName}`);
|
|
198
|
+
} catch {
|
|
199
|
+
// ignore if not exists
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// If no plants remain, also remove the plants channel
|
|
204
|
+
if (configuredNames.size === 0) {
|
|
205
|
+
try {
|
|
206
|
+
await this.delObjectAsync("plants");
|
|
207
|
+
} catch {
|
|
208
|
+
// ignore
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
} catch (err) {
|
|
212
|
+
this.log.warn(`flowers: cleanup error: ${err.message}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
140
216
|
// ── Report scheduling ──────────────────────────────────────────────────
|
|
141
217
|
|
|
142
218
|
_scheduleDailyReport() {
|
package/package.json
CHANGED