I am trying to execute the following logic:
if "CH7" is set to a high state through mqtt, then insert the following code "linkTuyaMCUOutputToChannel 18 val 6 1", otherwise - do not execute
if - works improperly regardless of whether the condition is met or not, it still performs the function
waitFor MQTTState 1
// extra delay, to be sure
delay_s 1
startDriver TuyaMCU
startDriver tmSensor
// dpID 1 is tempererature div 10
setChannelType 1 temperature_div10
linkTuyaMCUOutputToChannel 1 val 1
// dpID 2 is % humidity
setChannelType 2 Humidity
linkTuyaMCUOutputToChannel 2 val 2
// dpID 3 is battery state - low(0), mid(1) and high(2)
linkTuyaMCUOutputToChannel 3 enum 3
setChannelType 3 ReadOnlyLowMidHigh
setChannelLabel 3 Battery
setChannelType 7 Toggle
setChannelLabel 7 seting
//
// setup dpCache - temperature interval
//
// Show textfield for that
setChannelType 5 TextField
// setup display name
setChannelLabel 5 Temperature Interval
// Make value persistant (stored between reboots),
// start value -1 means "remember last"
SetStartValue 5 -1
// set default value if not set
if $CH5=0 then "setChannel 5 1"
// link dpID 17 to channel 5, the type is val, extra '1' means that its dpCache variable
if $CH7!=0 then "linkTuyaMCUOutputToChannel 17 val 5 1"
setChannelType 6 TextField
setChannelLabel 6 Humidity Interval
SetStartValue 6 -1
if $CH6=0 then "setChannel 6 1"
if $CH7!=0 then "linkTuyaMCUOutputToChannel 18 val 6 1"