Giter Site home page Giter Site logo

custom PM sensor about weewx-aqi HOT 20 OPEN

misko903 avatar misko903 commented on June 22, 2024
custom PM sensor

from weewx-aqi.

Comments (20)

Distortionist avatar Distortionist commented on June 22, 2024

Did you ever figure this out? I just found this trying to get my pm2_5 readings to be calculated to air quality index of canada or US. I am in over my head, I am trying to do what you are doing, just use the existing values stored in weewx.sdb like the pm2_5, temp, pressure and humidity. I have not installed this extension, I am still trying to figure out if it will work for me and how easy it is to get going. The instructions assume I know more than I do haha.

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

This issue looks like it is missing two parameters for AQI calculation. So I have uncommented

#        temp = extraTemp1
#        pressure = pressure

But then weewx crashes:

Dec 28 03:50:11 WeeWX weewx[32674] INFO user.interceptor: shutting down server thread
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__: Caught unrecoverable exception:
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  unsupported operand type(s) for -: 'NoneType' and 'float'
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  Traceback (most recent call last):
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 210, in run
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.CHECK_LOOP, packet=packet))
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      callback(event)
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 630, in check_loop
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      raise BreakLoop
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  weewx.engine.BreakLoop
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  During handling of the above exception, another exception occurred:
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  Traceback (most recent call last):
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 646, in post_loop
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      self._catchup(self.engine.console.genArchiveRecords)
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 690, in _catchup
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      for record in generator(lastgood_ts):
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/drivers/__init__.py", line 30, in genArchiveRecords
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      raise NotImplementedError("Method 'genArchiveRecords' not implemented")
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  NotImplementedError: Method 'genArchiveRecords' not implemented
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  During handling of the above exception, another exception occurred:
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  Traceback (most recent call last):
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewxd", line 154, in main
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      engine.run()
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 217, in run
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      self.dispatchEvent(weewx.Event(weewx.POST_LOOP))
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      callback(event)
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 648, in post_loop
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      self._software_catchup()
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 710, in _software_catchup
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      origin='software'))
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/engine.py", line 241, in dispatchEvent
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      callback(event)
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/user/aqi/service.py", line 311, in new_archive_record
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      temp_kelvin = weewx.units.CtoK(weewx.units.FtoC(row['outTemp']))
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****    File "/usr/share/weewx/weewx/units.py", line 43, in FtoC
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****      return (x - 32.0) * 5.0 / 9.0
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL __main__:     ****  Exiting.

Q: what is doing this in my weewx.conf AQI Stanza:
usUnits = usUnits
in my weewx i am using METRIC, or METRICWX
for example [FilePile], which is collecting data from my SDS sensor:
unit_system = METRICWX
but in [StdConvert] i am using
target_unit = US
is the usUnits ok in my case? what are the possibilities?

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

I got mine working for US standards with these settings for my aqi sensor :

[AqiService] [[standard]] data_binding = aqi_binding standard = user.aqi.us.NowCast [[air_sensor]] data_binding = wx_binding usUnits = usUnits dateTime = dateTime temp = outTemp pressure = pressure pm2_5 = pm2_5
My issue is I live in Canada. I can't figure out how to tell it to use the Canadian AQHI standard, and it mentions that it is the only one that needs more than one reading but doesn't mention what readings I need for it.

I think this project needs better documentation for newbs like me.

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

I got mine working for US standards with these settings for my aqi sensor :

[AqiService] [[standard]] data_binding = aqi_binding standard = user.aqi.us.NowCast [[air_sensor]] data_binding = wx_binding usUnits = usUnits dateTime = dateTime temp = outTemp pressure = pressure pm2_5 = pm2_5
My issue is I live in Canada. I can't figure out how to tell it to use the Canadian AQHI standard, and it mentions that it is the only one that needs more than one reading but doesn't mention what readings I need for it.

I think this project needs better documentation for newbs like me.

Are you using Purple Air Sensor? Me not, I just want to read everything from weewx database.
Try to add humidity to your settings.

M.

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

ok, what did you changed that it work? Mine is still crashing.

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

