8000 GitHub - kipe/python-onewire: A wrapper for OWFS C-API, compatible with both Python 2.7 and Python 3.x.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

kipe/python-onewire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-onewire

A wrapper for OWFS C-API, compatible with both Python 2.7 and Python 3.x.

Requirements

Depends on owcapi from OWFS -project. On Debian-based systems, it can be installed by running

apt-get install libow-dev

Install

pip install git+https://github.com/kipe/python-onewire.git

Usage

Usage is fairly similar to the original owpython. However, this library is class-based, so some modifications are required.

from onewire import Onewire

# Use USB-adapter
with Onewire('u') as o:
    # Find all temperature sensors in the bus, and print family, id and temperature as float.
    print('\n'.join([
        '%s.%s %.02f' % (s.family, s.id, s.read_float('temperature'))
        for s in o.find(has_all=['temperature'])
    ]))
    # Read temperature from specific sensor
    # (note: when accessing values directly, the return value is always a string).
    print(o.sensor('28.D035DE060000').temperature)

About

A wrapper for OWFS C-API, compatible with both Python 2.7 and Python 3.x.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0