We had a customer ask us for a conditional programming sample of a fireplace button that would monitor if the damper was closed or open before turning the fireplace on or off. We thought the programming would benefit the forum community. See the attached program and description on this application:
We have a QSE-IO and a 1 button keypad in this project. Output 1 is a maintained CCO for the fireplace and Output 2 is a maintained CCO for the damper. There is a variable called "Damper" that has default state "Closed" and state "Open". The CCI 1 in the QSE-IO will monitor the Damper status. If it is closed, the variable will be set to "open" and if the CCI is open, the variable will be set to close and we are also turning off the fireplace (for safety reasons). If the fireplace is already off, that will not do anything.
The button will be a conditional; the LED logic is set to turn on when the fireplace is on (whenever/wherever the CCO is closed for the fireplace, the LED will turn on). The conditional will first check if the damper is open. If it is, it will check if the fireplace CCO is closed, meaning that the fireplace is on. If this is true, then a sequence will run to turn the fireplace off, wait a minute, then open the CCO of the damper (closing it) and setting the variable of the damper to closed. If the fireplace CCO is open, then it will close it, turning the fireplace on.
If the Damper variable is closed, a sequence will start by opening the damper (closing the CCO and turning the variable to open), waiting a minute, then closing the fireplace CCO to turn it on.