Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamsyntax if $CH22 <$CH23 then SetChannel 12 0
For OpenBeken scripting, write it like this:
if $CH22<$CH23 then "SetChannel 12 0"
The important part is that the command after then should be quoted because it contains spaces:
"SetChannel 12 0"
So your intended logic is:
If channel 22 is less than channel 23, set channel 12 to 0.
Your original line was essentially:
if $CH22 <$CH23 then SetChannel 12 0
or, with HTML escaping:
if $CH22 <$CH23 then SetChannel 12 0
In actual OpenBeken script syntax, < must be written as the real less-than character:
<
So the comparison should be:
$CH22<$CH23
The corrected full command is:
if $CH22<$CH23 then "SetChannel 12 0"
The quotes are needed because SetChannel 12 0 is one command with arguments. Without quotes, the script parser may treat SetChannel, 12, and 0 as separate tokens belonging to the if statement rather than as the command to execute.
If you will use this logic more than once, define an alias:
alias CheckCH if $CH22<$CH23 then "SetChannel 12 0"
Then call it with:
CheckCH
If you want it to run repeatedly, for example every second:
alias CheckCH if $CH22<$CH23 then "SetChannel 12 0"
addRepeatingEvent 1 -1 CheckCH
Or, if you want it to run when either channel changes:
alias CheckCH if $CH22<$CH23 then "SetChannel 12 0"
addChangeHandler Channel22 CheckCH
addChangeHandler Channel23 CheckCH
Use this if the condition should be checked only once, for example at boot:
if $CH22<$CH23 then "SetChannel 12 0"
Use this if it should be checked continuously:
alias CheckCH if $CH22<$CH23 then "SetChannel 12 0"
addRepeatingEvent 1 -1 CheckCH
Use this if it should react only when channel 22 or 23 changes:
alias CheckCH if $CH22<$CH23 then "SetChannel 12 0"
addChangeHandler Channel22 CheckCH
addChangeHandler Channel23 CheckCH
Correct syntax:
if $CH22<$CH23 then "SetChannel 12 0"
Do not use < in the actual script. Use the real < symbol. Quote the command after then because SetChannel 12 0 contains spaces.