12 063
правки
(Новая страница: «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, | |||
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 // | forceDefault: true // every time the script box mycell will receive a value of 10 | ||
} | } | ||
} | } | ||
}); | }); | ||
</syntaxhighlight> | </syntaxhighlight> |
правки