I try to edit “ON/OFF” switch script for write different value when I am write 9=ON and 8=OFF.
Thanks for posting. That baked in Portals Widget cannot have its values changed. It will only ever know how to write 1 or 0. If you want to program what the output of a widget will be, then you will need to create a custom widget.
It’s a little more complicated, but here is a widget that does input via a slider.
Additional resources about custom widgets can be found in these other links.
Hopefully this gets you started,