hrbonz / python-aqi

A library to convert between AQI value and pollutant concentration (µg/m³ or ppm)
BSD 3-Clause "New" or "Revised" License
60 stars 28 forks source link

aqi has no attribute to_iaqi #16

Open pierrot10 opened 4 years ago

pierrot10 commented 4 years ago

Dear Sir or Madam, I am new about AQI measurement. I found a tutorial and I configure a Raspberry Zero W with Raspbian. I could successfully install the SDS011 library and I also installed. I am using Python3

sudo pip3 install python-aqi

(I also tried with pip install python-aqi) I did see any errors. However, when I call the function

def conv_aqi(pmt_2_5, pmt_10):
    aqi_2_5 = aqi.to_iaqi(aqi.POLLUTANT_PM25, str(pmt_2_5))
    aqi_10 = aqi.to_iaqi(aqi.POLLUTANT_PM10, str(pmt_10))
    return aqi_2_5, aqi_10

I got that error

AttributeError: module 'aqi' has no attribute 'to_iaqi'

Any reason of this error? Did I missed a step? Many thank for your help

hfrusinque commented 4 years ago

Dear Pierrot,

I'm also using the Nova sensors (SDS011) and had the same problem. There seems to be an issue with the pip installation. However, you can download the code directly to a zip file, and place your code into the master folder. Running the code directly in the master folder "fixed" the problem.

Best regards, Hector