Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/all-in-one-no-pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from bme280 import BME280
from enviroplus import gas
from subprocess import PIPE, Popen
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
Expand Down Expand Up @@ -91,9 +90,10 @@ def display_text(variable, data, unit):

# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])
with open("/sys/class/thermal/thermal_zone0/temp", "r") as f:
temp = f.read()
temp = int(temp) / 1000.0
return temp


# Tuning factor for compensation. Decrease this number to adjust the
Expand Down
8 changes: 4 additions & 4 deletions examples/all-in-one.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from bme280 import BME280
from pms5003 import PMS5003, ReadTimeoutError as pmsReadTimeoutError
from enviroplus import gas
from subprocess import PIPE, Popen
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
Expand Down Expand Up @@ -96,9 +95,10 @@ def display_text(variable, data, unit):

# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])
with open("/sys/class/thermal/thermal_zone0/temp", "r") as f:
temp = f.read()
temp = int(temp) / 1000.0
return temp


# Tuning factor for compensation. Decrease this number to adjust the
Expand Down
9 changes: 5 additions & 4 deletions examples/luftdaten.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ def read_values():
return values


# Get CPU temperature to use for compensation
# Get the temperature of the CPU for compensation
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
output, _error = process.communicate()
return float(output[output.index('=') + 1:output.rindex("'")])
with open("/sys/class/thermal/thermal_zone0/temp", "r") as f:
temp = f.read()
temp = int(temp) / 1000.0
return temp


# Get Raspberry Pi serial number to use as ID
Expand Down