Add encoder for mqtt messages