iobroker.mywebui 1.37.66 → 1.37.67

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/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "mywebui",
4
- "version": "1.37.66",
4
+ "version": "1.37.67",
5
5
  "titleLang": {
6
6
  "en": "mywebui",
7
7
  "de": "mywebui",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.mywebui",
3
- "version": "1.37.66",
3
+ "version": "1.37.67",
4
4
  "description": "ioBroker mywebui - Custom edited mywebui by gokturk413",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -878,18 +878,27 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
878
878
  ['equal','='],['not_equal','≠'],['less_than','<'],['less_equal','≤'],
879
879
  ['greater_than','>'],['greater_equal','≥'],['exists','exists']
880
880
  ], ctrlCfg.condition || 'equal');
881
- condSel.style.cssText += 'width:70px;flex:none;margin-right:4px;';
881
+ condSel.style.cssText += 'flex:1;';
882
+ condSel.onchange = save;
883
+ const condRow = document.createElement('div');
884
+ condRow.style.cssText = 'display:flex;align-items:center;gap:4px;margin-bottom:4px;';
885
+ condRow.appendChild(this._makeBindSquare('condition', ctrlCfg, designItem, 'data-animation', saveAndRefresh));
886
+ condRow.appendChild(condSel);
887
+ wrap.appendChild(condRow);
882
888
  const valInp = document.createElement('input');
883
889
  valInp.type = 'text'; valInp.value = ctrlCfg.value ?? 'true';
884
890
  valInp.style.cssText = 'flex:1;padding:3px 5px;font-size:11px;border:1px solid #ccc;border-radius:3px;';
885
- condSel.onchange = save; valInp.onchange = save;
886
- const condRow = document.createElement('div');
887
- condRow.style.cssText = 'display:flex;gap:3px;';
888
- condRow.appendChild(condSel); condRow.appendChild(valInp);
889
- wrap.appendChild(condRow);
891
+ valInp.onchange = save;
892
+ const valRow = document.createElement('div');
893
+ valRow.style.cssText = 'display:flex;align-items:center;gap:4px;';
894
+ valRow.appendChild(this._makeBindSquare('value', ctrlCfg, designItem, 'data-animation', saveAndRefresh));
895
+ valRow.appendChild(valInp);
896
+ wrap.appendChild(valRow);
890
897
  wrap._getCtrl = () => {
891
898
  const v = { condition: condSel.value, value: valInp.value };
892
899
  if (ctrlCfg.oid_bind) v.oid_bind = ctrlCfg.oid_bind;
900
+ if (ctrlCfg.condition_bind) v.condition_bind = ctrlCfg.condition_bind;
901
+ if (ctrlCfg.value_bind) v.value_bind = ctrlCfg.value_bind;
893
902
  return v;
894
903
  };
895
904
  return wrap;
@@ -1167,10 +1176,16 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
1167
1176
  oidLabelText.textContent = 'OID';
1168
1177
  oidLabel.appendChild(oidLabelText);
1169
1178
  const condRowDiv = document.createElement('div');
1170
- condRowDiv.style.cssText = 'display:flex;gap:3px;margin-bottom:6px;padding-left:15px;';
1171
- condRowDiv.appendChild(condSel); condRowDiv.appendChild(condValInp);
1179
+ condRowDiv.style.cssText = 'display:flex;align-items:center;gap:4px;margin-bottom:4px;padding-left:4px;';
1180
+ condRowDiv.appendChild(this._makeBindSquare('condition', cfg, designItem, 'data-effects', saveAndRefresh));
1181
+ condRowDiv.appendChild(condSel);
1182
+ const condValRowDiv = document.createElement('div');
1183
+ condValRowDiv.style.cssText = 'display:flex;align-items:center;gap:4px;margin-bottom:6px;padding-left:4px;';
1184
+ condValRowDiv.appendChild(this._makeBindSquare('conditionValue', cfg, designItem, 'data-effects', saveAndRefresh));
1185
+ condValRowDiv.appendChild(condValInp);
1172
1186
  oidSection.appendChild(oidLabel);
1173
1187
  oidSection.appendChild(condRowDiv);
1188
+ oidSection.appendChild(condValRowDiv);
1174
1189
  content.appendChild(oidSection);
1175
1190
  triggerSel.addEventListener('change', () => { oidSection.style.display = triggerSel.value === 'oid' ? '' : 'none'; });
1176
1191
 
