Output File (#157)
* added output file to write some values to a text file * bugfix, return statement was missing and also the description for the example is updated
This commit is contained in:
@@ -93,3 +93,18 @@ cpu_thermal_zone = 'cpu'
|
||||
# read external sensors for temperature, humidity, pressure etc.
|
||||
ext_sensors = False
|
||||
#ext_sensors = [["Housing", "ds18b20", "0014531448ff", -300], ["ext2", "sht21", 0, [-300, 0]]]
|
||||
|
||||
# output file
|
||||
output_filename = False
|
||||
#output_filename = "/dev/shm/mjpeg/user_annotate.txt"
|
||||
# a for append or w for write (overwrites content)
|
||||
output_mode = "w"
|
||||
# define what should be in the output
|
||||
def get_content_outputfile():
|
||||
# In this example the values from the ext_sensors are used
|
||||
# the values for the temperature values are rounded to 1 decimal
|
||||
sht21_temp = round(float(ext_sensors[1][3][0]), 1)
|
||||
sht21_hum = ext_sensors[1][3][1]
|
||||
ds18b20_temp = round(float(ext_sensors[0][3]), 1)
|
||||
return f"T: {sht21_temp} 'C; H: {sht21_hum} %% ; T-Rpi: {ds18b20_temp} 'C"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user