Skip to main content

# Installing

Stable library from PyPi:

  • Just run pip install pisht30

# PiSht30’s Methods

## Constructor(config={})

‘config’ is dictionary type.

### ‘address’

Configure I2C address of SHT30.

  • Address.LOW.value
    • I2C address is 0x44

    • Default

  • Address.HIGH.value
    • I2C address is 0x45

### ‘mode’

Configure measurement mode of SHT30.

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_OFF_LOW.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Disabled

    • Repeatability : Low

    • Default

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_OFF_MIDDLE.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Disabled

    • Repeatability : Middle

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_OFF_HIGH.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Disabled

    • Repeatability : High

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_ON_LOW.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Enabled

    • Repeatability : Low

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_ON_MIDDLE.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Enabled

    • Repeatability : Middle

  • Mode.SINGLE_SHOT_CLOCK_STRETCH_ON_HIGH.value
    • Single Shot Data Acquisition Mode

    • Clock stretching : Enabled

    • Repeatability : High

  • Mode.PERIODIC_MPS_0_5_LOW.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 0.5

    • Repeatability : Low

  • Mode.PERIODIC_MPS_0_5_MIDDLE.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 0.5

    • Repeatability : Middle

  • Mode.PERIODIC_MPS_0_5_HIGH.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 0.5

    • Repeatability : High

  • Mode.PERIODIC_MPS_1_0_LOW.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 1

    • Repeatability : Low

  • Mode.PERIODIC_MPS_1_0_MIDDLE.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 1

    • Repeatability : Middle

  • Mode.PERIODIC_MPS_1_0_HIGH.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 1

    • Repeatability : High

  • Mode.PERIODIC_MPS_2_0_LOW.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 2

    • Repeatability : Low

  • Mode.PERIODIC_MPS_2_0_MIDDLE.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 2

    • Repeatability : Middle

  • Mode.PERIODIC_MPS_2_0_HIGH.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 2

    • Repeatability : High

  • Mode.PERIODIC_MPS_4_0_LOW.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 4

    • Repeatability : Low

  • Mode.PERIODIC_MPS_4_0_MIDDLE.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 4

    • Repeatability : Middle

  • Mode.PERIODIC_MPS_4_0_HIGH.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 4

    • Repeatability : High

  • Mode.PERIODIC_MPS_10_0_LOW.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 10

    • Repeatability : Low

  • Mode.PERIODIC_MPS_10_0_MIDDLE.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 10

    • Repeatability : Middle

  • Mode.PERIODIC_MPS_10_0_HIGH.value
    • Periodic Data Acquisition Mode

    • Measurements per second: 10

    • Repeatability : High

## read()

Read temperature and humidity. Return value is dictionary type.

### ‘temperature’

  • OK
    • Type: float

    • Celsius temperature value [℃]

  • NG
    • Type: False

### ‘humidity’

  • OK
    • Type: float

    • Relative humidity value [%]

  • NG
    • Type: False

# Sample

Run sudo pigpiod before running the sample.

## Simple

# -*- coding: utf-8 -*-
import pisht30 as SHT30
import time

obj = SHT30.PiSht30()
try:
    while True:
        value = obj.read()
        if (isinstance(value['temperature'], float)):
            print(round(value['temperature'], 2))
        if (isinstance(value['humidity'], float)):
            print(round(value['humidity'], 2))
        time.sleep(10)
except KeyboardInterrupt:
    pass

## Modify config

‘address’ is HIGH and ‘mode’ is PERIODIC_MPS_1_0_HIGH.

# -*- coding: utf-8 -*-
import pisht30 as SHT30
import time

config = {
    'address' : SHT30.Address.HIGH.value.
    'mode' : SHT30.Mode.PERIODIC_MPS_1_0_HIGH.value
}
obj = SHT30.PiSht30(config)
try:
    while True:
        value = obj.read()
        if (isinstance(value['temperature'], float)):
            print(round(value['temperature'], 2))
        if (isinstance(value['humidity'], float)):
            print(round(value['humidity'], 2))
        time.sleep(10)
except KeyboardInterrupt:
    pass

Metadata

Release files for pisht30 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pisht30 1.0.0
File Size Uploaded
pisht30-1.0.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pisht30 1.0.0
File Interpreter ABI Platform
pisht30-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / pisht30-1.0.0.tar.gz

Download URL pisht30-1.0.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2df28c838bdb790f94bf45f1b828f78f09bca15a66ab573748cc329e6cf3e7cc
BLAKE2b-256 checksum
How to use checksums
5372f06e36dbbfefd34e7223b4feeca28e5a04d997c4d59de8941ee1b57a74eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

Release files / pisht30-1.0.0-py3-none-any.whl

Download URL pisht30-1.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b7e77e5293168eeda84a77a5749e1d5c69ecff64850d5a3d2fb54823edc9c39
BLAKE2b-256 checksum
How to use checksums
50f9f29b1d6176f4373d55afba6e6800fca88d1093cdb3c502d2c54bb4c37a33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page