absolutely nothing! just the config file I posted works for me. Are you sure your temperature and pressure is stored correctly? I see you are using temp = extraTemp1 are you sure that is correct? My outdoor array has the temperature in it stored as outTemp in my database weewx database. I don't really know what FilePile is and why you have it set to something different than weewx, if you are storing to the same weewx database. I think it is storing metric numbers and weewx thinks they are US numbers. I suggest trying to convert them to match or start over. I am just a newb I wish I can help more, but by the looks of it, one of those values is not what it is expecting. Something like your pressure is 1013 in metric, and it is like WOW that is crazy if it was expecting 29.91.

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

"Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL main: **** temp_kelvin = weewx.units.CtoK(weewx.units.FtoC(row['outTemp']))
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL main: **** File "/usr/share/weewx/weewx/units.py", line 43, in FtoC
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL main: **** return (x - 32.0) * 5.0 / 9.0
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL main: **** TypeError: unsupported operand type(s) for -: 'NoneType' and 'float'
Dec 28 03:50:12 WeeWX weewx[32674] CRITICAL main: **** Exiting."

It is definitely complaining about your out temp. I really suck at this but something is wrong with the way your out temp is stored. It is trying to convert F to C, then C to K, but it can't because of something not making sense is the best I can make of what is happening here.

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

https://stackoverflow.com/questions/23037408/typeerror-unsupported-operand-types-for-float-and-nonetype-python

Reading that, I think outTemp one is empty or something. But from what you say too, the units may be stored in C to begin with and even if the conversion works, the value would be wrong. I think you need to tell your FilePile to store in us since that is what weewx thinks the database is, and make sure it is actually getting stored correctly. The error references outTemp not extraTemp1. I suggest Telling FilePile to store it as outTemp, in F, and match the setting temp = outTemp. See if that works! The code may be wrong and is not looking up the temp = setting somewhere, or your database has it missing or empty, I have no idea whos fault it is but I am pretty sure doing what I suggested will fix, at least this part of it. It works for me!

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

So i changed the temp = outTemp. now it looks like this:

Jan  3 20:35:03 WeeWX /weewxd: AqiService: ValueError AQI calculation for pm2_5 on 1609702440 failed: NowCast AQI could not be calculated for the observations. Too many missing. Missing 2, which meets or exceeding the limit of 1
Jan  3 20:35:03 WeeWX /weewxd: AqiService: ValueError AQI calculation for pm10_0 on 1609702440 failed: NowCast AQI could not be calculated for the observations. Too many missing. Missing 1, which meets or exceeding the limit of 1
Jan  3 20:35:03 WeeWX /weewxd: AqiService: not storing record for dateTime 1609702440

Solution to your Canadian problem maybe here:
https://github.com/jonathankoren/weewx-aqi/blob/master/bin/user/aqi/standards.py

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

I have checked all the values, they are filled in - as US units in weewx.sdb

        usUnits = usUnits
        dateTime = dateTime
        temp = outTemp
        pressure = pressure
        pm2_5 = pm2_5
        pm10_0 = pm10_0

The PM values are measured/written every 3rd minute. There are no missing fields, the value is written 3 times unchanged. Can this be an issue?

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

Added to write values every 60 seconds. Ending up with the same error...
maybe @jonathankoren can help here?

I'm glad that my conf helped you at least!

from weewx-aqi.

Distortionist avatar Distortionist commented on June 22, 2024

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

It works somehow :)
Dont know why... I am setting up plotting now and coloured values. I dont know which AQI is used in my country - Slovakia

from weewx-aqi.

misko903 avatar misko903 commented on June 22, 2024

OK, it doesn't work again.
My sensor does not have cut of the extreme high values, so this is done by weewx.conf MinMax values - weewx will simply delete them. Then there are missing fields of pm2_5 and pm10_0 in the database (NULL) and weewx-aqi can't calculate the values.
@jonathankoren, is it possible to ignore some predefined number of NULL fields?

from weewx-aqi.

jonathankoren avatar jonathankoren commented on June 22, 2024

@misko903 I think it's better if you just delete the records from your DB

from weewx-aqi.

jonathankoren avatar jonathankoren commented on June 22, 2024

@misko903 I believe Slovakia will use the EU standards that are in the new release. I found two online. I believe EuropeanAirQualityIndex is the new one.

from weewx-aqi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.