Depuis le 28/09/2023, je suis équipé d’une centrale photovoltaïque de 3KWc….
Alors plutôt que d’injecter gratuitement le surplus, l’idée m’est venue d’en utiliser une partie pour mon vieux chauffe eau électrique…
Je suis connecté au Linky par un petit module ESP8266 qui envoie les données à mon serveur Domoticz
Je peux ainsi suivre consommation et production en direct ou presque…
En mode historique le Linky donne 2 informations:
IINST intensité instantanée
PAPP puissance apparante
PAPP est nul en cas d’injection mais pas IINST
Donc quand PAPP est nul est que IINST est supérieur à mon talon de consommation+ la consommation dudit chauffe eau, je décide de l’alimenter sinon on coupe….
Comme le chauffe eau est télécommandable par Domoticz via une prise RF 433 Chacon, cela n’a pas été difficile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
WiFiClient client; HTTPClient http; Serial.print("[HTTP] begin...\n"); // get data from linky http.begin(client, "http://192.168.1.61");//c'est le module esp8266 pour la transmission des données Serial.print("[HTTP] GET...\n"); // start connection and send HTTP header int httpCode = http.GET(); if (httpCode > 0) { // HTTP header has been send and Server response header has been handled Serial.printf("[HTTP] GET... code: %d\n", httpCode); // file found at server if (httpCode == HTTP_CODE_OK) { //la requete HTTP du module relié au linky est succesfull String s = http.getString(); Serial.println(s);//résultat de la requête HTTP //on va chercher PAPP********************************************************** for (int p = 1; p < s.length(); p++) if ((s[p] == 'P') && (s[p + 1] == 'A') && (s[p + 2] == 'P')) { String papp = s.substring(p, p + 10); Serial.println("Trouvé:" + papp); int valPapp = papp.substring(5, 10).toInt(); Serial.println(valPapp); sendToDomoticz(String(2892), String(valPapp)); if (valPapp < 10) {//valPAPP <10 ,de la puissance est disponible digitalWrite(greenPin, HIGH); digitalWrite(redPin, LOW); digitalWrite(bluePin, LOW); delay(1000); //on va chercher IINST************************************************* for (int p = 1; p < s.length(); p++) if ((s[p] == 'I') && (s[p + 1] == 'I') && (s[p + 2] == 'N')) { String iinst = s.substring(p, p + 9); Serial.println("Trouvé:" + iinst); int valIinst = iinst.substring(6, 9).toInt(); Serial.println(iinst); if ((valIinst >= 4)) { si puissance >880 W on peut envoyer au chauffe eau digitalWrite(bluePin, HIGH); Serial.println("Allumage du chauffe-eau"); sendCommandeToDomotiz("http://192.168.1.13:8080/json.htm?type=command¶m=switchlight&idx=2503&switchcmd=On"); } else { Serial.println("Extinction du chauffe-eau"); sendCommandeToDomotiz("http://192.168.1.13:8080/json.htm?type=command¶m=switchlight&idx=2503&switchcmd=Off"); } } } else { Serial.println("Extinction du chauffe-eau"); sendCommandeToDomotiz("http://192.168.1.13:8080/json.htm?type=command¶m=switchlight&idx=2503&switchcmd=Off"); if (valPapp > 1000) {//valPAPP >1000 rouge digitalWrite(bluePin, LOW); digitalWrite(greenPin, LOW); digitalWrite(redPin, HIGH); } else {//valPAPP >10 et <1000 rouge+vert digitalWrite(bluePin, LOW); digitalWrite(greenPin, HIGH); digitalWrite(redPin, HIGH); } } } } Serial.println(); Serial.print("[HTTP] connection closed or file end.\n"); } else { Serial.printf("[HTTP] GET... failed, error: %s\n", http.errorToString(httpCode).c_str()); ESP.restart(); } http.end(); } |