Open paulguru opened 1 year ago
Maybe it's necessary to turn on power ...
- platform: gpio
id: power
pin: GPIO27
restore_mode: ALWAYS_ON
Maybe it's necessary to turn on power ...
- platform: gpio id: power pin: GPIO27 restore_mode: ALWAYS_ON
Thanks @Jenda987, I have tried turning on the power (both as switch and as an outout). Neither seems to work.
There seems to be a timing problem in the dht component when running on an ESP32. Looking at tasmota source code, they have a slightly different timing for ESP32 when using SI7021: https://github.com/arendst/Tasmota/blob/e80d053aa0bfb12ce1d4d6a2884be6c886d3669d/tasmota/tasmota_xsns_sensor/xsns_06_dht_v7.ino#L47
I tried this on a custom built dht component in esphome and it works. Currently working on a PR for this.
I miss an information: Does any one know how to detect if running on ESP32 or ESP8266 (#ifdef) in CPP code?
There seems to be a timing problem in the dht component when running on an ESP32. Looking at tasmota source code, they have a slightly different timing for ESP32 when using SI7021: https://github.com/arendst/Tasmota/blob/e80d053aa0bfb12ce1d4d6a2884be6c886d3669d/tasmota/tasmota_xsns_sensor/xsns_06_dht_v7.ino#L47
I miss an information: Does any one know how to detect if running on ESP32 or ESP8266 (#ifdef) in CPP code?
in esphome/components/dht/dht.cpp
else if (this->model_ == DHT_MODEL_SI7021) {
#ifdef USE_ESP8266
delayMicroseconds(500);
#else
delayMicroseconds(400);
#endif
this->pin_->digital_write(true);
delayMicroseconds(40);
}
Instead of:
delayMicroseconds(500);
And
#ifdef USE_ESP8266
delayMicroseconds(70);
#else
delayMicroseconds(30);
#endif
instead of
delayMicroseconds(70);
Thank you @popolite for your recommendation my issues are also seems to be related with this. If it's possible to generate a new bin files based on this modification i can try on my THR320 devices. May be you can create a pull request.
There seems to be a timing problem in the dht component when running on an ESP32. Looking at tasmota source code, they have a slightly different timing for ESP32 when using SI7021: https://github.com/arendst/Tasmota/blob/e80d053aa0bfb12ce1d4d6a2884be6c886d3669d/tasmota/tasmota_xsns_sensor/xsns_06_dht_v7.ino#L47
I tried this on a custom built dht component in esphome and it works. Currently working on a PR for this.
I miss an information: Does any one know how to detect if running on ESP32 or ESP8266 (#ifdef) in CPP code?
@popolite status update, i've applied the updates you mentioned. It's started working. I will be closely watching the results. Thanks
I have Sonoff THR316D + THS01 (exactly as this topic is) So, I changed dht.cpp as @popolite said Yes - It works, but with some trouble Log file:
[20:32:43][W][dht:177]: Requesting data from DHT failed!
[20:32:43][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[20:32:43][D][sensor:127]: 'Boiler Temperature': Sending state nan °C with 1 decimals of accuracy
[20:32:43][D][sensor:127]: 'Boiler Humidity': Sending state nan % with 0 decimals of accuracy
[20:32:52][D][sensor:127]: 'Boiler Uptime': Sending state 595.69299 s with 0 decimals of accuracy
[20:33:02][D][sensor:127]: 'Boiler WiFi Signal': Sending state -36.00000 dBm with 0 decimals of accuracy
[20:33:43][D][dht:048]: Got Temperature=26.2°C Humidity=35.7%
[20:33:43][D][sensor:127]: 'Boiler Temperature': Sending state 26.20000 °C with 1 decimals of accuracy
[20:33:43][D][sensor:127]: 'Boiler Humidity': Sending state 35.70000 % with 0 decimals of accuracy
[20:33:52][D][sensor:127]: 'Boiler Uptime': Sending state 655.69098 s with 0 decimals of accuracy
I still have some errors in log (Requesting data from DHT failed!), but the data from the sensor is finally received
Stay tuned
UPD errors statistic (update_interval: 60s - about 6% of requests completed with an error)
[20:53:43][W][dht:177]: Requesting data from DHT failed!
[21:07:43][W][dht:177]: Requesting data from DHT failed!
[21:31:43][W][dht:177]: Requesting data from DHT failed!
[21:56:43][W][dht:177]: Requesting data from DHT failed!
[22:07:43][W][dht:177]: Requesting data from DHT failed!
[22:27:43][W][dht:177]: Requesting data from DHT failed!
I tried the workaround from @popolite , but it looks like i'm not changing the correct dht.cpp. could you please provide me with the correct path. Thanks
I tried the workaround from @popolite , but it looks like i'm not changing the correct dht.cpp. could you please provide me with the correct path. Thanks
\esphome\components\dht\dht.cpp
I guess the problem is in interrupts lock
Tasmota code:
// Turn off interrupts temporarily because the next sections
// are timing critical and we don't want any interruptions.
#ifdef ESP32
{portMUX_TYPE mux = portMUX_INITIALIZER_UNLOCKED;
portENTER_CRITICAL(&mux);
#else
noInterrupts();
#endif
and ESPHOME (dht.cpp)
InterruptLock lock;
Probably ESP32 requires special interrupt lock commands (but I'm not C++ guru)
I just changed the timing here, and it works (some read failure, but ok most of the time). You can try it by adding to your esphome configuration yaml:
external_components:
source:
type: git
url: https://github.com/Beungoud/esphome
ref: fix-esp32-dht-SI7021
components: ["dht"]
@Beungoud ,I implemented your workaround and it looks good for me.
external_components: source: type: git url: https://github.com/Beungoud/esphome ref: fix-esp32-dht-SI7021 components: ["dht"]
This fix worked great for me until I upgraded to ESPHome 8.2, after which communication with my SI7021 became extremely sporadic. It's not obvious at all to me which of the (fairly minor-seeming) changes in 8.2 could have broken it, but rolling back my build to 8.1 made my SI7021 start working again.
external_components: source: type: git url: https://github.com/Beungoud/esphome ref: fix-esp32-dht-SI7021 components: ["dht"]
This fix worked great for me until I upgraded to ESPHome 8.2, after which communication with my SI7021 became extremely sporadic. It's not obvious at all to me which of the (fairly minor-seeming) changes in 8.2 could have broken it, but rolling back my build to 8.1 made my SI7021 start working again.
Thank you for the heads up. I've just planned an upgrade for today. We have to find a correct implementation for this error and commit it to the official repo. Can you give us a detail about the readings ? Btw. @jesserockz can you review the fix ?
Hello,
I have a THR316D device, is it officially supported? Couls you provide some basic stepts to flash with esphone?
Kind regards.
I just changed the timing here, and it works (some read failure, but ok most of the time). You can try it by adding to your esphome configuration yaml:
external_components: source: type: git url: https://github.com/Beungoud/esphome ref: fix-esp32-dht-SI7021 components: ["dht"]
Will you please propose your fix to new release ? It seems your fix still not included in the master. Thanks
I apologize for off topic question, but is it normal for the esp on this device to have a almost steady internal temperature of 80 degrees Celsius?
@mihaimdinca The temperature sensor needs to calibrated.
You can use something like:
filters:
- multiply: 0.18
The factor will vary, of course.
I hope I was not misunderstood, I was referring to the internal esp32 temperature sensor
I hope I was not misunderstood, I was referring to the internal esp32 temperature sensor
https://www.danielmartingonzalez.com/en/calibrate-sensors-esphome/
I will look into it a bit more closely. Thank you very much.
Can someone share a updated configuration for this setup. I can not use without fix-esp32-dht-SI7021 even though it's merged in latest version.
The problem
Hi ESPHome team,
I'm struggling to get the Sonoff Temp and Humidity Sensor THS01 (SI7021) working on the Sonoff TH Origin 16A (THR316D).
I used the yaml configuration of the Sonoff THR320D (https://www.esphome-devices.com/devices/Sonoff-THR320D) as the base for the configuration of the THR316D with some changes (since the THR316D uses a slightly different GPIO's).
I ruled out hardware issues as the sensor works when using Tasmota32.bin firmware.
FYI - I tried compiling using various board and framework options i.e. nodemcu-32s/esp32dev and esp-idf/arduino but this does not seem to have an effect.
Which version of ESPHome has the issue?
2023.2.1
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
Home Assistant 2023.2.5
What platform are you using?
ESP32-IDF
Board
nodemcu-32s
Component causing the issue
DHT
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response