2 dht22


#42

this code reads 5 parameters from the DTH22 namely

  1. humidity using float h = dht.readHumidity();
  2. temperature in Celsius using float t = dht.readTemperature();
  3. temperature in Fahrenheit using float f = dht.readTemperature(true);
  4. heat index in Celsius using float hif = dht.computeHeatIndex(f, h);
  5. heat index in Fahrenheit, using float hic = dht.computeHeatIndex(t, h, false);

Next this value are published/send to cayenne using:

Cayenne.virtualWrite(DTH_hum_Virtual_Channel, h, "rel_hum", "p");
Cayenne.virtualWrite(DTH_tempC_Virtual_Channel, t, "temp", "c");
Cayenne.virtualWrite(DTH_tempF_Virtual_Channel, f, "temp", "f");
Cayenne.virtualWrite(DTH_hif_Virtual_Channel, hif, "temp", "f");
Cayenne.virtualWrite(DTH_hic_Virtual_Channel, hic, "temp", "c");

Now remove whichever you don’t want from the code.


#43

Thank you! I duplicated the part of code for reading the sensors, but I had not seen this part that I did not duplicate.

#define DTH_hum_Virtual_Channel 1
#define DTH_tempC_Virtual_Channel 2
#define DTH_tempF_Virtual_Channel 3
#define DTH_hic_Virtual_Channel 4
#define DTH_hif_Virtual_Channel 5

thanks for your patience…


#44

you also need to duplicate this part with different name and channel number.


#45

It works!!! thank you very much to all the people who have had the desire and the patience to help me.
image![image|663x404]

Grazie


#46

you can change the name of the widget by clicking on the clog wheel for setting on the widget.