Page 1 of 1

DHT11 not decimal values?

Posted: 04 Feb 2017, 12:22
by freijn
I have been searching the internet and this forum but can't find the answer.

My DHT11 is only showning temperature in full degree's nothing in decimals. So only 20 21 22.
Is the sensor not sending it ? Like 19.5 ?
Or have I done something wrong.
In the ESP it does have decimals 2 defined.

many thanks for your help !

Frank

Re: DHT11 not decimal values?

Posted: 11 Feb 2017, 14:51
by Ton_vN
My DHT11 is only showning temperature in full degree's nothing in decimals.
Where are you looking?

Assuming that DHT22 is treated same as DHT11, I see in ESPEasy the DHT-values with 2 decimals, and in Domoticz the Temperature-value with 1 decimal, and the Humidity-value without decimal (but who cares about the latter?)

Re: DHT11 not decimal values?

Posted: 18 Feb 2017, 17:55
by papperone
DHT11 has this limit, it can read temperature and humidity only by integer value.
If you need better precision up to 0.1° then use DHT22 which is more advanced and expensive of course.

Re: DHT11 not decimal values?

Posted: 29 Oct 2018, 16:19
by svde
My usecase requires 2 decimals. The DHT22 on my ESP shows 2 decimals, but the second decimal is always "0". I also have a luftdaten sensor which has a BME280 and DHT22 attached, I see that the BME280 on the luftdaten sensor does have 2 decimal values (the DHT22 connected to the lufdaten also only shows "0" as the second decimal). My question: does a BME280 support 2 decimals with esp easy?

Re: DHT11 not decimal values?

Posted: 29 Oct 2018, 20:34
by HomeJCL
BME280 shows something with 2 digits, but when I compare to a calibrated Pt100, I don’t even think the 2 decimals are ... worthy to be used :roll:

98710533: BME280: dew point 1.74C
98710545: BME280 : Address: 0x76
98710545: BME280 : Temperature: 6.36
98710546: BME280 : Humidity: 72.58
98710546: BME280 : Barometric Pressure: 999.12

Re: DHT11 not decimal values?

Posted: 30 Oct 2018, 10:39
by svde
HomeJCL wrote: 29 Oct 2018, 20:34 BME280 shows something with 2 digits, but when I compare to a calibrated Pt100, I don’t even think the 2 decimals are ... worthy to be used :roll:

98710545: BME280 : Temperature: 6.36
Perfect. Thanks!

I have a use case which involves making predictions based on temperature delta's between 20 minutes ago and now. One decimal resolution is insufficient to make it work reliably.

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 21:15
by j-ghost
Hi there,

thanks to the support of Gijs and Grovkiller I now have some basic sliding average filter implemented.

Looks like:

On Temperature#Value Do
Let,2,[VAR#1]*4
Let,1,[Temperature#Value]
TaskValueSet,12,1,([VAR#1]+[VAR#2])/5
EndOn

Now, as I understand, the DHT11 only gives integers as a value. And esp easy sends it to domoticz as a floatingpoint with 2 digits after the dot. True?
So, is it because the numbers are integers, an inbetween value cannot be calculated? ( i was hoping it did, to have also have values like 17.35 or so)
Of course I understand it has nothing to do with accuracy, but i just like smooth lines:)

Is there a solution to that?

Jan

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 21:57
by grovkillen
You can set your decimals on that dummy value. Given that you have a filter you still get decimals even if the dht only deliver integers.

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:23
by j-ghost
Dear grovkillen,

maybe my learning curve is not so steep...?

I expected to have decimals with the filter. But I don's see it.
Maybe is mis the point on "you can set your decimals on that dummy value" ?

A hint for me?

best regards!

Jan

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:35
by grovkillen
In the task settings for your dummy device, what number of decimals do you have set?

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:41
by j-ghost
I dont understand dummy device. have a dht11 connected, rules as suggested, always xx.00 degrees.

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:45
by grovkillen
Ok, so you have the dht on task number 12? Our suggestion was to use a separate device called dummy device. The DHT should only add it's values not be the one publishing them. So that last line where we use the TaskValueSet we should point it to a dummy device, not back to the DHT device.

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:50
by j-ghost
added a picture in prev post, can do dht on task number 1 or put sensor on different row (12)

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 22:56
by grovkillen

Code: Select all

On DHT11#Temperature Do
Let,2,[VAR#1]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([VAR#1]+[VAR#2])/5
EndOn
Only change is to set the TaskValueSet to 2 instead of 12.

You should see that value being populated with values once you have updated the rule.

Also your device names in the rules need to match your device names

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 23:08
by j-ghost
No changes,

VAR#1 and 2 , do i need to change that to DHT11#Temperature ?
WHere does VAR#2 come from?

(sorry for the apparently 'i should know' questions)

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 23:13
by j-ghost
On Temperature#Value Do
Let,2,[dummydev#Dtemp]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([DHT11#Temperature]+[dummydev#Dtemp])/5
EndOn

with:

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 23:29
by grovkillen
Copy and paste my code, it'll work. Please study your code and you'll see that you're not using the correct event trigger.

Re: DHT11 not decimal values?

Posted: 14 Feb 2019, 23:42
by j-ghost
Thanks for you patience,

modifying to much at the same time...your code works,
but still have difficulty understanding the syntax a bit.
Can i modify var#2 to dummydev#Dtemp or does that not make sense? or is 2 here not a variable but a location?



On DHT11#Temperature Do
Let,2,[VAR#1]*4
Let,1,[DHT11#Temperature]
TaskValueSet,2,1,([VAR#1]+[VAR#2])/5
Let,4,[VAR#3]*4
Let,3,[DHT11#Humidity]
TaskValueSet,2,2,([VAR#3]+[VAR#4])/5
EndOn

GReets

Jan

Re: DHT11 not decimal values?

Posted: 15 Feb 2019, 05:39
by grovkillen
You set the internal variables by the use of the Let command, these variables are "stored" under the name VAR followed by the variable number. You need to use at least one of them variables but my idea was to use two to not confused too much. You would otherwise need to set the variable after the filter...

In short, use the VAR#n syntax.