you could send a valid StromPi 3 command (e.g. time-output). If the StromPi 3 doesn’t send the expected answer after perhaps 1 second you can assume, that the StromPi 3 is in serialless mode. Another way is to check, if the serialless GPIO pin has a high value. But if the StromPi 3 is restarted and the serialless start script isn’t executed, the GPIO has a high value but the StromPi 3 still responds on serial commands.