Module¶
Class Check¶
-
class
ds18b20.
Check
(logger=None)¶ -
prepare
()¶ Public function prepare modifies the files /boot/config.txt and /etc/modules to enable DS18B20 functionality. Function requires sudo rights!!!
Returns: Returns None.
-
w1_config
(quiet=None)¶ Public function w1_config checks the config.txt file for the entry dtoverlay=w1-gpio.
Parameters: quiet – Expects the boolean True or None. If quiet=True, all outputs of the function w1_config are disabled. Returns: Returns True if check passed. Otherwise False.
-
w1_config
(quiet=None) Public function w1_config checks the config.txt file for the entry dtoverlay=w1-gpio.
Parameters: quiet – Expects the boolean True or None. If quiet=True, all outputs of the function w1_config are disabled. Returns: Returns True if check passed. Otherwise False.
-
Class Temp¶
-
class
ds18b20.
Temp
(csv=None, log=None, console=None)¶ -
__init__
(csv=None, log=None, console=None)¶ Public Class Temp detects connected DS18B20 one-wire sensors and provides functions to read the sensors. This class uses the standard library module logging for handling outputs.
Parameters: - csv – Expects the boolean True or None. If csv=True, a csv file is created in the same directory as this script. Afterwards all public functions of this object write entries into the csv file after been called.
- log – Expects the boolean True or None. If log=True, a .txt logfile is created in the same directory as this script. Therefore, all outputs of the level=DEBUG are written into the log file.
- console – Expects the boolean True or None. If console=True, outputs of the level=INFO are passed to the console.
Returns: Returns an object providing the public functions read and monitor.
-
monitor
(interval=60, duration=None)¶ Public function monitor starts a thread to read connected DS18B20 sensors within an interval over a duration.
Parameters: - interval – Expects an integer containing the interval time in seconds. The default interval is set to 60 seconds.
- duration – Expects an integer containing the duration time in seconds. If duration=None, the duration is infinite and the thread needs to be stopped manually by pressing Ctrl+C.
Returns: Returns None.
-
read
(*args, **kwargs)¶ Public function read reads all connected DS18B20 sensors once.
Returns: Returns a dictionary containing sensor names as keys and sensor values as values.
-