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

  //Serial.print("Received MQTT message:");
  //Serial.println(payload);
   

  if (strcmp(topic, DEVICE_1_ON_RAMP_VALUE) == 0) {
    double value;
    sscanf(payload, "%f", &value);
    setAmbilightValue(value);     
  } else if (strcmp(topic, DEVICE_1_ON_RAMP_HUE) == 0) {
    int hue;
    sscanf(payload, "%f", &hue);
    setAmbilightHue(hue); 
  } 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');
    fadeStepToTargetColorFlag = false;
  } 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");
  }

//
//

void setAmbilightValue(int value) {
      Serial.println(value);

//  Serial.print("new value is: ");
 // Serial.println(value);
  ambilightValue = round(1.0*value*(360.0/255));
  Serial.print("new value is: ");
  Serial.println(ambilightValue);

  setLedColorHSV(ambilightHue,1,ambilightValue); //Staturation constant at 1
}     


void setAmbilightHue(int hue) {

    ambilightHue =hue;
    Serial.print("new hue is: ");
  Serial.println(ambilightHue);

  setLedColorHSV(ambilightHue,1,ambilightValue); //Staturation constant at 1
}

