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

If the sensors file corrupted the script fail #9

Open
mate1213 opened this issue Sep 19, 2023 · 0 comments
Open

If the sensors file corrupted the script fail #9

mate1213 opened this issue Sep 19, 2023 · 0 comments

Comments

@mate1213
Copy link

In sensor.py you can add the fix what is worked for me.
From line nr 27:

def process_sensors(path):
    r = {}
    for fn in os.listdir(path):
        #NEW----------------------
        #If the file is corrupted, the script will jump it over
        try:
            with open(f"{path}/{fn}") as f:
                f.read()
        except:
            continue
        #ENDOFNEW-----------------

        m = re.match(r"^(fan|in|temp|power)(\d+)_(.*)$", fn)
        if not m:
            continue

        t, i, rd = m.group(1, 2, 3)

        sens = f"{t}{i}"
        if sens not in r:
            r[sens] = {"sensor_type": t}

        r[sens][rd] = read_parse(f"{path}/{fn}")

    return r
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

1 participant