Logic is good, but your then statements are wrong.
I looked in the config file briefly and your first two statements correctly turn the outputs on and off. However the 3rd and 4th then statements enable and disable buttons, and do nothing to the actual outputs. So it is acting as planned. When the logic is true, your button should no longer be clickable as you have it now.