@@ -160,30 +160,37 @@ class AnimationInstance {
160
160
  const ctrl = controls[key];
161
161
  if (!ctrl) return;
162
162
 
163
- // If OID itself is bound via binding square, resolve it first
164
- if (ctrl.oid_bind?.signal) {
163
+ // condition_bind: dynamically update which condition operator to use
164
+ if (ctrl.condition_bind?.signal) {
165
165
  try {
166
- const s = await iobrokerHandler.connection.getState(ctrl.oid_bind.signal);
167
- if (s?.val != null) ctrl.oid = String(s.val);
166
+ const s = await iobrokerHandler.connection.getState(ctrl.condition_bind.signal);
167
+ if (s?.val != null) ctrl.condition = String(s.val);
168
168
  } catch (e) {}
169
- const oidBindHandler = (id, state) => {
170
- if (state?.val != null) ctrl.oid = String(state.val);
171
- };
169
+ const h = (id, state) => { if (state?.val != null) ctrl.condition = String(state.val); };
170
+ try { iobrokerHandler.connection.subscribeState(ctrl.condition_bind.signal, h); this._subs.push({ oid: ctrl.condition_bind.signal, handler: h }); } catch (e) {}
171
+ }
172
+
173
+ // value_bind: dynamically update the trigger value
174
+ if (ctrl.value_bind?.signal) {
172
175
  try {
173
- iobrokerHandler.connection.subscribeState(ctrl.oid_bind.signal, oidBindHandler);
174
- this._subs.push({ oid: ctrl.oid_bind.signal, handler: oidBindHandler });
176
+ const s = await iobrokerHandler.connection.getState(ctrl.value_bind.signal);
177
+ if (s?.val != null) ctrl.value = String(s.val);
175
178
  } catch (e) {}
179
+ const h = (id, state) => { if (state?.val != null) ctrl.value = String(state.val); };
180
+ try { iobrokerHandler.connection.subscribeState(ctrl.value_bind.signal, h); this._subs.push({ oid: ctrl.value_bind.signal, handler: h }); } catch (e) {}
176
181
  }
177
182
 
178
- if (!ctrl.oid) return;
183
+ // oid_bind.signal IS the OID to watch (binding square directly holds the target OID)
184
+ const oid = ctrl.oid || ctrl.oid_bind?.signal;
185
+ if (!oid) return;
179
186
  const handler = (id, state) => {
180
187
  if (checkCond(state?.val, ctrl.condition || 'equal', ctrl.value ?? 'true')) action();
181
188
  };
182
189
  try {
183
- iobrokerHandler.connection.subscribeState(ctrl.oid, handler);
184
- this._subs.push({ oid: ctrl.oid, handler });
190
+ iobrokerHandler.connection.subscribeState(oid, handler);
191
+ this._subs.push({ oid, handler });
185
192
  } catch (e) {}
186
- iobrokerHandler.connection.getState(ctrl.oid).then(state => {
193
+ iobrokerHandler.connection.getState(oid).then(state => {
187
194
  if (state && checkCond(state.val, ctrl.condition || 'equal', ctrl.value ?? 'true')) action();
188
195
  }).catch(() => {});
189
196
  };
@@ -389,24 +396,26 @@ async function _applyEffect(el, cfg) {
389
396
  _clickFn = applyTween;
390
397
  el.addEventListener('click', _clickFn);
391
398
  } else if (cfg.trigger === 'oid') {
392
- // Resolve OID — may come from a binding square binding
393
- if (cfg.oid_bind?.signal) {
394
- try {
395
- const s = await iobrokerHandler.connection.getState(cfg.oid_bind.signal);
396
- if (s?.val != null) cfg.oid = String(s.val);
397
- } catch (e) {}
398
- const oidBindHandler = (id, state) => { if (state?.val != null) cfg.oid = String(state.val); };
399
- try { iobrokerHandler.connection.subscribeState(cfg.oid_bind.signal, oidBindHandler); } catch (e) {}
400
- _oidId = cfg.oid_bind.signal;
401
- _oidHandler = oidBindHandler;
399
+ // condition_bind and conditionValue_bind
400
+ if (cfg.condition_bind?.signal) {
401
+ try { const s = await iobrokerHandler.connection.getState(cfg.condition_bind.signal); if (s?.val != null) cfg.condition = String(s.val); } catch (e) {}
402
+ const h = (id, state) => { if (state?.val != null) cfg.condition = String(state.val); };
403
+ try { iobrokerHandler.connection.subscribeState(cfg.condition_bind.signal, h); } catch (e) {}
404
+ }
405
+ if (cfg.conditionValue_bind?.signal) {
406
+ try { const s = await iobrokerHandler.connection.getState(cfg.conditionValue_bind.signal); if (s?.val != null) cfg.conditionValue = String(s.val); } catch (e) {}
407
+ const h = (id, state) => { if (state?.val != null) cfg.conditionValue = String(state.val); };
408
+ try { iobrokerHandler.connection.subscribeState(cfg.conditionValue_bind.signal, h); } catch (e) {}
402
409
  }
403
- if (cfg.oid) {
404
- _oidId = cfg.oid;
410
+ // oid_bind.signal IS the OID to watch (same as for animation controls)
411
+ const oid = cfg.oid || cfg.oid_bind?.signal;
412
+ if (oid) {
413
+ _oidId = oid;
405
414
  _oidHandler = (id, state) => {
406
415
  if (checkCond(state?.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
407
416
  };
408
- try { iobrokerHandler.connection.subscribeState(cfg.oid, _oidHandler); } catch (e) {}
409
- iobrokerHandler.connection.getState(cfg.oid).then(state => {
417
+ try { iobrokerHandler.connection.subscribeState(oid, _oidHandler); } catch (e) {}
418
+ iobrokerHandler.connection.getState(oid).then(state => {
410
419
  if (state && checkCond(state.val, cfg.condition || 'equal', cfg.conditionValue ?? 'true')) applyTween();
411
420
  }).catch(() => {});
412
421
  }