      
      char buffer[4];
      sprintf(buffer, "%s", ambilightValue);
-     publishRetained(DEVICE_1_OFF_RAMP_VALUE,  buffer);     
+     publishRetained(DEVICE_1_ON_RAMP_VALUE,  buffer);     
   }
 }
 

void fadeLoop() {
  ambilightHue = ambilightHue < 360 ? ambilightHue+1 : 0;
   
  char buffer[3];
  sprintf(buffer, "%s", ambilightHue);
  publishRetained(DEVICE_1_OFF_RAMP_HUE,  buffer);
}

void sensorLoop(){

  //Serial.print("Received MQTT message:");
  //Serial.println(payload);
   
// TODO: PUBLISH VALUES TO OTHER SIDE OF RAMP
  if (strcmp(topic, DEVICE_1_ON_RAMP_VALUE) == 0) {
    int value; // 0-255 => convert to float
    Serial.println(payload);
    sscanf(payload, "%d", &value);
    setAmbilightValue(value);     
    
    publishRetained(DEVICE_1_OFF_RAMP_VALUE,  payload);     


  } else if (strcmp(topic, DEVICE_1_ON_RAMP_HUE) == 0) {
    int hue;
    Serial.println("receive");
    Serial.println(payload);

    sscanf(payload, "%d", &hue);
    
     
     
    setAmbilightHue(hue*(360/255)); 
        //publishRetained(DEVICE_1_OFF_RAMP_HUE,  payload);     

    
  } else if(strcmp(topic, DEVICE_1_ON_RAMP_POWER) == 0) {
    setWifi((char*)payload, wifiSwitchHomeGroup, 1);

    

  } else if(strcmp(topic, DEVICE_1_ON_RAMP_FADING)  == 0 ) {
    fadeStepFlag  = !(*payload == '0');

  } else if(strcmp(topic, DEVICE_2_ON_RAMP_POWER)  == 0) {
    setWifi((char*)payload, wifiSwitchHomeGroup, 2);

  }else if(strcmp(topic,DEVICE_3_ON_RAMP_POWER)  == 0) {
    setWifi((char*)payload, wifiSwitchHomeGroup, 3);

  } else if (strcmp(topic, "/devices/321995-ambilight/actions/wakeup") == 0) {
    Serial.println("wakeup");
  }
