Browse Source

Sensor report randomly changing sensors fixed.

master
Carlos Reding 1 year ago
parent
commit
0473826122
1 changed files with 8 additions and 10 deletions
  1. 8
    10
      puppeteer/_core.py

+ 8
- 10
puppeteer/_core.py View File

@@ -409,8 +409,8 @@ class SetupDevice:
Parameters
----------
sensor_id : int
Sensor identification number.
sensor_id : str
Sensor identification number as *hexadecimal*.
report : list
List containing reported temperatures.
@@ -532,23 +532,21 @@ class SetupDevice:

# Sensors
try:
w1_init = W1()
w1_init.RETRY_DELAY_SECONDS = 0.0
w1_init.RETRY_ATTEMPTS = 3
n_sensors = len(w1_init.get_available_sensors())
W1.RETRY_DELAY_SECONDS = 0.0
W1.RETRY_ATTEMPTS = 3
n_sensors = len(W1.get_available_sensors())
if n_sensors == 0:
log = str("No sensors found.")
status = str("None")
else:
# Report sensors.
log = str(str(n_sensors) + " sensors " +
w1_init.type_name + " detected.")
W1().type_name + " detected.")
status = str("OK")
# Aggregate into one dictionary.
sensors = dict()
for s in range(n_sensors):
exec("sensors['sensor" + str(s) +
"'] = w1_init.get_available_sensors()[s]")
for sensor in W1.get_available_sensors():
sensors[sensor.id] = sensor
except:
log = str("Sensors... [FAILED]")
status = str("FAILED")

Loading…
Cancel
Save