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

AttributeError: 'AHT2x' object has no attribute '__status' #1

Open
jvmazola08 opened this issue Apr 15, 2022 · 2 comments
Open

AttributeError: 'AHT2x' object has no attribute '__status' #1

jvmazola08 opened this issue Apr 15, 2022 · 2 comments

Comments

@jvmazola08
Copy link

when i try to run this code:

import time, machine
import aht

Example SCL pin and SDA pin for WEMOS D1 mini Lite

i2c = machine.I2C(1,scl=machine.Pin(22), sda=machine.Pin(21))
sensor = aht.AHT2x(i2c, crc=True)

To print one of measures:

print("Humidity: {:.2f}".format(sensor.humidity))
print("Temperature: {:.2f}".format(sensor.temperature))

I get:
Traceback (most recent call last):
File "", line 3, in
File "aht.py", line 164, in
File "aht.py", line 45, in init
File "aht.py", line 56, in is_calibrated
AttributeError: 'AHT2x' object has no attribute '__status'

@etno712
Copy link
Owner

etno712 commented Jul 30, 2023

I don't see how this is possible. Can you give me the exact code that is run, your version of micropython and your ESP board?

@dadr
Copy link

dadr commented Sep 6, 2023

I saw the same error. In my case the IIC communication was not working properly. I pulled power, reconnected, and then it worked properly again. Pi Pico W, AHT21, Micropython 1.19 and also 1.20.

It might be an improvement in the code to check for proper communication over IIC and report a specific error when you can't reach the device. I suspect that would also help a lot of folks who have troubles with setting up IIC correctly.

@dadr dadr mentioned this issue Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants