This is a version which activates the wah effect when the volume pedal is higher than 0.
It could be modified to do what you want. But perhaps you could also use it as it is?