copied send_message routine from er-smart-meter