Regarding the mqtt disconnecting, there was already another user with same problem and, if I remember well, the problem was the client id that was conflicting with another device