sensor and mqtt code integrated