At first glance, the piece of code you have posted looks OK.
I assume digitalWrite(AIO_SENSOR_PIN_3, HIGH); maps to an actual pin?
If I was doing it, I would have used the <ArduinoJson.h> library in your sketch as you could send json from your flow which would give you much more flexibility in decoding a number of different commands.
So, for example, you could send commands like...
msg.payload = {"relay":"main","action":"on"};
or msg.payload = {"relay":"secondary","action":"off"};
The reason I say this is... you are bound to add extra relays or LEDs to your system. Plan ahead.
PS: It's not normal to start a topic-name with a /
Maybe you can change it to just... command (in your flow and in your sketch).
PPS: If you write a simple test-sketch (like the 'blink' sketch), can you turn the relay On and Off ?
One of my IoT students was asking about nearly the same question that you posted on the forum.
He was using a Wemos D1 Mini - not sure what you are using. But I'm sure it could be adapted.
I've posted what we did on the forum as I think it might go some way to solving your problem.