Computer to Arduino to hardware, controlling on / off state of hardware via user input on computer
This seems way too complex for your purpose:


you really do not need to do anything to stay in the same state
if you want to switch the valve ON, no need to check whether it's OFF:
there is no harm in switching ON a valve that is already ON.


Here is a simplified version of the program:

void setup()
{
    Serial.begin(9600);
    Serial.println("Type '0' to turn OFF, '1' to turn ON");
}

void loop()
{
    int command = Serial.read();
    if (command == '0') digitalWrite(53, LOW);
    if (command == '1') digitalWrite(53, HIGH);
}


Notice that Serial.read() returns -1 if there is nothing in the input
buffer, and since -1 is neither '0' nor '1', this will not change the
output.

If you want to use more elaborate commands (not single characters), you
may want to take a look at this simple command-line
interpreter. It is intended to be easy to adapt to
different purposes.