Can I save a int into a bool

Ok… I wonder what’s the ID for if the letter is also an ID

Yeh,... each sensor has an ID and all value does not contain a letter.
Then when I sent all measure to my server, I prefer to have something like




But what’s the ID for then? Can’t you use the letter instead?

To be honnest, it's long time a developped this part of my code, and I do not rember well now.
I have to restudy this to develop my answer

   ID of sensors
  const byte capteur_temperature_id = 0;
  const byte capteur_pressure_id = 1;
  const byte capteur_humidity_id = 2;
  const byte capteur_luminosity_id = 3;
  const byte capteur_wm1_id = 4;
  const byte capteur_wm2_id = 5;
  const byte capteur_wm3_id = 6;
  const byte capteur_datetime_id = 7;
  const byte capteur_temperature_soil_id = 8;
  const byte capteur_gauge_id = 9;
  const byte capteur_battery_id = 10;
  const byte capteur_wattering_id = 11;
  const byte capteur_aneno_id = 12;
  const byte capteur_irtemp_id = 13;
  const byte capteur_wrm_id = 14;
  const byte capteur_bud1_id = 15;
  const byte capteur_bud2_id = 16;
  const byte capteur_bud3_id = 17;
  const byte capteur_bud4_id = 18;
  const byte capteur_sun_id = 19;
  const byte capteur_wdirection_id = 20;
  const byte capteur_sf110bud_id = 21;
  const byte capteur_sf110leaf_id = 22;

  struct capteur
    uint8_t idDuCapteur;
    boolean actif;
    const char * nomDuCapteur;
    const uint8_t codeDuCapteur;

  // listingSensors() as well !!!
  capteur mesCapteur[] = {
    {capteur_temperature_id, station.temperature_active, "te", 'a'},
    {capteur_pressure_id, station.pressure_active, "pr", 'b'},
    {capteur_humidity_id, station.humidity_active, "hu", 'c'},
    {capteur_luminosity_id, station.luminosity_active, "lu", 'd'},
    {capteur_wm1_id, (station.wm1_active>0)?true:false, "w1", 'e'},
    {capteur_wm2_id, (station.wm2_active>0)?true:false, "w2", 'f'},
    {capteur_wm3_id, (station.wm3_active>0)?true:false, "w3", 'g'},
    {capteur_datetime_id, station.rtc, "da", 'h'}, //date_time_active is always the same than rtc
    {capteur_temperature_soil_id, station.temperature_soil_active, "ts", 'i'},
    {capteur_gauge_id, (station.gauge_active>0)?true:false, "ga", 'j'},
    {capteur_battery_id, station.battery_active, "ba", 'k'},
    {capteur_wattering_id, (station.wattering_active>0)?true:false, "ar", 'l'},
    {capteur_aneno_id, (station.aneno_active>0)?true:false, "an", 'm'},
    {capteur_irtemp_id, station.irtemp_active, "it", 'n'},
    {capteur_wrm_id, station.wrm_active, "wr", 'o'},
    {capteur_bud1_id, (station.bud1_active>0)?true:false, "b1", 'p'},
    {capteur_bud2_id, (station.bud2_active>0)?true:false, "b2", 'q'},
    {capteur_bud3_id, (station.bud3_active>0)?true:false, "b3", 'r'},
    {capteur_bud4_id, (station.bud4_active>0)?true:false, "b4", 's'},
    {capteur_sun_id, (station.sun_active>0)?true:false, "su", 't'},
    {capteur_wdirection_id, (station.wdirection_active>0)?true:false, "wd", 'u'},
    {capteur_sf110bud_id, (station.sf110bud_active>0)?true:false, "sb", 'v'},
    {capteur_sf110leaf_id, (station.sf110leaf_active>0)?true:false, "sl", 'w'},
  // dans le même ordre que mesCapteurs
  enum : byte {c_temperature = 0, c_pressure, c_humidity, c_luminosity, c_wm1, c_wm2, c_wm3, c_datetime, c_temperature_soil, c_gauge, c_battery, c_wattering, c_aneno, c_irtemp, c_wrm, c_bud1, c_bud2, c_bud3, c_bud4, c_sun, c_wdirection, c_sf110bud, c_sf110leaf};
  const byte nbMaxCapteurs = sizeof(mesCapteur) / sizeof(mesCapteur[0]);
  byte nbCapteurActif = 0;

  struct mesure {
    //uint16_t id_capteur;
    int16_t valeur; // valeur mesurée (adapter le type)
    int codeCapteur; // valeur mesurée (adapter le type)
    // autre chose de pertinent à mémoriser lors d'une mesure ?

  const byte tailleHistorique = 23; // Ce chiffre doit correspondre aux nombres de capteurs. Voir capteur mesCapteur[] = {
  mesure mesMesures[nbMaxCapteurs][tailleHistorique];


I hate ths kind of answer but I am in the rush and I have no time to optimize that now.
That's work like a charm :slight_smile:
But it's a good point to think later.