Перейти к содержанию

Навигация

Движок правил wb-rules 1.7/en: различия между версиями

Новая страница: «<syntaxhighlight lang="js"> defineVirtualDevice("vdev", { ... cells: { ... mycell: { type: "value", value: "10",…»
(Новая страница: «In previous versions of wb-rules, the values of virtual device controls were stored only in MQTT retained, which is not very reliable (in the case of power loss d…»)
(Новая страница: «<syntaxhighlight lang="js"> defineVirtualDevice("vdev", { ... cells: { ... mycell: { type: "value", value: "10",…»)
 
(не показана 1 промежуточная версия этого же участника)
Строка 158: Строка 158:
memory and restored when the script is loaded.
memory and restored when the script is loaded.


Если необходимо каждый раз при перезагрузке скрипта восстанавливать строго определённое значение (т.е. не восстанавливать предыдущее сохранённое),
If it is necessary to restore a strictly defined value (i.e. not to restore the previous saved value) every time the script is restarted,
можно добавить в описание контрола поле forceDefault:
you can add the forceDefault field to the control description:


<syntaxhighlight lang="js">
<syntaxhighlight lang="js">
Строка 169: Строка 169:
             type: "value",
             type: "value",
             value: "10",
             value: "10",
             forceDefault: true // при каждой загрузке сценария поле mycell будет получать значение 10
             forceDefault: true // every time the script box mycell will receive a value of 10
         }
         }
     }
     }
});
});
</syntaxhighlight>
</syntaxhighlight>
12 063

правки