Giter Club home page Giter Club logo

Comments (6)

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I'm not sure what's happening here- this doesn't look like an exception so much as some text being erroneously printed, but the pms5003 library doesn't output anything like this.

Does the script just hang, with (22, 'Invalid argument') being the last thing that's printed?

from enviroplus-python.

mhawkshaw avatar mhawkshaw commented on June 15, 2024

It prints it repeatedly and doesn’t submit any results to luftdaten.info

I wonder if it happens more if it gets too hot - it the sun is shining on the sensor (although it’s in a pipe) - as it seems to happen more often then

from enviroplus-python.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I have a suspicion that it's the send_to_luftdaten function that's failing with the (22, 'Invalid argument') and the catch all for Exception is causing it to be printed with every loop, rather than failing with any useful information.

I didn't write this example, so I'm not familiar with the caveats of the Luftdaten API but it looks suspiciously like you don't have a PMS5003 sensor connected, yet the example is still attempting to submit PMS5003 data resulting in an empty set of "sensordatavalues" being submitted which causes this error.

Is this the case?

from enviroplus-python.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I've mocked up a couple of test cases against the luftdaten API and my tests don't seem to support this theory.

Since the exception handling is catching all exceptions and printing them, it's not very conductive to finding the source. You could modify the example to swap out the main portion of the code for one without exception handling, so it'll fail where it fails and produce some more useful output:

# Main loop to read data, display, and send to Luftdaten
while True:
    time_since_update = time.time() - update_time
    values = read_values()
    print(values)
    if time_since_update > 145:
        resp = send_to_luftdaten(values, id)
        update_time = time.time()
        print("Response: {}\n".format("ok" if resp else "failed"))
    display_status()

I'm trying this locally to see if I can replicate!

from enviroplus-python.

Gadgetoid avatar Gadgetoid commented on June 15, 2024

I couldn't seem to replicate this at all- you'll have to try the above code (removing the exception trap) to see if you can narrow down where it's coming from.

from enviroplus-python.

mhawkshaw avatar mhawkshaw commented on June 15, 2024

Thanks for your time investigating, I'll include the above code to try and narrow it down (as soon as I get WiFi working on my Pi again...)

from enviroplus-python.

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.