Closed nettle-m closed 2 years ago
as workaround i used this filter:
filters:
- lambda: !lambda if ( x < -1000.0 ) { return (-1) * x - 3277.0; } else { return x; }
now temperatures in home-assistant show as they should
dht source dht issues dht recent changes (message by IssueLinks)
just update: problem is still present in ESPHome version 1.16.0
Can you try the latest dev branch?
Hello, i dont want to mess with my current Home Assistant i will try to setup new instance with ESPHome dev version, but it will take some time
i was unsuccessful in dev esphome deployment. Could you guide me how can i upgrade ESPHome HO addon to dev version?
Have you tried adding a 4.7k pullup like in the docs? https://esphome.io/components/sensor/dht.html
yes, i have dht22 connected with pull up resistor from the start
This very much matches what is described in this comment: https://github.com/esphome/esphome/pull/926#issuecomment-602110509
That got fixed with the DHT22 Type 2 introduction. Are you sure DHT22_TYPE2
doesn't fix your problem?
You may want try this custom sensor from my post. It uses a newer and perhaps better DHT library. Your issue appears to be the same as found in a much older DHT library. Esphome folks may have missed a bug fix and not copied it into their DHT component.
Looking at the dht.cpp I see:
if (this->model_ != DHT_MODEL_DHT22_TYPE2 && (raw_temperature & 0x8000) != 0)
raw_temperature = ~(raw_temperature & 0x7FFF);
That should convert the sign-magnitude binary value to 2's complement required to represent a negative temperature for the conversion to int16_t later in code. This will give you a large negative number if model = DHT22_TYPE2 is used.
@nettle-m You may want to test your DHT using the new external component integration
- source: github://gb53smith/esphome@devsweep
components: [dht]
It is based on github://esphome/esphome@dev with the added test of sweeping the start delay between 800 and 20000 us. (To prove a theory that the start delay was never the true cause bad readings.) The model: must be set to AM2302 for the test to be activated.
When github://esphome/esphome@dev get released use model: DHT22 Never use model: DHT22_TYPE2 unless your DHT datasheet indicates 2's complement representation of negative temperatures
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Operating environment/Installation (Hass.io/Docker/pip/etc.):
Home Assistant OS 5.9 as KVM virtual ESP (ESP32/ESP8266, Board/Sonoff):
esp32doit-devkit-v1 ESPHome version (latest production, beta, dev branch)
ESPHome version 1.15.3 Affected component:
DHT22 https://esphome.io/components/sensor/dht.html
Description of problem: sensor is working fine when temp is above 0C but after temp drops below zero it starts to output wrong values. for example -3276.80005C but those values are correlated with temperature. I think it is some kind of conversion/overflow bug.
Problem-relevant YAML-configuration entries:
Logs (if applicable):
Additional information and things you've tried: I tried to change sensor type to all possible values: AUTO_DETECT, DHT11, DHT22, DHT22_TYPE2, AM2302, RHT03, SI7021
none of them solved the issue