     digitalWrite(FANPIN, !Firebase.getBool(String(DEVICE_PATH) + "fan"));
     digitalWrite(LIGHTPIN, !Firebase.getBool(String(DEVICE_PATH) + "light"));
     digitalWrite(LED_BUILTIN, !Firebase.getBool(String(DEVICE_PATH) + "light"));
+    
+    int rAux = Firebase.getInt(String(DEVICE_PATH) + "r");
+    int bAux = Firebase.getInt(String(DEVICE_PATH) + "b");
+    int gAux = Firebase.getInt(String(DEVICE_PATH) + "g");
+    
+    r = rAux != 0 ? rAux : r ;
+    b = bAux != 0 ? bAux : b ;
+    g = gAux != 0 ? gAux : g ;
+    
+    Serial.println( "r: " + String(r) + ", " +
+                    "b: " + String(b) + ", " +
+                    "g: " + String(g) ); 
+    analogWrite(REDPIN, r);
+    analogWrite(GREENPIN, g);
+    analogWrite(BLUEPIN, b);
 }
 
 //TODO verify wheter is this okay or not

    pinMode(FANPIN, OUTPUT);
    pinMode(LIGHTPIN, OUTPUT);
    pinMode(SENSORPIN, INPUT);
    motionSensorRead = !digitalRead(SENSORPIN);
    digitalWrite(LED_BUILTIN, !Firebase.getBool(String(DEVICE_PATH) + "light"));

}

inline String getErrorString(String table) {
    return String(TABLE_LEITURA) + " failed to send:";


void inline readLeituraAndSendToFirebase() {
    readDataToSend();
    if (count > DELAY_TIME_TO_SEND) {
        if (leitura["temperatura"] == "nan" || leitura["umidade"] == "nan" || getEpoch().toInt() <= 1000) {
            Serial.print("Leitura falha");
            return;
        }

        count = 0;
        Firebase.push(TABLE_LEITURA, leitura);
        Serial.print("Enviou leitura");
        return;
    }
    if (Firebase.failed()) {
        Serial.print(getErrorString(TABLE_LEITURA));
        Serial.println(Firebase.error());
        errorCount++;
        return;
    }
}
