Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for AHT30 Temperature and Humidity Sensor #19922

Merged
merged 9 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasmota/language/ru_RU.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#define D_DATA "Данные"
#define D_DARKLIGHT "Темный"
#define D_DEBUG "Отладка"
#define D_DEWPOINT "Dew point"
#define D_DEWPOINT "Точка росы"
legchenkov marked this conversation as resolved.
Show resolved Hide resolved
#define D_DISABLED "Блокирован"
#define D_MOVING_DISTANCE "Moving Distance"
#define D_STATIC_DISTANCE "Static Distance"
Expand Down
21 changes: 14 additions & 7 deletions tasmota/tasmota_xsns_sensor/xsns_63_aht1x.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#ifdef USE_I2C
#if defined(USE_AHT1x) || defined(USE_AHT2x)
#if defined(USE_AHT1x) || defined(USE_AHT2x) || defined(USE_AHT3x)

/*********************************************************************************************\
* AHT10/15/20 - Temperature and Humidity
Expand All @@ -40,7 +40,10 @@
* and allows other I2C Devices on the bus but have only one I2C Address (0x38)
* 14.09.2021 support AHT20 without enabling AHT1x
*
* 26.10.2023 support for AHT30 added.
*
* AHT20 I2C Address: 0x38
* AHT30 I2C Address: 0x38
\*********************************************************************************************/

#define XSNS_63 63
Expand All @@ -56,12 +59,15 @@
#define AHT_TEMPERATURE_OFFSET 50
#define KILOBYTE_CONST 1048576.0f

#define AHT1X_CMD_DELAY 40
#define AHT1X_RST_DELAY 30
#define AHT1X_CMD_DELAY 20
#define AHT1X_RST_DELAY 10
legchenkov marked this conversation as resolved.
Show resolved Hide resolved
#define AHT1X_MEAS_DELAY 80 // over 75ms in datasheet

#ifdef USE_AHT2x
#define AHTX_CMD 0xB1 // Cmd for AHT2x
#ifdef USE_AHT3x
legchenkov marked this conversation as resolved.
Show resolved Hide resolved
#define AHTX_CMD 0xBE // Cmd for AHT3x
const char ahtTypes[] PROGMEM = "AHT3X|AHT3X";
#elif defined(USE_AHT2x)
#define AHTX_CMD 0xBE // Cmd for AHT2x
const char ahtTypes[] PROGMEM = "AHT2X|AHT2X";
#else
#define AHTX_CMD 0xE1 // Cmd for AHT1x
Expand Down Expand Up @@ -92,6 +98,7 @@ bool AHT1XWrite(uint8_t aht1x_idx) {
Wire.write(AHTMeasureCmd, 3);
if (Wire.endTransmission() != 0)
return false;
delay(AHT1X_MEAS_DELAY);
return true;
}

Expand Down Expand Up @@ -198,7 +205,7 @@ bool Xsns63(uint32_t function)
}
else if (aht1x.count) {
switch (function) {
case FUNC_EVERY_100_MSECOND:
case FUNC_EVERY_SECOND:
AHT1XPoll();
break;
case FUNC_JSON_APPEND:
Expand All @@ -215,4 +222,4 @@ bool Xsns63(uint32_t function)
}

#endif // USE_AHT1X
#endif // USE_I2C
#endif // USE_I2C