Doing it with "sshpass" involves a lot of risks, one of which is showing your password to anyone logged in on your system. They can just look with "ps" and see it.
I don't have "sshpass" and can use command substitution $( ... ) with "ssh" just fine using keys for authentication. So it might be interfering with that.
Between the two problems, I'd recommend using keys for authentication instead.
Code:
status="$(ssh -i /home/user/.ssh/some_key_rsa -o ConnectTimeout=10 USER@IP_REMOTE echo ok 2>&1)"
Key-based authentication is considered best practice these days, anyway, so there are a lot of tutorials about using keys. Just remember that the
public key goes onto the remote host and the
private key stays on your client. Also, some of the guides are old, so ignore any that talk about using DSA. Use RSA or Ed25519 instead.