[refac] replaced handle creation with macro

that code contains one small issue but we can solve it later
after the mqtt starts to work