Code Monkey home page Code Monkey logo

sensors.py's Introduction

sensors.py

Downloads

python bindings using ctypes for libsensors3 of the lm-sensors project. The code was written against libsensors 3.3.4.

For documentation of the low level API see sensors.h. For an example of the high level API see example.py.

For a GUI application that displays the sensor readings and is based on this library, take a look at sensors-unity.

Features

  • Full access to low level libsensors3 API
  • High level iterator API
  • unicode handling
  • Python2 and Python3 compatible

Licensing

LGPLv2 (same as libsensors3)

Usage Notes

As Python does not support call by reference for primitive types some of the libsensors API had to be adapted:

# nr is changed by refrence in the C API
chip_name, nr = sensors.get_detected_chips(None, nr)

# returns the value. throws on error
val = sensors.get_value(chip, subfeature_nr)

Missing Features (pull requests are welcome):

  • sensors_subfeature_type enum
  • sensors_get_subfeature

sensors.py's People

Contributors

ferroin avatar paroj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sensors.py's Issues

Do we know the reading units?

For each sensor i.e. subfeature, can we know the reading units?

Or is this library assuming any default reading units? Like, "Amps" for Power sensors? "Celsius" for Temperature sensors? "RPM" for Fan sensors"...etc

Error: sensors.get_label(chip, feature)

Hello,

I get the error : "segmentation error (core dumped)" when I try to catch the label.
Do you know how could I fix it please ?
My python version is the 3.5, does it matter ?

import sensors

sensors.init()

for chip in sensors.ChipIterator("coretemp-*"):
    print(sensors.chip_snprintf_name(chip)+" ("+sensors.get_adapter_name(chip.bus)+")")
    for feature in sensors.FeatureIterator(chip):
        sfi = sensors.SubFeatureIterator(chip, feature)
        vals = [sensors.get_value(chip, sf.number) for sf in sfi]
        label = sensors.get_label(chip, feature)       
        print("\t"+label+": "+str(vals))

sensors.cleanup()

thanks,

Release to pip/ create release tags on the repo

I'd like to use this lib, but it's pretty complicated as the build system I use (bitbake) is verifying the checksum of the repo, and master is the only ref i can use, which can change.
Please release the tarball to pip or make release tags on the repo, that wont randomly mutate

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.