Is there a way to send a command to remote X4 gateway with out using device cloud

Yeah, you can write your own system where a python app on the X4 connects to a server of your own creation, and then your client applications talk to that server.

Or… if your X4 is directly accessible on the internet, then you can communicate to it directly from there. However, why not just use the cloud? It’s so much easier.