There is scripting "tips and tricks", that discuss "once":
https://wiki.mikrotik.com/wiki/Manual:S ... monitor%22
Re "as-value", If you try from the CLI, you'll notice that with "once" BUT NO "as-value":
/iot modbus read-holding-registers slave-id=0x03 num-regs=0x1 reg-addr=0x0 once
... This "prints" (outputs) to the console the values.
If you remove the "once" from above command, you'll note the it just keeps running outputting value forever. But if you need a value to continue a script, you don't want it to keep outputting values – the "once" say "get the first value and move on to next command".
If you add "as-value" to same command it will print nothing – that because it's "return the value" to a variable. So the Mikrotik example tries to show both the script usage and CLI in one command (e.g. store the output to variable via "as-value", but another command :put to output to console:
{:local output [/iot modbus read-holding-registers slave-id=0x03 num-regs=0x1 reg-addr=0x0 as-value once];:put [($output->"values")]}
So without the "once" your schedule script would run forever.
2) Anyway all of this should be put in a script and then system>scheduled, so the minimum time between each poll is 1 second?
That's the granularity of the schedule, so 1 sec.
BUT, coming back to the "once"... The read-holdiing-registers command also supports a "do=" code block which how you can continuously read the registers. Essentially instead of "once", you can use do={ # code that uses $values } - that make the command like a "infinite while loop" with the do={} part executed per the defined interval. You can make do= "not infinite" by using a timeout=1s, and if you called MQTT inside the do loop, it remote as often as values were returned. But this approach is tricky in scheduler, since it's managing the interval already. The do={} method is useful sometimes. But you want something continuously reading reliably to report to something like MQTT, the schedule at 1 seconds and using "once as-value" is pretty simple.
3) is it supported only read-holding-registers or exist also a write-holding-registers?
Docs say KNOT only support function 3, which is the read registers.