 void fadeLoop() {
   ambilightHue = ambilightHue < 360 ? ambilightHue+1 : 0;
    
-  char buffer[3];
-  sprintf(buffer, "%s", ambilightHue);
-  publishRetained(DEVICE_1_OFF_RAMP_HUE,  buffer);
+//   Serial.println(ambilightHue);
+  char buffer[6];
+  sprintf(buffer, "%f", 1.0*ambilightHue*(255.0/360));
+  //spublishRetained(DEVICE_1_ON_RAMP_HUE,  buffer);
 }
 
 void sensorLoop(){

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


//
//

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
}

